Linux-Noob Forums
Nagios Plugin for to check service statuses of linux - Printable Version

+- Linux-Noob Forums (https://www.linux-noob.com/forums)
+-- Forum: Distro Noob (https://www.linux-noob.com/forums/forum-10.html)
+--- Forum: Fedora (https://www.linux-noob.com/forums/forum-94.html)
+--- Thread: Nagios Plugin for to check service statuses of linux (/thread-1430.html)



Nagios Plugin for to check service statuses of linux - Ramesh - 2007-04-19


Hi All,

 

I need to check service statuses of linux from Nagios Monitoring tool.

 

Is there any plugin to check service statuses of linux?

 

I wrote one shell script for this:

 



Code:
#!/bin/sh
host="$1"
service="$2"
t=`/etc/init.d/$service status`
if echo "$t" |grep -q running; then
echo "OK - $service service is running."
exit 0
else
echo "Critical - $service service is stopped."
exit 2
fi




 

But it is working from terminal. But it is not working from nagios. Actually for example `/etc/init.d/acpid status` is not executing when nagios calling.

 

how do I make it to execute correct? or Is there any way to get needed result?

 

Please help!




Nagios Plugin for to check service statuses of linux - hijinks - 2007-04-19


that isn't really what nagios is used for

 

look into puppet [/url][url=http://reductivelabs.com/projects/puppet]http://reductivelabs.com/projects/puppet




Nagios Plugin for to check service statuses of linux - foucault - 2009-05-25


Well you can do this, what's stopping you is the shell that nagios is given.

 

cat /etc/password | grep nagios

 

as you can see its set to /bin/false

 

usermod --shell /bin/bash nagios

 

and you script will work as expected.

 

This is a security risk, but I'm not going to get into that. just wanted to let you know a workaround.




Nagios Plugin for to check service statuses of linux - Kobus - 2010-03-01


This is exactly what Nagios is used for

 

I will have a look at you script and send a replacement if you still need one.

 

Kobus