|
|
| Author |
Message |
mgb Cacti User
Joined: 21 Jun 2004 Posts: 98 Location: North of the Netherlands
|
Posted: Mon Jul 31, 2006 4:16 am Post subject: Cisco ADSL info |
|
|
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: |
<?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
| Description: |
| Graph Template for monitoring cisco ADSL parameters. |
|
 Download |
| Filename: |
cacti_graph_template_cisco_adsl_info.xml |
| Filesize: |
26.27 KB |
| Downloaded: |
1149 Time(s) |
|
|
| Back to top |
|
 |
redcap
Joined: 23 Jan 2006 Posts: 18
|
Posted: Sat Sep 30, 2006 4:13 pm Post subject: |
|
|
Although snmpwalk returns valid results, the graphs stay flat.
Anyone has this template working?
Thanks,
Redcap
|
|
| Back to top |
|
 |
geniesis
Joined: 23 Dec 2006 Posts: 1
|
Posted: Sat Dec 23, 2006 10:11 pm Post subject: |
|
|
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: |
<?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;
?>
|
|
|
| Back to top |
|
 |
mgb Cacti User
Joined: 21 Jun 2004 Posts: 98 Location: North of the Netherlands
|
Posted: Tue Jan 02, 2007 2:59 am Post subject: |
|
|
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
|
|
| Back to top |
|
 |
nexex
Joined: 16 Mar 2007 Posts: 2
|
Posted: Fri Mar 16, 2007 5:01 pm Post subject: |
|
|
What version of cacti did you use to make the xml file? I am getting the error:
| Code: |
Error: XML: Hash version does not exist.
|
I'm using version 0.8.6c
Thanks
|
|
| Back to top |
|
 |
mgb Cacti User
Joined: 21 Jun 2004 Posts: 98 Location: North of the Netherlands
|
Posted: Mon Mar 19, 2007 7:35 am Post subject: |
|
|
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
|
|
| Back to top |
|
 |
nexex
Joined: 16 Mar 2007 Posts: 2
|
Posted: Mon Mar 19, 2007 8:27 pm Post subject: |
|
|
Well, upgrade went a lot smoother than the instructions had me thinking it would
Script works great, thanks.
|
|
| Back to top |
|
 |
jasonatcacti
Joined: 29 Jun 2007 Posts: 2
|
Posted: Fri Jun 29, 2007 3:43 am Post subject: updated for SNMP v3? |
|
|
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
|
|
| Back to top |
|
 |
mgb Cacti User
Joined: 21 Jun 2004 Posts: 98 Location: North of the Netherlands
|
Posted: Mon Jul 02, 2007 3:44 am Post subject: |
|
|
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.
|
|
| Back to top |
|
 |
bbosch
Joined: 29 Jun 2007 Posts: 2 Location: Port Elizabeth, South Africa
|
Posted: Thu Jul 05, 2007 5:08 am Post subject: |
|
|
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.
|
|
| Back to top |
|
 |
mgb Cacti User
Joined: 21 Jun 2004 Posts: 98 Location: North of the Netherlands
|
Posted: Fri Jul 06, 2007 3:16 am Post subject: |
|
|
@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
|
|
| Back to top |
|
 |
edgecase
Joined: 14 Mar 2008 Posts: 1 Location: Toronto, Canada
|
Posted: Fri Mar 14, 2008 4:11 pm Post subject: ADSL info |
|
|
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]
|
|
| Back to top |
|
 |
gandalf Developer
Joined: 02 Dec 2004 Posts: 11082 Location: Muenster, Germany
|
Posted: Sun Mar 16, 2008 10:35 am Post subject: |
|
|
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!
| Description: |
|
| Filesize: |
40.5 KB |
| Viewed: |
3317 Time(s) |

|
| Description: |
|
| Filesize: |
20.59 KB |
| Viewed: |
3317 Time(s) |

|
| Description: |
The Data Query XML file Copy to ./resource/snmp_queries |
|
 Download |
| Filename: |
adslLine.xml |
| Filesize: |
2.63 KB |
| Downloaded: |
188 Time(s) |
| Description: |
UPDATED! The Data Query XML for importing into cacti. No more resources required |
|
 Download |
| Filename: |
cacti087b_data_query_adsl_line_mib.xml |
| Filesize: |
42.89 KB |
| Downloaded: |
208 Time(s) |
Last edited by gandalf on Tue Mar 25, 2008 3:42 am; edited 2 times in total |
|
| Back to top |
|
 |
niobe Cacti User
Joined: 10 Mar 2008 Posts: 90 Location: Australia
|
Posted: Sun Mar 23, 2008 7:50 pm Post subject: |
|
|
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.
| Description: |
|
| Filesize: |
65.39 KB |
| Viewed: |
3091 Time(s) |

|
|
|
| Back to top |
|
 |
mgb Cacti User
Joined: 21 Jun 2004 Posts: 98 Location: North of the Netherlands
|
Posted: Mon Mar 24, 2008 3:28 pm Post subject: |
|
|
@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
|
|
| Back to top |
|
 |
|