Suppose we want to monitor the CPU load of the example-host.
Enable performance processing in service definition:
define service{
...
host_name example-host
service_description CPU Load
process_perf_data 1
check_command check_nrpe!check_load
...
}
The performance data will be automatically created:
# tree /var/log/nagios/rrd/perfdata/
/var/log/nagios/rrd/perfdata/
|-- example-host
|-- CPU_Load.rrd
`-- CPU_Load.xml
Interesting config in CPU_Load.xml:
...
<TEMPLATE>check_load</TEMPLATE>
<NAME>load1</NAME>
<WARN>5.000</WARN>
<CRIT>10.000</CRIT>
...
The TEMPLATE is auto set to the name of the check command with is “check_load” here1). You can change it to your needs.
Now we need to make sure a corresponding template file exists in the template folder /usr/share/nagios/pnp/templates. The template file is a php file, so it is check_load.php in this example.
We create check_load.php using the stock file /usr/share/nagios/pnp/templates.dist/check_load.php. We can customize it to our needs. Please see offical docs on templates customization.