Home » Configs » MRTG Pri Voice line Cisco 6513 CatOS

MRTG Pri Voice line Cisco 6513 CatOS

mrtg

MRTG Pri Voice line Cisco 6513 CatOS

MRTG Pri Voice line Cisco 6513 CatOS

Requires Net::Telnet::Cisco

There is no snmp command to show the number of lines being used on PRIs on a 6513 CatOS. The CatOS command to see this is “show port voice active”

Since I am better at Shell scripts than PERL, I wrap my perl script in a shell script so I can awk the output and get the data I want. Feel free to email me a perl scrip that can do the awk for better efficiency, and I’ll post it here.

Script locations: /opt/Scripts/

Script 1 (the Perl script)

#!/usr/bin/perl

###############################
# cisco_config_backup.pl v2
# works with IOS, CatOS and ASA
###############################

use Net::Telnet::Cisco;
use Getopt::Std;

my $passwd     = 'pass';
my $en_passwd  = 'Enable-pass';
$ROUTER="192.168.99.122";

   my $cs = Net::Telnet::Cisco->new( Host => $ROUTER);

system("rm -rf /opt/Scripts/192.168.99.120");

#print " >> Logging in...                 ";
        #  $cs->cmd($username);
        $cs->cmd($passwd);
        $returnval = $cs->last_prompt;
        if ( $returnval =~ /Password:/ ) {
        $cs->close();
#        print "ERROR: Couldn't login to $ipaddress [$name]n***Error output***n". $cs->errmsg ."n***End of error output***n";
#                next;
        }

#        print "OKn >> Enabling...                   ";
        if (!$cs->enable($en_passwd)) {
        $cs->close();
#                print "ERROR: Couldn't enable on $ipaddress [$name]n***Error output***n". $cs->errmsg ."n***End of error output***n";
#                next;
        }

@cmd_output = $cs->cmd ('show port voice active');

  open(OUTPUTFILE,"> /tmp/$ROUTER");

            # now we are going to write the whole crap to a file
            print OUTPUTFILE @cmd_output;

      close(OUTPUTFILE);

Script 2 (the wrapper script)
This would be the script we run, that will run the perl script then parse the output for the data we want
Rename to voice-script.sh

#!/bin/sh

runScript="/opt/Scripts/voice-line.pl"

# run the perl script
#echo "running script"
$runScript

/bin/cat /tmp/192.168.99.120 | grep active | awk '{print $2}'
echo 0

MRTG cfg setup

#############################################################
# Voice Line usage
######

Title[192.168.99.120-pri]: Voice Line Usage
MaxBytes[192.168.99.120-pri]: 46
Options[192.168.99.120-pri]: gauge, nopercent, absolute, growright,noo
Target[192.168.99.120-pri]: `/opt/Scripts/voice-script.sh`
PageTop[192.168.99.120-pri]: Voice Line Usage on 2 PRI’s (46 Calls Max)
YLegend[192.168.99.120-pri]: Calls active
ShortLegend[192.168.99.120-pri]: calls
WithPeak[192.168.99.120-pri]: ymwd

#——————————————————————-

Note: We currently have 2 PRIs for voice, since each PRI gives us 23 voice lines (24-1 for control) that is 46 total. Feel free to modify this value to match your number of lines/PRIs

Was this helpful?
If you found my posts interesting, or I helped you figure something out, please consider tossing me a tiny gratuity for my time, research, to help offset the web hosting/development costs or to buy me a cup of coffee.

* This post may contain affiliate links. This means that I “might” receive a tiny amount of money, if you make a purchase using one of our links. It does not cost you anything extra, and helps us defray the costs of hosting and maintaining this site.

Leave a Reply