Hi List,<br><br> I have this simple plugin that check for spamd availability on my mailservers, but apparently the service status on webui is always unknown.Running it manually on CLI return success.<br>nagios:/usr/lib/nagios/plugins# ./check_spamd.pl mailgw
<br>OK<br><br>Don't have an nrpe installed if ever that would matter. Object commands and host had been also defined. Appreciate for any tips.<br><br><br><br>below is the actual script:<br><br>nagios:/usr/lib/nagios/plugins# more check_spamd.pl
<br>#!/usr/bin/perl -w<br>#=for Information:<br>#Program to check to make sure spamd is running and report back to nrpe for<br>#nagios.<br>#Created: 11/29/2006<br>#Version: 1.2<br>#Revised: 12/03/2006<br>#Revised by: Erinn Looney-Triggs
<br>#Author: Erinn Looney-Triggs<br>#=cut<br>#<br>use strict;                 #Do it right<br>use Switch;                 #Standard perl 5.8 module to use switch statement<br>use POSIX qw( WIFEXITED );  #Fix system call's strange return values
<br><br>my $spamc = "/usr/bin/spamc";    #Location of spamc<br>my $hostname=$ARGV[0];<br>#<br>#Make sure spamc exists and if not give back a nagios warning<br>if ( !-e $spamc ){<br>    print "The $spamc program does not exist.\n";
<br>        exit 3;<br>        }<br><br>        #The command to be run<br>        my $cmd = "echo foo | $spamc -x -c -t 10 -d $hostname > /dev/null";<br><br>        #Run the command<br>        WIFEXITED(system ($cmd)) or die "Couldn't run $cmd\n";
<br>#<br>#        #Divide by 256 or bitshift right by 8 to get the original error code<br>        my $return_value = $? >> 8;<br>#<br>#        #Parse the errors and give Nagios parsible error codes and messages<br>        switch ($return_value){
<br>            case 0      {print "OK\n"; exit 0;}<br>            case 64     {print "Command line usage error\n"; exit 1;}<br>            case 65     {print "Data format error\n"; exit 1;}<br>
            case 66     {print "Cannot open input\n"; exit 1;}<br>            case 67     {print "Addressee unknown\n"; exit 1;}<br>            case 68     {print "Host name unknown\n"; exit 1;}
<br>            case 69     {print "Spamd service unavailable\n"; exit 2;}<br>            case 70     {print "Internal software error\n"; exit 2}<br>            case 71     {print "System error (e.g
., can't fork)\n"; exit 2;}<br>            case 72     {print "Critical OS file missing\n"; exit 2;}<br>            case 73     {print "Can't create (user) output file\n"; exit 1;}<br>            case 74     {print "Input/output error\n"; exit 1;}
<br>            case 75     {print "Temp failure; user is invited to retry\n"; exit 1;}<br>            case 76     {print "Remote error in protocol\n"; exit 2;}<br>            case 77     {print "Permission denied\n"; exit 1;}
<br>            case 78     {print "Configuration error\n"; exit 1;}<br>            else        {print "An unknown error has occured in $spamc\n"; exit 3}<br>            }<br><br>