Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Ravikimt
Posts: 77 Joined: Tue Apr 03, 2018 12:02 pm
Post
by Ravikimt » Thu Jun 07, 2018 10:17 am
As you have suggested I added echo $pid in my check_node script but same thing not getting any output.
I restarted nrpe service also after making the changes in the script
Code: Select all
#!/bin/bash
#Mentioned valid service name
service=node
#Checking for service pid value
pid=`ps -ef | grep -v grep | grep -i $service | wc -l`
case $pid in
[2]*)
echo $pid
echo "OK - $service is running"
exit 0
;;
[0]*)
echo $pid
echo "CRITICAL -$service is not running"
exit 2
;;
[1]*)
echo $pid
echo "WARNING -$service Please check the service"
exit 1
;;
esac
I tried with this command also but doesn't help.
Code: Select all
sudo su nagios -c /usr/local/nagios/libexec/node_check
Last edited by
Ravikimt on Thu Jun 07, 2018 10:27 am, edited 1 time in total.
Ravikimt
Posts: 77 Joined: Tue Apr 03, 2018 12:02 pm
Post
by Ravikimt » Thu Jun 07, 2018 10:26 am
Sorry I have mentioned wrong variable in my code instead of var i am using pid var only so ignore that var in check_node
scottwilkerson
DevOps Engineer
Posts: 19396 Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:
Post
by scottwilkerson » Thu Jun 07, 2018 10:27 am
Change it to this
Code: Select all
#!/bin/bash
#Mentioned valid service name
service=node
#Checking for service pid value
var=`ps -ef | grep -v grep | grep -i $service | wc -l`
echo $var
case $var in
[2]*)
echo "OK - $service is running"
exit 0
;;
[0]*)
echo $pid
echo "CRITICAL -$service is not running"
exit 2
;;
[1]*)
echo $pid
echo "WARNING -$service Please check the service"
exit 1
;;
esac
Ravikimt
Posts: 77 Joined: Tue Apr 03, 2018 12:02 pm
Post
by Ravikimt » Thu Jun 07, 2018 10:39 am
Yes, I have changed the script now I am getting the correct output
Code: Select all
bash /usr/local/nagios/libexec/check_node
4
OK -node is running
tell me the next step what I have to do.?
Ravikimt
Posts: 77 Joined: Tue Apr 03, 2018 12:02 pm
Post
by Ravikimt » Thu Jun 07, 2018 10:48 am
I resolved the issue thanks a lot man you are genius man .
scottwilkerson
DevOps Engineer
Posts: 19396 Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:
Post
by scottwilkerson » Thu Jun 07, 2018 10:53 am
Ravikimt wrote: I resolved the issue thanks a lot man you are genius man .
Excellent!
Glad we could help. Locking thread