[Nagiosplug-devel] Help needed with simple BASH plugin - Nagios getting (null)

Alan Johnson aj at okesit.net
Mon May 24 20:26:54 CEST 2010


Hi everyone,

I am writing a plugin to be used internally to monitor the status of my Amazon S3 backups.

Its very simple in that it telnets to a port on my backup server thats backs up to S3, then either gets a 0,1 or 2 depending on exit code of the S3 synchronisation.  That part work perfectly.

The problem is the plugin on the Nagios box.  If I run it from the command line, I get everything as expected, plus the correct exit code.  When I run it in Nagios, I get (null) and thats it.

My Nagios plugin is:

#!/bin/bash
STATUS=`/bin/nc $1 65530`
if [ "$STATUS" = "0" ] ;
	then
		/bin/echo "OK: S3 synchronisation okay"
		exit 0
fi
if [ "$STATUS" = "1" ] ;
        then
                /bin/echo "OK: S3 synchronisation currently running"
                exit 1
fi
if [ "$STATUS" = "2" ] ;
        then
                /bin/echo "CRITICAL: S3 synchronisation failed"
                exit 2
fi

Any ideas on what may be wrong?  Haven't seen any solution on other lists that help.





More information about the Devel mailing list