check_events.pl


#1

Hi,

I have configured all the prereqs for the check_events.pl plugin and can successfully run the plugin from the command line. In my specific case the plugin looks at a local file on the icinga server for an up or down string. It works when I run it:

perl check_events.pl -L -U -D

I have the command configured as specified in the check_events.pl.

‘check_events’ command definition

define command{
command_name check_events
command_line $USER1$/check_events.pl -w $ARG1$ -c $ARG2$ -L $ARG3$ -S $ARG4$ -D $ARG5$ -U $ARG6$
}

define service{
use local-service
host_name localhost
service_description
check_command check_events!-L /var/log/ -D “down” -U "up"
notifications_enabled 0
}
<> represents a path to a file that is managed by syslog-ng.
The error I get is:

The command defined for service does not exist

Anyone have any ideas? The Icinga server is functional in all other respects (and is in production) and monitors heaps of other stuff happliy.
The local-service is defined as the default service that is configured to monitor the localhost (nagios or icinga host) and is configured as 127.0.0.1

Does anyone know if this plugin is reuired to be run via NRPE or anything like that?

Any help would be great!! I can provoide additonal info, but do not have access to the server at present.

Cheers


#2

can you run the plugin from command line as user nagios (or icinga) ?


#3

Luca,

Thanks for the reply. I can run the check_events.pl from the command line sa user icinga. I initally had issues with the Nagios::Plugin CPAN module not being avaialbe, so installed ActivePerl rpm and ensured that the library was in the path (script specific and using the PATH). I could then run the plugin happily using:

perl check_events/pl _l <path -U -D

The result could come back with an OK or a WARNING result as required. When it is run inside Icinga, then it returns the error described in the previous post.

Thanks


#4

never mind

here it expects 6 parameters…

you are passing only one

-L /var/log/<syslog path> -D "down" -U "up"

if you want to recreate your test string: perl check_events.pl -L -U -D

you need to change the command definition to
command_line $USER1$/check_events.pl -L $ARG1$ -U $ARG2$ -D $ARG3$

and the service def would then be:
check_command check_events!/var/log/!“up”!“down”

hope this helps and please check the docs nagios.sourceforge.net/docs/3_0/macros.html


#5

Luca,

Thanks! I have been playing around with that for so long, that I must have missed that I changed the command. I almost hope that it isn’t the case :smiley:

I needed another pair of eyes to assit. Many Thanks. I will check when I am back at work and make sure that it works.

Thnaks again…