different results when running script
Posted: Tue Mar 01, 2016 3:27 pm
Nagios XI Version : 2014R2.7
pmonnag001.ops.cin.mp-emaxx.com 2.6.18-400.1.1.el5 x86_64
Red Hat Enterprise Linux Server release 5.11 (Tikanga)
Gnome is not installed
Proxy appears to be in use
The below shell script outputs the following correct results when executed from the nagios server command line.
[root@pmonnag001 ramcmon]# ./both.sh
OK: RamCache Verify: 1234 assets verified
When using the "Test Check Command" in the nagiox XI GUI, it gives the following output. Any ideas as to what I'm doing wrong?
COMMAND: /usr/local/nagios/libexec/ramcmon/both.sh -I pmonnag001
OUTPUT:
#!/bin/bash
#set -x
#./update.sh > update.out 2>&1
#./verify.sh > verify.out 2>&1
monitor_file=/usr/local/nagios/libexec/ramcmon/monitor.out
status=`sed -n 1p $monitor_file`
#status=green
message=`sed '1 d' $monitor_file`
#message='RamCache Verify: 1234 assets verified'
function ok_status
{
echo "OK: $message"
exit 0
}
function critical_status
{
echo "CRITICAL: $message"
exit 2
}
function warning_status
{
echo "WARNING: $message"
exit 1
}
if [ $status == 'red' ]
then
critical_status
elif [ $status == 'yellow' ]
then
warning_status
elif [ $status == 'green' ]
then
ok_status
fi
pmonnag001.ops.cin.mp-emaxx.com 2.6.18-400.1.1.el5 x86_64
Red Hat Enterprise Linux Server release 5.11 (Tikanga)
Gnome is not installed
Proxy appears to be in use
The below shell script outputs the following correct results when executed from the nagios server command line.
[root@pmonnag001 ramcmon]# ./both.sh
OK: RamCache Verify: 1234 assets verified
When using the "Test Check Command" in the nagiox XI GUI, it gives the following output. Any ideas as to what I'm doing wrong?
COMMAND: /usr/local/nagios/libexec/ramcmon/both.sh -I pmonnag001
OUTPUT:
#!/bin/bash
#set -x
#./update.sh > update.out 2>&1
#./verify.sh > verify.out 2>&1
monitor_file=/usr/local/nagios/libexec/ramcmon/monitor.out
status=`sed -n 1p $monitor_file`
#status=green
message=`sed '1 d' $monitor_file`
#message='RamCache Verify: 1234 assets verified'
function ok_status
{
echo "OK: $message"
exit 0
}
function critical_status
{
echo "CRITICAL: $message"
exit 2
}
function warning_status
{
echo "WARNING: $message"
exit 1
}
if [ $status == 'red' ]
then
critical_status
elif [ $status == 'yellow' ]
then
warning_status
elif [ $status == 'green' ]
then
ok_status
fi