# Author: Michael Collins (colli2mj@jmu.edu, mcollins@va.rr.com) # Description: A tool that will parse a snoop log and count the # number of requests made to the SNMP entity by the MTAs. @snoop_args = ("snoop", "-i", "/opt/mike/snoop-log.bin"); open(PIPE, "@snoop_args|") or die "PIPE failed.\n"; while() { push(@output_snoop, $_); } close(PIPE); open(FILE, ">snoop.log") or die "Could not open file.\n"; print FILE "@output_snoop"; close(FILE); @grep_args = ("grep", "-c", "-i", "D=162", "/opt/mike/snoop.log"); open (PIPE, "@grep_args|"); while() { @hits = split; } close(PIPE); $hits = $hits[0]; print "Attempts: ", $hits/2, "\n";