jablonka.czprosek.czf

hotsanic

Subversion Repositories:
[/] [branches/] [HotSaNIC-0.5.0-pre6/] [modules/] [mailq/] [platform/] [default.pm] - Blame information for rev 31

 

Line No. Rev Author Line
11simandlpackage HotSaNICmod::OSdep;
2 
3#use strict;
4use diagnostics;
5 
6sub version {
7 ($VERSION = '$Revision: 1.6 $') =~ s/.*(\d+\.\d+).*/$1/;
8 return "default.pm $VERSION";
9 }
10 
11sub sample {
12 my %args=@_;
13 
14 $kbytes=0;
15 $crefused=0;
16 $ctimeout=0;
17 $rtimeout=0;
18 $nohost=0;
19 $other=0;
20 $msrefused=0;
21 $active=0;
22 
23 open FILE,"mailq|";
24 while (<FILE>) {
25 if (/^\w{10,}\*\s/o) { $active++; }
26 elsif (/^\s*\(/o) {
27 if (index($_,"Connection refused") >=0 ) { $crefused++; }
28 elsif (index($_,"Connection timed out") >=0 ) { $ctimeout++; }
29 elsif (index($_,"Host not found") >=0 ) { $nohost++; }
30 elsif (index($_,"read timeout") >=0 ) { $rtimeout++; }
31 elsif (index($_,"server refused mail service") >=0 ) { $msrefused++; }
32 else { $other++; }
33 }
34 elsif (/^--/o) { (undef,$kbytes)=split; }
35 }
36 close FILE;
37 
38 my $req=$crefused+$ctimeout+$rtimeout+$nohost+$other+$msrefused+$active;
39 
40 HotSaNICmod::do_rrd("queue","U",time,$kbytes,$req,$crefused,$ctimeout,$rtimeout,$nohost,$other,$msrefused);
41 
42 }
43 
441;
45 
46# possible failure messages and their internal assignments
47#
48# "Connection refused" => crefused
49# "Connection timed out" => ctimeout
50# "Host not found" => nohost
51# "Host not found, try again" => nohost
52# "No route to host" => noroute
53# "server dropped connection" => other
54# "server refused mail service" => msrefused
55#

Powered by WebSVN 2.2.1