Nagios Plugin for to check service statuses of linux


#1

Hi All,

I need Nagios Plugin for to check service statuses of the Linux System.

Please let me know where do I get this plugin?

I done with shell script. But not working with nagios when nagios calling.
This is the script I wrote:

#!/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----------------------------------------------------------------------------------------
Here, above code working fine but /etc/init.d/$service status is not executing when nagios calling. means for example /etc/init.d/acpid status nagios unable to execute this command.

how do i execute this command from nagios?

Is there any other way to check service statuses of linux?

Please help!


#2

I am trying to figure out the same thing. Has anyone ever done this?


#3

Hi,
there is a permisison problem, the script will be executed as user nagios, not root, therefore you cannot execute scripts in /etc/init.d.

Besides of that you never use the parameter $host… it may then be omitted :frowning:

Bye
Ivan