Telegraf: Difference between revisions

From Leo's Notes
This page was last edited on 13 January 2021, at 23:46.
Created page with "Telegraf is an agent that pushes metrics to a server, such as InfluxDB. == Tasks == Monitoring CPU frequency Simplest way is to use an exec input: {{Highlight | code = inp..."
 
Line 1: Line 1:
Telegraf is an agent that pushes metrics to a server, such as InfluxDB.
Telegraf is an agent that pushes metrics to a server, such as InfluxDB.


== Tasks ==
==Tasks==
Monitoring CPU frequency
Monitoring CPU frequency


Line 7: Line 7:
{{Highlight
{{Highlight
| code = [[inputs.exec]]
| code = [[inputs.exec]]
   commands = ['bash -c "cat /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_cur_freq{{!}}/bin/awk \'{freq += \$1; n++} END{printf(\"%f\", freq/n/1000); }\'"']
   commands = ["bash -c \"cat /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_cur_freq {{!}} /bin/awk '{freq += \\$1; n++} END{printf(\\\"%f\\\", freq/n/1000); }'\" "]
   name_override = "cpu_freq"
   name_override = "cpu_freq"
   data_format = "value"
   data_format = "value"
   data_type = "float"
   data_type = "float"
| lang = text
| lang = toml
}}
}}

Revision as of 23:46, 13 January 2021

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

Tasks

Monitoring CPU frequency

Simplest way is to use an exec input:

[[inputs.exec]]
  commands = ["bash -c \"cat /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_cur_freq | /bin/awk '{freq += \\$1; n++} END{printf(\\\"%f\\\", freq/n/1000); }'\" "]
  name_override = "cpu_freq"
  data_format = "value"
  data_type = "float"