packages: nagios-plugin-check_amavis/check_amavis.pl - use nagios exit codes

glen glen at pld-linux.org
Thu Dec 22 13:24:35 CET 2011


Author: glen                         Date: Thu Dec 22 12:24:35 2011 GMT
Module: packages                      Tag: HEAD
---- Log message:
- use nagios exit codes

---- Files affected:
packages/nagios-plugin-check_amavis:
   check_amavis.pl (1.2 -> 1.3) 

---- Diffs:

================================================================
Index: packages/nagios-plugin-check_amavis/check_amavis.pl
diff -u packages/nagios-plugin-check_amavis/check_amavis.pl:1.2 packages/nagios-plugin-check_amavis/check_amavis.pl:1.3
--- packages/nagios-plugin-check_amavis/check_amavis.pl:1.2	Thu Dec 22 13:23:27 2011
+++ packages/nagios-plugin-check_amavis/check_amavis.pl	Thu Dec 22 13:24:29 2011
@@ -10,6 +10,14 @@
 my $to = '';
 my $debug = 0;
 
+my %STATES = (
+	"OK" => 0,
+	"WARNING" => 1,
+	"CRITICAL" => 2,
+	"UNKNOWN" => 3,
+	"DEPENDENT" => 4,
+);
+
 $result = GetOptions (
 	"server|s=s"    =>      \$server,
 	"port|p=s"      =>      \$port,
@@ -19,7 +27,8 @@
 );
 
 if (!$server || !$from) {
-	die ("Please specify server, from\n");
+	print "Please specify server, from\n";
+	exit $STATES{UNKNOWN};
 }
 
 if (!$to) {
@@ -52,7 +61,7 @@
 
 if (!$smtp) {
 	print "CRITICAL - amavisd-new server unreachable\n";
-	exit;
+	exit $STATES{CRITICAL};
 }
 
 $smtp->mail($from);
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/nagios-plugin-check_amavis/check_amavis.pl?r1=1.2&r2=1.3&f=u



More information about the pld-cvs-commit mailing list