Trouble with embedded perl: nagios keeps forking perl plugins

Nicolás Alen nicolas.alen at elserver.com
Thu Mar 17 05:25:51 CET 2005


Dear Stanley,

Thank you very much for your reply.
Nag installation seems correct. I'll put some examples anyway:



Nagios binary:

=================================================================
# ./nagios -m

Nagios 1.2
Copyright (c) 1999-2004 Ethan Galstad (nagios at nagios.org)
Last Modified: 02-02-2004
License: GPL

External Data I/O
-----------------
Object Data:      TEMPLATE
Status Data:      DEFAULT
Retention Data:   DEFAULT
Comment Data:     DEFAULT
Downtime Data:    DEFAULT
Performance Data: DEFAULT

Options
-------
* Embedded Perl compiler (With caching)
=================================================================



An example perl command on checkcommands.cfg:

=================================================================
define command {
command_name                   check_ping
command_line                   $USER1$/check_ping.pl $HOSTADDRESS$ $ARG1$
$ARG2$ $ARG3$ $ARG4$ $ARG5$
}
=================================================================



Part of the code...

=================================================================
#!/bin/perl -w

use strict;
use lib "/usr/local/nagios/libexec";
use utils qw(%ERRORS $TIMEOUT);
use Data::Dump qw(dump);

sub print_usage
{
        print "usage: check_ping.pl host wpl cpl wrta crta [packets]\n";
        exit $ERRORS{"UNKNOWN"};
}

print_usage() if (@ARGV < 5);

$SIG{'ALRM'} = sub
{
        print "ERROR: Alarm signal (Nagios time-out)\n";
        exit $ERRORS{"UNKNOWN"};
};

alarm($TIMEOUT);
=================================================================


>> Do your plugins contain a shebang line ?

Yes. It was #!/usr/bin/perl before you asked, but still I see Nag forking
and executing perl to run the plugins: 

# ps axuwww | grep perl | grep ping
nagios   21211  3.0  0.1  3008 1648 ?        R    01:21   0:00 /bin/perl -w
/usr/local/nagios/libexec/check_ping.pl 200.32.5.224 20 50 300.0 1000.0


>> The only way of nailing this, or any plugin/Nag problem,
>> is by building a Nag with debug options and running it in a sandpit.

Didn't find find anything useful apart from a wrong path to my host-perfdata
log :/ 


Do you think I should try nagios 2 for a chage?
This is somehow silly, but do I have to include some special code on my perl
plugs? 



>> Acres of HTML deleted; please don't do this.
Sorry! Won't do it again.


Thank you very much again!!

Nicolás Alen.






Yours sincerely.

--
Stanley Hopcroft

IP Australia
Ph: (02) 6283 3189  Fax: (02) 6281 1353
PO Box 200 Woden  ACT 2606
http://www.ipaustralia.gov.au



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list