[Nagiosplug-devel] Timeouts in BASH Plugins

Richard Edward Horner rich at richhorner.com
Fri Aug 29 19:34:17 CEST 2008


Thanks for the tip, Thomas. I'll check it out.

Rich(ard)

On Fri, Aug 29, 2008 at 1:26 PM, Thomas Guyot-Sionnest <thomas at zango.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Richard Edward Horner wrote:
>> Babar,
>>
>> Thanks for the response. I wasn't able to make any headway on this.
>> I'll guess I'll just rewrite my checks in Perl.
>
> You could probably use this (I didn't tested), but it may leave stall
> processes behind:
>
> #!/usr/bin/perl
>
> use strict;
> use warnings;
>
> $SIG{'ALRM'} = sub {
>  print "CRITICAL: foo\n";
>  exit 2;
> };
>
> alarm(60);
> my $text = `/bin/bash /path/to/plugin.sh`;
> my $result = $?>>8;
> alarm(0);
>
> print $text;
> return $result;
> __END__
>
> If you need to kill stale processes, it's a bit more complicated - look
> at my check_rsync v1.02 plugin for an example.
>
> http://www.nagiosexchange.org/cgi-bin/page.cgi?g=Detailed%2F2094.html;d=1
>
> - --
> Thomas
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.7 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFIuDEo6dZ+Kt5BchYRAnAeAJ4vFtPdukgoDqfdHgzKM7PW702kVwCePFLI
> ENJCFwf3+ZHv9YbR90G7YNk=
> =iXQd
> -----END PGP SIGNATURE-----
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________________
> Nagios Plugin Development Mailing List Nagiosplug-devel at lists.sourceforge.net
> Unsubscribe at https://lists.sourceforge.net/lists/listinfo/nagiosplug-devel
> ::: Please include plugins version (-v) and OS when reporting any issue.
> ::: Messages without supporting info will risk being sent to /dev/null
>



-- 
Richard Edward Horner
Engineer / Composer / Electric Guitar Virtuoso
http://richhorner.com




More information about the Devel mailing list