#!/bin/bash # Nagios plugin to do a Novell eDirectory status check # Written by Jesse Pretorius, jesse.pretorius@gmail.com # Version 1.0, 18 July 2011 # Project location: www.monitoringexchange.org errorlvl=0 tmpfile=`mktemp` output="" # Run the ndsd status command /etc/init.d/ndsd status > $tmpfile 2>&1 ndsdstatus="$?" # If the command produces an error, return the error if [ "$ndsdstatus" -gt "0" ]; then output="CRITICAL: Failed to run the ndsd status command successfully!\n`cat $tmpfile`" errorlvl=2 else output="OK: ndsd status is good." fi # Clean up the temp file, output the result and the error level rm -f $tmpfile echo -e $output exit $errorlvl