Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


Cisco ADSL info
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates
Author Message
mgb
Cacti User


Joined: 21 Jun 2004
Posts: 102
Location: North of the Netherlands

PostPosted: Mon Jul 31, 2006 4:16 am    Post subject: Cisco ADSL info Reply with quote

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



cacti_graph_template_cisco_adsl_info.xml
 Description:
Graph Template for monitoring cisco ADSL parameters.

Download
 Filename:  cacti_graph_template_cisco_adsl_info.xml
 Filesize:  26.27 KB
 Downloaded:  1308 Time(s)

Back to top
redcap



Joined: 23 Jan 2006
Posts: 18

PostPosted: Sat Sep 30, 2006 4:13 pm    Post subject: Reply with quote

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

PostPosted: Sat Dec 23, 2006 10:11 pm    Post subject: Reply with quote

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: 102
Location: North of the Netherlands

PostPosted: Tue Jan 02, 2007 2:59 am    Post subject: Reply with quote

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

PostPosted: Fri Mar 16, 2007 5:01 pm    Post subject: Reply with quote

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: 102
Location: North of the Netherlands

PostPosted: Mon Mar 19, 2007 7:35 am    Post subject: Reply with quote

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

PostPosted: Mon Mar 19, 2007 8:27 pm    Post subject: Reply with quote

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

PostPosted: Fri Jun 29, 2007 3:43 am    Post subject: updated for SNMP v3? Reply with quote

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: 102
Location: North of the Netherlands

PostPosted: Mon Jul 02, 2007 3:44 am    Post subject: Reply with quote

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

PostPosted: Thu Jul 05, 2007 5:08 am    Post subject: Reply with quote

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: 102
Location: North of the Netherlands

PostPosted: Fri Jul 06, 2007 3:16 am    Post subject: Reply with quote

@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

PostPosted: Fri Mar 14, 2008 4:11 pm    Post subject: ADSL info Reply with quote

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: 12206
Location: Muenster, Germany

PostPosted: Sun Mar 16, 2008 10:35 am    Post subject: Reply with quote

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!



ADSL-1.png
 Description:
Screenshot 1
 Filesize:  40.5 KB
 Viewed:  5293 Time(s)

ADSL-1.png



ADSL-2.png
 Description:
Screenshot 2
 Filesize:  20.59 KB
 Viewed:  5293 Time(s)

ADSL-2.png



adslLine.xml
 Description:
The Data Query XML file
Copy to ./resource/snmp_queries

Download
 Filename:  adslLine.xml
 Filesize:  2.63 KB
 Downloaded:  335 Time(s)


cacti087b_data_query_adsl_line_mib.xml
 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:  342 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: 125
Location: Australia

PostPosted: Sun Mar 23, 2008 7:50 pm    Post subject: Reply with quote

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.



cacti.asdl.png
 Description:
 Filesize:  65.39 KB
 Viewed:  5067 Time(s)

cacti.asdl.png


Back to top
mgb
Cacti User


Joined: 21 Jun 2004
Posts: 102
Location: North of the Netherlands

PostPosted: Mon Mar 24, 2008 3:28 pm    Post subject: Reply with quote

@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
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates All times are GMT - 5 Hours
Goto page 1, 2  Next
Page 1 of 2

 



Powered by phpBB © 2001, 2005 phpBB Group