perl/SNMP/examples/testleak.pl
raw| 1 | use SNMP 1.6; |
| 2 | |
| 3 | $host = shift; |
| 4 | unless ($host) { |
| 5 | $| = 1; print "enter SNMP host address: "; $| = 0; |
| 6 | chomp($host = <STDIN>); |
| 7 | } |
| 8 | |
| 9 | $obj = new SNMP::Session DestHost, $host; |
| 10 | |
| 11 | while (){ |
| 12 | print $obj->get(["ifNumber",0]); |
| 13 | open(COM,"ps -u$$|") || die; |
| 14 | @bar = <COM>; |
| 15 | $siz = (split(' ',$bar[1]))[4]; |
| 16 | $rss = (split(' ',$bar[1]))[5]; |
| 17 | close(COM); |
| 18 | print "siz = $siz, rss = $rss\n"; |
| 19 | } |