fw.pl
上传用户:shbosideng
上传日期:2013-05-04
资源大小:1555k
文件大小:1k
- #!/usr/local/bin/perl
- # reads stats and uptime from ip-filter for mrtg
- # ron@rosie.18james.com, 2 Jan 2000
- my $firewall = "IP Filter v3.3.3";
- my($in_pkts,$out_pkts) = (0,0);
- open(FW, "/sbin/ipfstat -hio|") || die "cannot open ipfstatn";
- while (<FW>) {
- $in_pkts += $1 if (/^(d+)s+passs+ins+quick.*groups+1d0/);
- $out_pkts += $1 if (/^(d+)s+passs+outs+quick.*groups+1d0/);
- }
- print "$in_pktsn",
- "$out_pktsn";
- my $uptime = `/usr/bin/uptime`;
- $uptime =~ /^s+(d{1,2}:d{2}..)s+ups+(d+)s+(......),/;
- print "$2 $3n",
- "$firewalln";