Nagios module for monitoring Postfix Queue Size

#!/usr/bin/php                                                                                                                                                                                          
<?                                                                                      
                                                                                        
$e=exec("postqueue -p|tail -n1");                                                       
if (preg_match("/empty/",$e))                                                           
{                                                                                       
        print "OK: Queue is empty | queue_size=0\n";                                    
        die(0);                                                                         
}                                                                                       
                                                                                        
preg_match("/([0-9]+) Requests/",$e,$m);                                                
if ($m[1]>100)                                                                          
{                                                                                       
        print "WARNING: ".$m[1]." mails in queue | queue_size=".$m[1]."\n";             
        die(1);                                                                         
} else {                                                                                
        print "OK: ".$m[1]." mails in queue | queue_size=".$m[1]."\n";                  
        die(0);                                                                         
}                                                                                       
?>
Dette indlæg blev udgivet i Knowledge Base. Bogmærk permalinket.

Skriv et svar