Telegraf is an agent that pushes metrics to a server, such as InfluxDB.

Tasks[edit | edit source]

Monitoring CPU frequency

Simplest way is to use an exec input:

[[inputs.exec]]
  commands = ["bash -c \"grep MHz /proc/cpuinfo | /bin/awk -F: '{freq += \\$2; n++} END{printf(\\\"%f\\\", freq/n); }'\" "]
  name_override = "cpu_freq"
  data_format = "value"
  data_type = "float"

This will just retrieve the CPU speeds which awk will average out as a single value.

$ grep MHz /proc/cpuinfo | awk -F: '{freq+=$2; n++} END {printf("%f", freq/n);}'
3099.926000