Permissions problem? You're running the command line as root; try running the command line as your Nagios username. ________________________________________ From: Nibin VM [nibin...@piserve.com] Sent: Sunday, January 23, 2011 10:46 AM To: nagios-users@lists.sourceforge.net Subject: [Nagios-users] Trying to develop a new perl plugin
Hello guys, I am trying to write some nagios perl plugin to monitor some services I'm responsible for. Initially I tried to write custom plugin to monitor mail queue using the following script. =========== #!/usr/bin/perl -w use strict; use Net::SNMP; use Getopt::Long; use lib "/usr/lib64/nagios/libexec"; my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3); my $host = undef; my $result = undef; my @array = undef; $host=$ARGV[0]; $result=`/usr/lib64/nagios/plugins/check_snmp -H $host -C "community" -o extOutput.1`; @array = split(/\ /, $result); chomp($array[3]); if ( $array[3] le "19999" ) { print "OK: current emails queue is $array[3]\n"; exit $ERRORS{"OK"}; } elsif ( $array[3] ge "20000" && $array[3] le "29999" ) { print "Warning: current emails queue is $array[3]\n"; exit $ERRORS{"WARNING"}; } elsif ( $array[3] ge "30000" ) { print "Critical: current emails queue is $array[3]\n"; exit $ERRORS{"CRITICAL"}; } else { print "Unknown"; exit $ERRORS{"UNKNOWN"}; } ================ As you can see, I use snmp to pull mail queue from the remote server. When I try the command from command line it work fine. ]# ./test.pl<http://test.pl> "server name" OK: current emails queue is 264 But from the nagios from end it shows as critical and it shows "Critical: current emails queue is Unknown" error :( Please somebody help me to sort this out. Obviously its the first perl script that I ever wrote and I really interested to write more plugins in perl(I am in love with perl now :) ). Thanks in advance! -- Regards, Nibin. ------------------------------------------------------------------------------ Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d _______________________________________________ Nagios-users mailing list Nagios-users@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