Can not get this script to graph my output. Help?

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

Post Reply
FIacusso
Posts: 25
Joined: Fri Jun 17, 2005 11:33 am

Can not get this script to graph my output. Help?

Post by FIacusso »

Hello All,

I have this perl script that hits the 4 modem cards in a 3Com Total Control Modem Box. What it does is, counts the active modem users and displays that result with the total number of modems next to it.

I've been trying everything with cacti, from templates to my own to get some sort of output... Here is the code, any ideas or direction?

#Perl SCript - 3Com Test Run

#!c:\Perl\Bin

# perltest.pl
#
# Usage perltest.pl community@IP@slot#
# Example perltest.pl public@172.xx.xx.x

# Modems in use (value1)
# 3Com card capacity (value2)
# Assumes 23 channels are available

# Points to lib installed with MRTG. Modify as needed

use lib "c:\\perl\\lib";

use BER;
use SNMP_util;
use SNMP_Session;

my $community = "public";
my $router = "172.xx.xx.x";


#my($community,$router,$slot) = split /\@/, $ARGV[0];

foreach ($i = 1001;$i <= 1024; $i++) {
$mib1 = "enterprises.429.1.6.9.1.1.2.";
$mib2 = "100";
$mib = $mib1.$i;

($value) = snmpget("$community\@$router","$mib");
print "Query interface $mib = $value\n";
if ($value eq 8) {
$value1=($value1+1);
$value2=($value2+1);
}
else {
$value2=($value2+1);
}
}


foreach ($i = 2001;$i <= 2024; $i++) {
$mib1 = "enterprises.429.1.6.9.1.1.2.";
$mib2 = "200";
$mib = $mib1.$i;

($value) = snmpget("$community\@$router","$mib");
print "Query interface $mib = $value\n";
if ($value eq 8) {
$value1=($value1+1);
$value2=($value2+1);
}
else {
$value2=($value2+1);
}
}

foreach ($i = 3001;$i <= 3024; $i++) {
$mib1 = "enterprises.429.1.6.9.1.1.2.";
$mib2 = "300";
$mib = $mib1.$i;

($value) = snmpget("$community\@$router","$mib");
print "Query interface $mib = $value\n";
if ($value eq 8) {
$value1=($value1+1);
$value2=($value2+1);
}
else {
$value2=($value2+1);
}
}

foreach ($i = 4001;$i <= 4024; $i++) {
$mib1 = "enterprises.429.1.6.9.1.1.2.";
$mib2 = "400";
$mib = $mib1.$i;

($value) = snmpget("$community\@$router","$mib");
print "Query interface $mib = $value\n";
if ($value eq 8) {
$value1=($value1+1);
$value2=($value2+1);
}
else {
$value2=($value2+1);
}
}


if( $value1 eq ''){$value1 = 0 };
if( $value2 eq ''){$value2 = 0 };

print "Active_Modems:$value1\n";
print "Modem_Count:$value2\n";

Thank you!!
metos
Posts: 16
Joined: Fri Mar 11, 2005 9:46 am

use the search box....

Post by metos »

you'd like to graph your perl script ?

........ http://forums.cacti.net/viewtopic.php?t=7033


Metos
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest