![]() ![]() |
hotsanic |
Subversion Repositories: |
Compare with Previous - Blame - Download
package HotSaNICmod::OSdep;#use strict;use diagnostics;sub version {($VERSION = '$Revision: 1.6 $') =~ s/.*(\d+\.\d+).*/$1/;return "default.pm $VERSION";}sub sample {my %args=@_;$kbytes=0;$crefused=0;$ctimeout=0;$rtimeout=0;$nohost=0;$other=0;$msrefused=0;$active=0;open FILE,"mailq|";while (<FILE>) {if (/^\w{10,}\*\s/o) { $active++; }elsif (/^\s*\(/o) {if (index($_,"Connection refused") >=0 ) { $crefused++; }elsif (index($_,"Connection timed out") >=0 ) { $ctimeout++; }elsif (index($_,"Host not found") >=0 ) { $nohost++; }elsif (index($_,"read timeout") >=0 ) { $rtimeout++; }elsif (index($_,"server refused mail service") >=0 ) { $msrefused++; }else { $other++; }}elsif (/^--/o) { (undef,$kbytes)=split; }}close FILE;my $req=$crefused+$ctimeout+$rtimeout+$nohost+$other+$msrefused+$active;HotSaNICmod::do_rrd("queue","U",time,$kbytes,$req,$crefused,$ctimeout,$rtimeout,$nohost,$other,$msrefused);}1;# possible failure messages and their internal assignments## "Connection refused" => crefused# "Connection timed out" => ctimeout# "Host not found" => nohost# "Host not found, try again" => nohost# "No route to host" => noroute# "server dropped connection" => other# "server refused mail service" => msrefused#