#! /usr/local/bin/perl -w #This program is called when the cpu proccess for the CMTS MAC protocol exceeds 20%. #It will clear the ARP table and then show the ARP table to verify the ARP timers #have been reset to 0. #INPUT: uBR-3C #OUTPUT: Email responsible people that the CMTS MAC protocol exceeded 20%, and #that the ARP table has been cleared. #AUTHOR: Matt Orcutt use Net::Telnet::Cisco; $pager1 = ''; # pager1 email address $mail_list[0] = $pager1; $file = ''; # the file that contains the CMTS passwords 1 per line while (<>) { $input = $_; } chomp $input; $ubr = $input; print "$ubr\n"; open(FILE, "<$file") or die "Couldn't open $file for reading\n"; while() { @input = split; } $global = $input[0]; $priv = $input[1]; my $cs = Net::Telnet::Cisco->new( Host => $ubr ); $cs->login( '' , $global ); $cs->enable($priv); # Turn off paging my @cmd_output = $cs->cmd( 'terminal length 0' ); # clear arp table and show arp for testing @cmd_output = $cs->cmd( "clear arp" ); sleep 30; #@cmd_output = $cs->cmd( "sh arp" ); #print @cmd_output; $cs->close; foreach $mail_list (@mail_list) { if ($mail_list =~ m/\w+\@/) { $mailto = $mail_list; $mailfrom = "super-user\@turbonium.lvcm.com"; $mailsubj = "CMTS MAC protocol High\n"; $mailbody = "CMTS MAC protocol on $ubr exceeded threshold. ARP table has been cleared. Please add arp timout 1800 on all blades of the uBR.\n"; open(MAIL, '|/usr/lib/sendmail -t') or die "could not fork sendmail: $!"; print MAIL "From: $mailfrom\n"; print MAIL "To: $mailto\n" or die "e-mail wrong\n"; print MAIL "Subject: $mailsubj\n\n"; print MAIL "$mailbody"; close (MAIL) or warn "sendmail didn't close nicely.\n"; } }