run_passive_check_.sh
A shell script for running via cron that executes an NRPE command and saves the data for get_data.pl.
Size 1 kB - File type text/x-shFile contents
#!/bin/sh # Configure this: nrpecfg=/etc/nagios/nrpe.cfg # Main routine if [ ! -f "$nrpecfg" ] ; then echo "$nrpecfg not found" exit 1 fi if [ $# -lt 1 ] ; then echo "Usage: $0 command" echo " where 'command' is an entry in nrpe.cfg." exit 2 fi option=$1 shift command=`sed -ne "s/^command\[$option]=\(.*\)/\1/p" <$nrpecfg` if [ -z "$command" ] ; then echo "'$option' not found in $nrpecfg" exit 3 fi com=`echo $command | cut -f1 -d' '` if [ ! -x $com ] ; then echo "$com not executable" exit 4 fi if `$com --help | grep -q -- -t` ] ; then output=`$command -t 15000` rval=$? else output=`$command` rval=$? fi echo "`date +%s`;`hostname -s`;$option;$rval;$output"
Click here to get the file