Adding Perf Data (which op5 will auto graph!) w/NRPE

The NRPE command for checking procs simply returns

PROCS OK: 112 processes
PROCS OK: 112 processes

Using some code off the net, we can create a little wrapper to print the Nagios Performance Data way (if that's even a sentence)

[root@op5 op5_custom_plugins]# cat /opt/local/tpt/op5_custom_plugins/check_procs_wp.sh
#!/bin/bash
LINE=`/opt/plugins/check_procs $*`
RC=$?
COUNT=`echo $LINE | awk '{print $3}'`
echo $LINE \| procs=$COUNT
exit $RC
[root@op5 op5_custom_plugins]#

Running this by hand gives us:

[root@op5 op5_custom_plugins]#  /opt/local/tpt/op5_custom_plugins/check_procs_wp.sh
PROCS OK: 114 processes | procs=114
[root@op5 op5_custom_plugins]#

Create a newline in the config file

[root@op5 op5_custom_plugins]# cat /etc/nrpe.d/op5_commands.cfg | grep total_procs
command[total_procs]=/opt/plugins/check_procs -w 150 -c 200
command[total_procs_wp]=/opt/local/tpt/op5_custom_plugins/check_procs_wp.sh -w 150 -c 200
[root@op5 op5_custom_plugins]#

Using the name "total_procs_wp" in the nrpe call, we'll get the total procs running AND with op5, it'll start auto graphing that for us.

Leave a Reply

Your email address will not be published.