Nagios return 0byte string from bash script
Posted: Mon Jun 11, 2018 6:40 am
Hi,
We have configured shell script to mointior unity storage via nagios, the script is working fine via CLI, but it is 0 byte output via nagios
cfg file :
command.cfg
Can you please anyone help on this issue.
We have configured shell script to mointior unity storage via nagios, the script is working fine via CLI, but it is 0 byte output via nagios
Code: Select all
# ls -la check_unity.sh
-rwxr-xr-x 1 nagios nagios 681 Jun 11 11:19 check_unity.sh
# cat check_unity.sh
#!/bin/bash
ucli=/usr/bin/uemcli
host=$1
user="$2"
password="$3"
check_path="$4"
if [ "`$ucli -d $host -user $user -password $password $check_path show -output csv | sed '1d' | cut -d"," -f5 | sed -e 's/\"//g' -e 's/\s.*//g' | sort | uniq | awk '{if (NR == 4) print}'`" == "OK" ] ; then
echo "OK - no faults detected"
exit 0
else
echo "UNKNOWN - Unisphere CLI returned an error, unable to perform check"
exit 1
fiCode: Select all
define service{
use array-service ; Inherit values from a template
service_description check unity Status
host_name unity5400 ; hostname the service is associated with
check_command check_unity_status!xxx!ppp!/env/ps
normal_check_interval 10 ; Check the service every 60 minutes under normal conditions
}Code: Select all
#check_unity_general
define command{
command_name check_unity_status
command_line $USER2$/check_unity.sh $HOSTADDRESS$ $ARG1$ $ARG2$ $ARG3$
}