Hi all,
I have a script that hits all 4 cards on this 3Com dial-up box and counts how many users are active. The end result usually looks like this:
24
96
My question is, how can i transfer this script into Cacti and have it graph how many users are on throughout the day?
Here is my Perl Script: (any steps or info would be perfect)
#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 {
$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 {
$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 {
$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 {
$value1=($value1+1);
$value2=($value2+1);
}
else {
$value2=($value2+1);
}
}
if( $value1 eq ''){$value1 = 0 };
if( $value2 eq ''){$value2 = 0 };
print "$value1\n";
print "$value2\n";
--Thank You!!--
3Com Total Control -Modem Utilization- how many users are on
Moderators: Developers, Moderators
You need to assign each name to each value the script spits out. So output would look like this: if0:23 if1:56 if2:96 etc.
You can modify the script by doing something like this:
Take a read here for any more questions about scripts: http://www.cacti.net/downloads/docs/htm ... cacti.html
You can modify the script by doing something like this:
Code: Select all
print "val1:$value1 ";
print "val2:$value2";
| Scripts: Monitor processes | RFC1213 MIB | DOCSIS Stats | Dell PowerEdge | Speedfan | APC UPS | DOCSIS CMTS | 3ware | Motorola Canopy |
| Guides: Windows Install | [HOWTO] Debug Windows NTFS permission problems |
| Tools: Windows All-in-one Installer |
Who is online
Users browsing this forum: No registered users and 2 guests