This is a discussion on
Cable Upstream SNR Viewer in Perl + snmpwalk within the
DOCSIS forums, part of the
Tech Chat category; Currently I'm in a new project ( also new company ) and by that away from CMTS management or config, ...
-
Verified Member
- Rep Power
- 0
Cable Upstream SNR Viewer in Perl + snmpwalk
Currently I'm in a new project ( also new company ) and by that away from CMTS management or config, sometimes friends ask me to code a script or something
and something like this comes up.
Hope it will be usefull for more people. I like DOCSIS I just don't like noise !
#!/usr/bin/perl
#
# Get CMTS Status from upstream interfaces
#
# Copyright (C) 2008 Fernando André < netriver at gmail . com >
#
# This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation; Version 2 of the License
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# A copy online can be found at GNU General Public License v2.0 - GNU Project - Free Software Foundation (FSF)
#
sub SnrStatus {
$walker = '/usr/bin/snmpwalk ';
$totalOn = 0;
$totalOff = 0;
$totalAct = 0;
($cmts, $comunity, $style) = @_;
if ( $style eq 'cisco' ) {
$mibTerayonSNRUp = '1.3.6.1.2.1.10.127.1.1.4.1.5';
$mib = $mibTerayonSNRUp;
}elsif($style eq 'terayon'){
$mibCiscoSNRUp = 'SNMPv2-SMI::transmission.127.1.1.4.1.5';
$mib = $mibCiscoSNRUp;
}
@out = `$walker -v1 -c $comunity $cmts IF-MIB::ifDescr `;
foreach $i (@out) {
chomp($i);
( $v, $maters) = split(/\./, $i);
($id, $descr) = split(/=/, $maters) ;
$snrt = `$walker -v1 -c $comunity $cmts $mib.$id`;
($tmp, $upfreq) = split(/INTEGER: /, `$walker -v1 -c $comunity $cmts 1.3.6.1.2.1.10.127.1.1.2.1.2.$id` );
if ($upfreq ne ''){
($tmp, $channelwidth) = split(/INTEGER: /, `$walker -v1 -c $comunity $cmts 1.3.6.1.2.1.10.127.1.1.2.1.3.$id` );
($tmp, $modprofile ) = split(/Gauge32: /, `$walker -v1 -c $comunity $cmts 1.3.6.1.2.1.10.127.1.1.2.1.4.$id` );
($tmp, $online) = split(/INTEGER: /, `$walker -v1 -c $comunity $cmts 1.3.6.1.4.1.9.9.116.1.4.1.1.5.$id` );
($tmp, $total) = split(/INTEGER: /, `$walker -v1 -c $comunity $cmts 1.3.6.1.4.1.9.9.116.1.4.1.1.3.$id` );
$offline = $total - $online ;
chomp($channelwidth, $upfreq, $modprofile, $online, $total);
$descr =~ s/ +STRING://gi;
($tmp, $snr) = split(/INTEGER: /,$snrt);
$snr = ($snr/10);
print "CMTS:".$cmts." Descr: ".$descr." = ".($snr)." UPFREQ:".$upfreq." ChannelWidth:".$channelwidth." MODPROFILE: ".$modprofile." Modem Online: ".$online." Modem Offline: ".$offline." Total: ".$total."\n";
$totalOn = $online + $totalOn;
$totalOff = $offline + $totalOff;
$totalAct = $total + $totalAct;
}
}
if ($totalOn > 0 || $totalOff > 0 || $totalAct > 0 ) {
print "start Report Total do Cmts: $cmts \n";
print "Total Online: ".$totalOn."\n";
print "Total Offline: ".$totalOff."\n";
print "Total Active: ".$totalAct."\n";
print "end Report Total do Cmts: $cmts \n";
}
}
print " VXR \n";
SnrStatus('IP OF CMTS', 'COMMUNITY', 'cisco');
# Last parameter should be cisco usually in case of terayon CMTS I have found the second oid to work with terayon ctms
# The snr part works on bigband 12000 but the rest I did not test.
Similar Threads
-
By aximfrog in forum Cablevision
Replies: 0
Last Post: 12-09-2009, 09:04 PM
-
By dan1973 in forum Charter
Replies: 1
Last Post: 10-20-2009, 08:41 PM
Facebook Comments
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
Bookmarks