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

The NRPE command for checking procs simply returns

PROCS OK: 112 processes

[cce]PROCS OK: 112 processes[/cc]

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)

[cce][[email protected] 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
[[email protected] op5_custom_plugins]#
[/cc]
Running this by hand gives us:

[cce]
[[email protected] op5_custom_plugins]#  /opt/local/tpt/op5_custom_plugins/check_procs_wp.sh
PROCS OK: 114 processes | procs=114
[[email protected] op5_custom_plugins]#[/cc]

Create a newline in the config file
[cce][[email protected] 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
[[email protected] op5_custom_plugins]#[/cc]

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.