Cisco ADSL info

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

Moderators: Developers, Moderators

mgb
Cacti User
Posts: 124
Joined: Mon Jun 21, 2004 4:06 am
Location: North of the Netherlands

Cisco ADSL info

Post by mgb »

Graph Template for graphing adsl info on a Cisco 836/837 router. Might be that is works for other Cisco routers also.

Consists of an XML file and a little php scripting.

Put the php script in the <cacti dir>/scripts/ directory.
The source for the script is:

Code: Select all

<?php
#!/usr/bin/php -q
$no_http_headers = true;

error_reporting(E_ERROR);

$IP = $_SERVER["argv"][1];
$Community = $_SERVER["argv"][2];

$a[1] = snmpwalk($IP,$Community,"ifTable.ifEntry.ifIndex");
$a[2] = snmpwalk($IP,$Community,"ifTable.ifEntry.ifType");

for ($i=0; $i < count($a[1]); $i++)
{
  if (strpos($a[2][$i],"adsl"))
    $index = ltrim(substr($a[1][$i],8,3));
}
$LA = substr(snmpget($IP,$Community,"1.3.6.1.2.1.10.94.1.1.3.1.5.$index"),9,3);
$RA = substr(snmpget($IP,$Community,"1.3.6.1.2.1.10.94.1.1.2.1.5.$index"),9,3);
$LP = substr(snmpget($IP,$Community,"1.3.6.1.2.1.10.94.1.1.3.1.7.$index"),9,3);
$RP = substr(snmpget($IP,$Community,"1.3.6.1.2.1.10.94.1.1.2.1.7.$index"),9,3);
$LS = substr(snmpget($IP,$Community,"1.3.6.1.2.1.10.94.1.1.3.1.4.$index"),9,3);
$RS = substr(snmpget($IP,$Community,"1.3.6.1.2.1.10.94.1.1.2.1.4.$index"),9,3);
print "RA:" . $RA . " LA:" . $LA . " ";
print "LO:" . $LP . " RO:" . $RP . " ";
print "LS:" . $LS . " RS:" . $RS . "\n";
?>
name the file cisco_adsl.php

this should work in combination with the XML file.
might be that the absolute paths in the Data Imput Methods are wrong

The parameters that are monitored are:

Local and Remote SNR.
Local and Remote Output Power
Local and Remote Attenuation
Attachments
cacti_graph_template_cisco_adsl_info.xml
Graph Template for monitoring cisco ADSL parameters.
(26.27 KiB) Downloaded 3115 times
redcap
Posts: 18
Joined: Mon Jan 23, 2006 5:49 am

Post by redcap »

Although snmpwalk returns valid results, the graphs stay flat.
Anyone has this template working?

Thanks,
Redcap
geniesis
Posts: 1
Joined: Sat Dec 23, 2006 10:08 pm

Post by geniesis »

I found the problem to be how the php script was made. It seems that the poller can't grab the output of the adsl script if the script uses multiple print commands.

Hence the slightly modified version.

Code: Select all

<?php
#!/usr/bin/php -q
$no_http_headers = true;

error_reporting(E_ERROR);

$IP = $_SERVER["argv"][1];
$Community = $_SERVER["argv"][2];

$a[1] = snmpwalk($IP,$Community,"ifTable.ifEntry.ifIndex");
$a[2] = snmpwalk($IP,$Community,"ifTable.ifEntry.ifType");

for ($i=0; $i < count($a[1]); $i++)
{
  if (strpos($a[2][$i],"adsl"))
    $index = ltrim(substr($a[1][$i],8,3));
}
$LA = substr(snmpget($IP,$Community,"1.3.6.1.2.1.10.94.1.1.3.1.5.$index"),9,3);
$RA = substr(snmpget($IP,$Community,"1.3.6.1.2.1.10.94.1.1.2.1.5.$index"),9,3);
$LP = substr(snmpget($IP,$Community,"1.3.6.1.2.1.10.94.1.1.3.1.7.$index"),9,3);
$RP = substr(snmpget($IP,$Community,"1.3.6.1.2.1.10.94.1.1.2.1.7.$index"),9,3);
$LS = substr(snmpget($IP,$Community,"1.3.6.1.2.1.10.94.1.1.3.1.4.$index"),9,3);
$RS = substr(snmpget($IP,$Community,"1.3.6.1.2.1.10.94.1.1.2.1.4.$index"),9,3);
print "RA:" . $RA . " LA:" . $LA . " LO:" . $LP . " RO:" . $RP . " LS:" . $LS . " RS:" . $RS;
?>
mgb
Cacti User
Posts: 124
Joined: Mon Jun 21, 2004 4:06 am
Location: North of the Netherlands

Post by mgb »

Although the old script works for me, thanx for adjusting the script. Might be that the script behaves differently on Windows machines.

Hope the script is usefull. I know we use it a lot.

Michael
nexex
Posts: 2
Joined: Fri Mar 16, 2007 4:59 pm

Post by nexex »

What version of cacti did you use to make the xml file? I am getting the error:

Code: Select all

Error: XML: Hash version does not exist.
I'm using version 0.8.6c

Thanks
mgb
Cacti User
Posts: 124
Joined: Mon Jun 21, 2004 4:06 am
Location: North of the Netherlands

Post by mgb »

I think I used version 0.8.6f to create it. I think you best upgrade to the latest version since there have been a lot of issues resolved since that cacti version you've got running.

Michael
nexex
Posts: 2
Joined: Fri Mar 16, 2007 4:59 pm

Post by nexex »

Well, upgrade went a lot smoother than the instructions had me thinking it would :)

Script works great, thanks.
jasonatcacti
Posts: 2
Joined: Fri Jun 29, 2007 3:38 am

updated for SNMP v3?

Post by jasonatcacti »

Has anyone updated this to work with SNMP v3?
I've tried but my limited php scripting is failing me at the moment.

Running Cacti from debian packages 0.8.6j-1
mgb
Cacti User
Posts: 124
Joined: Mon Jun 21, 2004 4:06 am
Location: North of the Netherlands

Post by mgb »

Hello,

I'm afraid php is not currently supporting v3. At least I couldn't find anything in the php documentation.

I Gues the script has to be rewritten to use shell commands.
bbosch
Posts: 2
Joined: Fri Jun 29, 2007 8:21 am
Location: Port Elizabeth, South Africa

Post by bbosch »

I tried this script on a 877 router. It doesn't get the Ifindex on the ADSL interface for some reason. My workaraound was to manually set the $index value in the script. Also, it PHP seemed to query the wrong MIB when 1.3.6.1.2.1.10. was specified in the OID. I replaced 1.3.6.1.2.1.10 with SNMPv2-SMI::transmission to get it working.

My PHP skills are too poor to modify it properly and post a proper 877 version.
mgb
Cacti User
Posts: 124
Joined: Mon Jun 21, 2004 4:06 am
Location: North of the Netherlands

Post by mgb »

@bbosch

We have several 877 routers working with the old script. It might be that there is an OID change for different IOS versions. I use the OID instead of the mib beause on some systems the mib doesn't get translated.
If i have time i will look into the script to make it more robust.

Glad you got it working though.

Michael
edgecase
Posts: 1
Joined: Fri Mar 14, 2008 4:02 pm
Location: Toronto, Canada

ADSL info

Post by edgecase »

The 4th graph item has no CDEF, it causes Cacti 0.8.6j-1.1ubuntu0.1 to choke:

partial error in graph debug output:

GPRINT::MAX:" Maximum\:%8.2lf %s\n" \

In the XML file in the previous post, 4th item has:

<cdef_id>0</cdef_id>

I'm new to Cacti so i'll defer a fix to someone more knowledgeable.[/code]
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Just wanting to add my 2 cents to this quite old thread.
Based on the OIDs used in the script, I decided to implement a pure SNMP version to make it as fast as possible (currently maintaining about 200 adsl devices, plans include growing to 3500).
So please find an XML export of my SNMP Data Query attached.
It requires cacti087b at least
Find some few pics attached as well
Reinhard

Just updated the Templates! Please delete old stuff and redo! Data Templates were changed to reduce size to a THIRD!
Attachments
adslLine.xml
The Data Query XML file
Copy to ./resource/snmp_queries
(2.63 KiB) Downloaded 1651 times
cacti087b_data_query_adsl_line_mib.xml
UPDATED!
The Data Query XML for importing into cacti. No more resources required
(42.89 KiB) Downloaded 1810 times
Screenshot 2
Screenshot 2
ADSL-2.png (20.59 KiB) Viewed 35455 times
Screenshot 1
Screenshot 1
ADSL-1.png (40.5 KiB) Viewed 35455 times
Last edited by gandalf on Tue Mar 25, 2008 3:42 am, edited 2 times in total.
niobe
Cacti User
Posts: 228
Joined: Mon Mar 10, 2008 6:52 pm
Location: Australia

Post by niobe »

Hi Gandalf,.

I got a few errors trying to import this (Cacti 0.87b)

Not yet familiar with these templates but it looks like the data query file is missing:

<path_cacti>/resource/snmp_queries/adslLine.xml

Should this be automatically created when importing?

cheers.
Attachments
cacti.asdl.png
cacti.asdl.png (65.39 KiB) Viewed 35229 times
mgb
Cacti User
Posts: 124
Joined: Mon Jun 21, 2004 4:06 am
Location: North of the Netherlands

Post by mgb »

@Gandalf,

Yup, missing the xml file also. Was curieus about how you solved my little program in pure SNMP. Was that already possible or did you need the new featues of 0.8.7b?

Michael
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest