-
Notifications
You must be signed in to change notification settings - Fork 384
collectors NagiosPerfdataCollector
The NagiosPerfdataCollector parses Nagios performance data in the PNP4Nagios/Graphios/Metricinga key-value format.
- Nagios configured to periodically dump performance data files in PNP4Nagios format
If you're already using Graphios, you're already set up to send metrics through Metricinga, and you can skip to the next section! If not, read on.
The default performance data output format used by Nagios and Icinga can't be easily extended to contain new attributes, so we're going to replace it with one that prints key-value pairs instead. This will allow us to add in whatever kind of bookkeeping attributes we want! We need these to do things like override the display name of a service with a metric name more meaningful to Graphite.
We'll need to edit one of the following files:
- For Nagios: /etc/nagios/nagios.cfg
- For Icinga: /etc/icinga/icinga.cfg
Make sure that the following configuration keys are set to something like the values below:
process_performance_data=1
host_perfdata_file=/var/spool/nagios/host-perfdata
host_perfdata_file_mode=a
host_perfdata_file_processing_command=process-host-perfdata-file
host_perfdata_file_processing_interval=60
host_perfdata_file_template=DATATYPE::HOSTPERFDATA TIMET::$TIMET$ HOSTNAME::$HOSTNAME$ HOSTPERFDATA::$HOSTPERFDATA$ HOSTCHECKCOMMAND::$HOSTCHECKCOMMAND$ HOSTSTATE::$HOSTSTATE$ HOSTSTATETYPE::$HOSTSTATETYPE$ GRAPHITEPREFIX::$_HOSTGRAPHITEPREFIX$ GRAPHITEPOSTFIX::$_HOSTGRAPHITEPOSTFIX$ # NOQA
service_perfdata_file=/var/spool/nagios/service-perfdata
service_perfdata_file_mode=a
service_perfdata_file_processing_command=process-service-perfdata-file
service_perfdata_file_processing_interval=60
service_perfdata_file_template=DATATYPE::SERVICEPERFDATA TIMET::$TIMET$ HOSTNAME::$HOSTNAME$ SERVICEDESC::$SERVICEDESC$ SERVICEPERFDATA::$SERVICEPERFDATA$ SERVICECHECKCOMMAND::$SERVICECHECKCOMMAND$ HOSTSTATE::$HOSTSTATE$ HOSTSTATETYPE::$HOSTSTATETYPE$ SERVICESTATE::$SERVICESTATE$ SERVICESTATETYPE::$SERVICESTATETYPE$ GRAPHITEPREFIX::$_SERVICEGRAPHITEPREFIX$ GRAPHITEPOSTFIX::$_SERVICEGRAPHITEPOSTFIX$ # NOQA
Note that you most likely will wish to change
Next, the rotation commands need to be configured so the performance data files
are periodically moved into the Metrnagios spool directory. Depending on your
system configuration, these commands may be located in
/etc/nagios/objects/commands.d
:
define command {
command_name process-host-perfdata-file
command_line /bin/mv /var/spool/nagios/host-perfdata /var/spool/diamond/host-perfdata.$TIMET$ # NOQA
}
define command {
command_name process-service-perfdata-file
command_line /bin/mv /var/spool/nagios/service-perfdata /var/spool/diamond/service-perfdata.$TIMET$ # NOQA
}
Options - Generic Options
Setting | Default | Description | Type |
---|---|---|---|
byte_unit | byte | Default numeric output(s) | str |
enabled | False | Enable collecting these metrics | str |
measure_collector_time | False | Collect the collector run time in ms | bool |
metrics_blacklist | None | Regex to match metrics to block. Mutually exclusive with metrics_whitelist | NoneType |
metrics_whitelist | None | Regex to match metrics to transmit. Mutually exclusive with metrics_blacklist | NoneType |
perfdata_dir | /var/spool/diamond/nagiosperfdata | The directory containing Nagios perfdata files | str |
__EXAMPLESHERE__