I've been beavering away with my nagios install, and it's all going pretty well. So I thought I'd move on to writing my own (very simple!) custom plugin.
I wrote a simple script to check whether a tape drive door is open or not. The script works fine when I run it from the command-line.
However, when I call it via check_nrpe, it always reports that a tape is inserted - even if it's not!
So I figure I must have something wrong with how I am calling the script. Hours of web searching later I'm none the wiser, so I thought I'd ask and hope some kind soul takes pity on me!
Here is the nuts and bolts of my script -
/bin/mt -tf /dev/st0 status | sed -n 6p" = " DR_OPEN IM_REP_EN" ] ; then
echo "WARNING - no tape is inserted"
echo "OK - tape is inserted"
and here is the command I've added to nrpe.cfg -
If I run the script from the command-line on a server with no tape in the drive, I get this -
WARNING - no tape is inserted
But when I call it via check_nrpe (from the local server), I get this instead -
/usr/local/nagios/libexec/check_nrpe -H 127.0.0.1 -c check_tape
OK - tape is inserted
What am I missing?!
Thanks for any help.