If I can make a jabber call as nagios... why can't nagios?!


#1

Hi all,

I’ve recently been looking at migrating from a windows-based server monitoring system (well… what else would you do if you had a windows-based anything?!), and I recently stumbled across Nagios - looks just the ticket! :slight_smile:

However, it has to do everything the windows-based system can do (of course), so I am trying to configure it to make jabber calls.

Now… I’ve set everything up, and the logs are telling me that my jabber calls are being delivered every 1 minute on my (test) failing service… along with my email alerts (which do arrive… hundreds of 'em!). But the Jabber calls aren’t making it.

So I set the debug level to -1 to show me everything, and tracked down what’s going wrong, which is… (I’ve cut a few lines out here but this gives all the pertinant information)

[1268086401.168373] [2048.1] [pid=11568] Processing: ‘/usr/local/bin/notify_via_jabber $CONTACTPAGER$ “$NOTIFICATIONTYPE$ $HOSTNAME$ $SERVICEDESC$ $SERVICESTATE$ $SERVICEOUTPUT$ $LONGDATETIME$”’
[1268086401.168396] [2048.1] [pid=11568] Done. Final output: ‘/usr/local/bin/notify_via_jabber greg@mydomain.com “PROBLEM localhost SSH CRITICAL Connection refused Mon Mar 8 22:13:21 GMT 2010”’
[1268086401.168414] [2048.1] [pid=11568] Processing: ‘SERVICE NOTIFICATION: greg;localhost;SSH;$SERVICESTATE$;notify-by-jabber;$SERVICEOUTPUT$’
[1268086401.168421] [2048.1] [pid=11568] Done. Final output: ‘SERVICE NOTIFICATION: greg;localhost;SSH;CRITICAL;notify-by-jabber;Connection refused’
[1268086401.168487] [256.1] [pid=11568] Running command ‘/usr/local/bin/notify_via_jabber greg@mydomain.com “PROBLEM localhost SSH CRITICAL Connection refused Mon Mar 8 22:13:21 GMT 2010”’…
[1268086401.168671] [256.0] [pid=11568] Embedded perl successfully compiled /usr/local/bin/notify_via_jabber and returned plugin handler (Perl subroutine code ref)
[1268086403.340913] [256.0] [pid=12931] Embedded perl ran command /usr/local/bin/notify_via_jabber with output 3, **ePN /usr/local/bin/notify_via_jabber: “Use of uninitialized value in concatenation (.) or string at /usr/bin/p1.pl line 54,”.
[1268086403.341490] [256.1] [pid=11568] Execution time=2.172 sec, early timeout=0, result=3, output=**ePN /usr/local/bin/notify_via_jabber: “Use of uninitialized value in concatenation (.) or string at /usr/bin/p1.pl line 54,”.

So this tells me that I’ve got a perl problem (/usr/local/bin/notify_via_jabber: "Use of uninitialized value in concatenation (.) or string at /usr/bin/p1.pl line 54)

Except… if I login to the box as nagios and run the command (/usr/local/bin/notify_via_jabber greg@mydomain.com “PROBLEM localhost SSH CRITICAL Connection refused Mon Mar 8 22:13:21 GMT 2010”) manually it works perfectly! My jabber messages arrive immediately.

So… any ideas on why I can do it, but nagios seemingly can’t?!

I’m running nagios-3.2.0-1.el5.rf and nagios-plugins-1.4.13-1.el5.rf (latest versions) on CentOS 5.4.

Any thoughts/suggestions much appreciated!

Thanks,

Greg.


#2

scripts running as a user without having an actual login do not have the user scripts run at startup…
So possibly some environment variable is missing :slight_smile:


#3

Hi Luca,

Thanks for the response. It was enough to make me re-examine the nagios.cfg file to see if I could find anything that looked revelant, upon which I found (and disabled) the ‘use_embedded_perl_implicitly’ variable… and now my jabber calls work from nagios!

Not sure if disabling this will have any knock-on effects, but I’m sure I’ll find out as my nagios system grows! :slight_smile: