#! /usr/local/bin/perl # MRTG script for pulling and tracking RS and CRC errors # Scott Presnell, srp@zgi.com, Wed Feb 7 07:51:00 PST 2001 $cisco = "/usr/local/etc/cisco"; open(QP, "rsh -n $cisco |") || die "cannot open pipe to DSL router ($!)\n"; # $opt_d = 1; while () { chop; if (/uptime/) { $uptime = $_; } if (/(\d+)\s+Kbps\s+down;\s+(\d+)\s+Kbps\s+up;/) { $speed[0] = $1; $speed[1] = $2; } elsif (/Line\s+Quality\s+(\d+)\s+dB/) { $signal = $1; } if (/uncorrected\s+RS\s+errors:\s+(\d+)\s+\#\s+of\s+corrected\s+RS\s+errors:\s+(\d+)/) { print "uncorrected RS errors: $1\n" if ($opt_d); print " corrected RS errors: $2\n" if ($opt_d); $werrs[0] = $1; $werrs[1] = $2; } elsif (/CRC\s+errors:\s+(\d+)/) { print "crc errors: $1\n" if ($opt_d); $werrs[2] = $1; } elsif (/rejected\s+Tx\s+packets:\s+(\d+)/) { print "Tx errors: $1\n" if ($opt_d); $werrs[3] = $1; } } close(QP); print $werrs[0] + $werrs[1], "\n"; print $werrs[2], "\n"; print $uptime, "\n"; print "Cisco675 errors\n"; exit(0);
Scott Presnell
Last modified: Wednesday, February 7, 2001 07:52 PST