部署在nagios中的语句不能执行
在nagios中部署了一段语句
--lsnrctl)
lsnrctl=` lsnrctl status`
#lsnrctl=` echo "successfully"`
lsnrctl2=` echo $lsnrctl | grep -c successfully`
echo $lsnrctl
echo $lsnrctl2
if [ `echo $lsnrctl2 | bc` -eq 1 ] ; then
echo "lsnrctl is OK"
exit $STATE_OK
else
echo "lsnrctl is NG"
exit $STATE_CRITICAL
fi
;;
监控中输出:
(No output returned from plugin)
0
lsnrctl is NG
而用下面这段就正常
--lsnrctl)
#lsnrctl=` lsnrctl status`
lsnrctl=` echo "successfully"`
lsnrctl2=` echo $lsnrctl | grep -c successfully`
#echo $lsnrctl
#echo $lsnrctl2
if [ `echo $lsnrctl2 | bc` -eq 1 ] ; then
echo "lsnrctl is OK"
exit $STATE_OK
else
echo "lsnrctl is NG"
exit $STATE_CRITICAL
fi
;;
这样就正常输出:
successfully
1
lsnrctl is OK
请问各位这个问题出在什么地方?
------解决方案--------------------