[Nagiosplug-devel] Re: return code
Subhendu Ghosh
sghosh at sghosh.org
Wed Apr 14 13:18:01 CEST 2004
Sorry - you posted to the admin list.
On Wed, 14 Apr 2004, Marco Barrera wrote:
> Hi All,
>
> Hope I am starting a discussion in the correct forum, I think this is
> more of a development issue rather than anything else.
>
> I have been seeing a problem with a my plugin firebox
>
> I am using some perl code to submit commands containing:
>
> =========================================
> #!/usr/bin/perl -w
>
> use lib "/usr/lib/nagios/plugins";
> use utils qw($TIMEOUT %ERRORS);
>
>
> my $state = 'OK';
>
> my $memtotal = 0;
> my $memused = 0;
> my $memfree = 0;
> my $memshared = 0;
> my $membuffers = 0;
> my $memcached = 0;
> my $Mensaje = '';
>
>
> open(OUTPUT,"/usr/sbin/cbsh 372.168.0.154 DDDDedo9 -c 'status all' | grep 'Mem:'|");
> while (<OUTPUT>){
> if (/^Mem:\s+(\d.*)/) { $Mensaje = $1; last; }
> }
>
> ($memtotal, $memused, $memfree, $memshared, $membuffers, $memcached) = split /\s+/, $Mensaje, 6;
>
> print "Stest $memfree $membuffers\n";
> exit $ERRORS{$state};
> =============================================
>
> When I run the plugin
> manually, it consistently works,
>
> [root at csm-server plugins]# ./check_wg-mem.pl
> Stest 18944000 14516224
>
> but when it is run by
> nagios, the exit code is frequently wrong.
>
> Stest
>
> I work with RH ES 3
>
> Is there an alternative solution?
>
>
--
More information about the Devel
mailing list