Telegraf: Difference between revisions
m Added categories and navbox |
No edit summary |
||
| 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. | ||
== Installation == | |||
The install instructions can be found at https://docs.influxdata.com/telegraf/v1.22/install/. Distro-specific repos are listed on this page and this is probably the preferred method to install Telegraf. | |||
Alternatively, you can download and extract the binaries directly to your system. You will have to set up the systemd service script manually. | |||
{{Highlight | |||
| code = # wget https://dl.influxdata.com/telegraf/releases/telegraf-1.26.0_linux_amd64.tar.gz | |||
# tar -C / --strip-components=2 -xzvf telegraf-1.26.0_linux_amd64.tar.gz | |||
| lang = terminal | |||
}} | |||
==Tasks== | ==Tasks== | ||
=== Monitoring CPU frequency === | |||
Simplest way is to use an exec input: | Simplest way is to use an exec input: | ||
{{Highlight | {{Highlight | ||
| Line 18: | Line 28: | ||
| lang = terminal | | lang = terminal | ||
}} | }} | ||
=== Monitoring SNMP === | |||
Use the SNMP plugin. You will have to install the <code>net-snmp-utils</code> package as the plugin uses the <code>snmptranslate</code> program. | |||
{{Navbox Linux}} | {{Navbox Linux}} | ||
[[Category:Linux]] | [[Category:Linux]] | ||
[[Category:LinuxUtilities]] | [[Category:LinuxUtilities]] | ||
Revision as of 17:37, 17 April 2023
Telegraf is an agent that pushes metrics to a server, such as InfluxDB.
Installation
The install instructions can be found at https://docs.influxdata.com/telegraf/v1.22/install/. Distro-specific repos are listed on this page and this is probably the preferred method to install Telegraf.
Alternatively, you can download and extract the binaries directly to your system. You will have to set up the systemd service script manually.
# wget https://dl.influxdata.com/telegraf/releases/telegraf-1.26.0_linux_amd64.tar.gz
# tar -C / --strip-components=2 -xzvf telegraf-1.26.0_linux_amd64.tar.gz
Tasks
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
Monitoring SNMP
Use the SNMP plugin. You will have to install the net-snmp-utils package as the plugin uses the snmptranslate program.