Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

[Nagiosplug-help] How to verify if nagios was built with embperl?

From: <Ralph.Grothe(at)itdz-berlin.de>
Date: Mon Sep 24 2007 - 09:22:09 EDT


Hello,

this is a follow-on to my posting to this list about inexplicable UNKNOWN state determination
by nagios of a custom plugin.

Unfortunately, no one seemed interested enough to reply.

However, meanwhile I think to have traced down the culprit.

It seems to be my convenience definition of a __DIE__ signal handler in my plugin.

I defined this vileness in my code

$SIG{__DIE__} = sub { chomp(my $out = shift);

                      printf "%s - %s\n",
$NAGIOS_SERVICESTATE{3}, $out;
                      exit 3
                    };

as a sort of catch all abnomalies which I could catch as usual by an or-ed die.

Do you need help?X

As shown in my last posting (see below)
my plugin's output and exit code behaved absolutely as expected when run as nagios from the shell.

As soon as I comment the above sigdie handler out the plugin shows
the green OK also in the web interface when run by nagios.

Since the %SIG hash is a package global I suspect that my nagios binary was built with some embperl support
which I wasn't aware of.
(btw, no difference when I declare my sig handler as local which should mask
SIG's symbol table entry)

I haven't built nagios from the sources but for ease of installation
resorted to prebuilt RPMs.
Unfortunately, in these RPMs I couldn't find any hint about the build options,
nor some spec file.

So, how can I verify that my nagios binary indeed is precaching Perl plugins
and executing them via embperl?

When I look at the shared libs there is a reference to some libperl
which to me looks like I do run an embperl enabled nagios.

# rpm -q nagios
nagios-2.9-1.el5

# uname -r
2.6.18-8.el5  

Do you need more help?X

# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5 (Tikanga)

# ldd /usr/sbin/nagios

        linux-gate.so.1 =>  (0x00631000)
        libperl.so =>

/usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/libperl.so (0x00110000)
        libresolv.so.2 => /lib/libresolv.so.2 (0x008a7000)
        libnsl.so.1 => /lib/libnsl.so.1 (0x00708000)
        libdl.so.2 => /lib/libdl.so.2 (0x004ac000)
        libm.so.6 => /lib/libm.so.6 (0x00483000)
        libcrypt.so.1 => /lib/libcrypt.so.1 (0x046f2000)
        libutil.so.1 => /lib/libutil.so.1 (0x00df8000)
        libpthread.so.0 => /lib/libpthread.so.0 (0x004b2000)
        libc.so.6 => /lib/libc.so.6 (0x00344000)
        /lib/ld-linux.so.2 (0x00327000)

Regards

Ralph

> -----Original Message-----
> From: nagiosplug-help-bounces@lists.sourceforge.net
> [mailto:nagiosplug-help-bounces@lists.sourceforge.net]On Behalf
Of
> Ralph.Grothe@itdz-berlin.de
> Sent: Friday, September 21, 2007 7:30 PM
> To: nagiosplug-help@lists.sourceforge.net
> Subject: [Nagiosplug-help] Inexplicable UNKNOWN state of custom
> plugindisplayed in web interface
>
>
> Hello,
>
> I have a nasty bug that I cannot resolve.
>
> I have written a Perl plugin that runs snmp checks against
> environmental sensor devices
> to poll the temprature at various spots in the data centre.
>
> As far as I can see I have obeyed the prerequisites a plugin
must
> meet.
> It outputs a single line with status and values
> as well as the correct return code.
>
> When I execute it from the shell as nagios user it behaves as
> expected.
> e.g.
>
> $ /usr/lib/nagios/plugins/check_sensor_temp.pl -H sensor_r06 -C
> public -w 17:27 -c 10:30
> SENSOR OK - temp: T0=21.40 degC T1=24.50 degC
> $ echo $?
> 0
>
> The plugin's output is also correctly displayed as above in the
> web interface's status information field.
> However, this is not true for the bg coloring (which is orange)
> and
> the text in the table field that displays the status of the
last
> check,
> where it reads UNKNOWN,
> just as if nagios had received an exit code of 3
>
> In the nagios log in the filesystem I can only see appearances
of
> my nothing changing forced
> external commands from reschedule check clicks via the web
> interface,
> like this (but nothing else):
>
> [1190389354] EXTERNAL COMMAND:
> SCHEDULE_FORCED_SVC_CHECK;sensor_r06;SRZ_Temp;1190389352
>
> Trying to look at the event log from within the web interface
> stalls my browser
> because the log file is obviously too long as I get a lot of
> check results for passive checks
> from distributed servers.
> Maybe a quicker log rotation scheme could alliviate, but I find
> event log CGI broken
> if it hangs my browser.
>
> Can anyone give me some hint why I get UNKNOWN states
displayed,
> and how I could try to debug this (maybe some strace on the
> nagios scheduler?)
>
> Regards
>
> Ralph
>
> --------------------------------------------------------------
> -----------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Nagiosplug-help mailing list
> Nagiosplug-help@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagiosplug-help
> ::: Please include plugins version (-v) and OS when reporting
> any issue.
> ::: Messages without supporting info will risk being sent to
/dev/null
>



This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

Nagiosplug-help mailing list
Nagiosplug-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagiosplug-help ::: Please include plugins version (-v) and OS when reporting any issue. ::: Messages without supporting info will risk being sent to /dev/null Received on Mon Sep 24 09:22:47 2007

This archive was generated by hypermail 2.1.8 : Mon Oct 08 2007 - 18:06:11 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library