Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Thu May 23, 2019 4:17 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 43 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
 Post subject:
PostPosted: Tue May 30, 2006 11:41 am 
Offline
Developer
User avatar

Joined: Thu Dec 02, 2004 2:46 am
Posts: 22376
Location: Muenster, Germany
Well, it's CISCOs task to provide same data via cli AND SNMP. If they do not provide an OID that represents that data, sigh :cry:
And the "cacti" OIDs are those that stem from the RFC standard MIBs.
But it should be possible to get those wanted data via some telnet script. I suppose, some of those should be found on the forum as a start. And of course, there are surely others that would appreciate if your work would be published.
Last, pay attention to rrdtool's features when getting updates not at exact 300 sec boundaries. This was discussed LOADS of time in the rrdtool-users mailing list as well as in the cacti forum. The rrdtool site contains more examples for this ...
Reinhard

_________________
Official Cacti Documentation
Official Debugging Help
Central Plugin Repository
Central Templates Repository


Top
 Profile  
 
 Post subject: removed due to bugs - will post again when it is fixed..
PostPosted: Thu Jun 08, 2006 11:53 am 
Offline
Cacti User

Joined: Thu Mar 24, 2005 3:53 pm
Posts: 382
Location: Ocoee, Florida
Removed.


Top
 Profile  
 
 Post subject: Ok try this!
PostPosted: Tue Jun 13, 2006 3:49 pm 
Offline
Cacti User

Joined: Thu Mar 24, 2005 3:53 pm
Posts: 382
Location: Ocoee, Florida
Here is a much better set of scripts and templates for collecting Cisco interface errors via a Perl Net::Telnet script.

This script was written because after going around and around with the Cisco TAC, I arrived at the conclusion that I could not get all the (exact) information found on the command line (when you do a show interface) in the MIBs. I asked Cisco and they confirmed this.

My manager wanted to be alerted every time a 'frame circuit' took errors (we have like 80+ remote sites on frame) - So, I wrote this script to collect the data, and created a 'thold' template to alert me via email. It seems to be working fine so far.

It should work on most cisco IOS based gear. It basically telnets to the device, does a show interface {interface} and parses the output for the 5 things I am collecting: input_errors; crc_errors; frame_errors; overrun_errors; ignored_errors.

This is a script query, which is nice because it uses cacti's cool templating system.

The first version I put up would only handle one interface per device, but this one will handle many. I also corrected a lot of bugs that increased performance and should have eliminated the errors in the cacti error log. I also removed the need for all the Perl modules, besides one: Net::Telnet. I took much of the online help out, but if you run the script with no options from the command line, you will get usage directions.

To install:

1.) Make sure you have Perl and the Net::Telnet module.
2.) Put the script in your <path to cacti>/scripts directory and edit the $path_to_cacti variable to be where your cacti install lives.
3.) Put the cisco_IntErr.xml file in your <path to cacti>/resources/script_queries directory and edit your telnet user name and password. Also change the path to Perl to be where you Perl lives. Sorry, but still no tables in cacti for user names and passwords for Telnet. Therefor you will have to have a unified user and pass for all the devices you want to colllect statistics on. Also, if you have a different prompt (other than what is expected '#') change it in the Open_Telnet subroutine in the script - or change it on your device to be '#'.
4.) Make sure both above files are read/executable by the user whom would be running them (cactiuser/www/etc..).
5.) Import the templates that are included (if they don't work, sorry, I tried).
6.) create directory called script_logs, that is read/write/executable to the user running the scripts, in the <path to cacti>/scripts directory. This is for all the filles that will be created in order for the script to get the 'delta' values for each error it collects on.
7.) Go create graphs!

Hope this works out for someone else. If nothing else, it was a good practice in creating script queries in cacti!

This script was written and tested in UNIX, so if it works in Windows, great! If not, then I don't know what to tell you - I have no Windows box to try it on.

If you have trouble feel free to post back and I will try to help, but no guaranties.. Also, feel free to take the code and do whatever you want with it, just don't blame me for breaking stuff ;-). Have fun.


Attachments:
cisco_IntErr.zip [11.31 KiB]
Downloaded 4574 times
Top
 Profile  
 
 Post subject: Updated Templates
PostPosted: Wed Jun 14, 2006 10:34 am 
Offline
Cacti User

Joined: Thu Mar 24, 2005 3:53 pm
Posts: 382
Location: Ocoee, Florida
Here is a new Data Template and a new Data Query. The data template was set for 'counter' and should have been 'gauge' to get desired output. I added the correct lables for the Data Query.


Attachments:
cacti_data_template_cisco_interface_errors_telnet.zip [5 KiB]
Downloaded 3470 times
Top
 Profile  
 
 Post subject: HELP!!!
PostPosted: Fri Jun 30, 2006 1:22 pm 
Offline

Joined: Tue Jun 20, 2006 12:49 pm
Posts: 30
I'm having problems with this script on one of our Cisco 6506 switches. When the script is running the "sh int sum" command, all of the configured interfaces aren't listed in the output. Thus we're not being able to collect error stats on many of the interfaces.

The SNMP interface query does find them all so we can graph interface usage stats. Can anyone help????


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 30, 2006 3:24 pm 
Offline

Joined: Tue Jun 20, 2006 12:49 pm
Posts: 30
I believe I found out what the problem is. There seems to be a bug with this command running IOS 12.2 (18) SXD7. I've run this successfully on IOS 12.1 (19) E1a

DAMN!!!!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 03, 2006 7:44 am 
Offline
Cacti User

Joined: Thu Mar 24, 2005 3:53 pm
Posts: 382
Location: Ocoee, Florida
Thanks. I no longer work where I did when I wrote that, so I was having trouble figuring out a way to test/fix the problem... ;-). Glad it's working for you!


Top
 Profile  
 
 Post subject: how to graph this
PostPosted: Tue Jun 19, 2007 2:42 am 
Offline
Cacti User

Joined: Fri Aug 22, 2003 4:33 am
Posts: 83
how can we graph this.... It just prints all zeros.... I have the logs in scrip_logs and they have some counters.... but nothing on graphs

Chetan


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 02, 2008 9:02 am 
Offline

Joined: Wed Nov 01, 2006 6:10 am
Posts: 42
I would really like to be able to graph CRC errors from my Cisco routers, but I am having difficulty setting this up. I have imported the xml files and

edited the scripts, but when I go to create graphs I get:

Data Query [Cisco Interface Errors (Telnet)]

This data query returned 0 rows, perhaps there was a problem executing this data query. You can run this data query in d ebug m ode to get more

information.


In this mode, I get:

Data Query Debug Information

+ Running data query [13].
+ Found type = '4 '[script query].
+ Found data query XML file at '/var/www/cacti/resource/script_queries/cisco_IntErr.xml'
+ XML file parsed ok.
+ Executing script for list of indexes '/usr/bin/perl /var/www/cacti/scripts/cisco_IntErr.pl |test| test test index'
+ Executing script query '/usr/bin/perl /var/www/cacti/scripts/cisco_IntErr.pl |test| test test query index'
+ Executing script query '/usr/bin/perl /var/www/cacti/scripts/cisco_IntErr.pl |test| test test query index'
+ Found data query XML file at '/var/www/cacti/resource/script_queries/cisco_IntErr.xml'
+ Found data query XML file at '/var/www/cacti/resource/script_queries/cisco_IntErr.xml'
+ Found data query XML file at '/var/www/cacti/resource/script_queries/cisco_IntErr.xml'


I have tested the Net::Telnet from the server (test is in my hosts file and I have used test for both the username and thepassword):


server:/var/www/cacti/scripts# /usr/bin/perl cisco_IntErr.pl test test test
usage:
./cisco_IntErr.pl IP USERNAME PASSWORD index
./cisco_IntErr.pl IP USERNAME PASSWORD query
./cisco_IntErr.pl IP USERNAME PASSWORD get {input_errors|crc_errors|frame_errors|overrun_errors|ignored_errors} INTERFACE

Permissions have been set to 777 for the all directories including and below /cacti

I am using cacti 0.8.7a on Debian etch.

Any assistance would be much appreciated.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 02, 2008 9:32 am 
Offline

Joined: Wed Nov 01, 2006 6:10 am
Posts: 42
I have just installed hostinfo in case it helps:

Quote:
Cacti Version - 0.8.7a
Plugin Architecture - 1.4
Poller Type - CMD.php
Server Info - Linux 2.6.23-1-686
Web Server - Apache/2.2.3 (Debian) PHP/5.2.0-8+etch10 mod_ssl/2.2.3 OpenSSL/0.9.8c
PHP - 5.2.0-8+etch10
PHP Extensions - zip, xmlwriter, libxml, dom, xmlreader, xml, wddx, tokenizer, sysvshm, sysvsem, sysvmsg, session, SimpleXML, sockets, soap, SPL, shmop, standard, Reflection, posix, mime_magic, mbstring, json, iconv, hash, gettext, ftp, filter, exif, dba, date, ctype, calendar, bz2, bcmath, zlib, pcre, openssl, apache2handler, gd, memcache, curl, imap, mcrypt, mhash, ming, mysql, mysqli, PDO, pdo_mysql, pdo_sqlite, ps, pspell, recode, snmp, SQLite, tidy, xmlrpc, xsl
MySQL - 5.0.32-Debian_7etch5-log
RRDTool - 1.2.15
SNMP - 5.2.3
Plugins
    Global Plugin Settings (settings - v0.3)
    Host Info (hostinfo - v0.2)
    Update Checker (update - v0.4)
    PHP Network Weathermap (weathermap - v0.95b)
    Thresholds (thold - v0.3.9)


Top
 Profile  
 
 Post subject: using snmp for interface errors
PostPosted: Sun Feb 22, 2009 3:11 am 
Offline

Joined: Fri Feb 20, 2009 1:32 pm
Posts: 17
Hi,
I have done some investigations regarding CRC collecting through snmp.
It seems that the OLD_CISCO_INTERFACES_MIB has oid for all kinds of errors including CRC, COLLISIONS etc... I will try testing this soon and let you know if I have been successful.
here is a link to the mib:

http://tools.cisco.com/Support/SNMP/do/BrowseMIB.do?local=en&step=2&mibName=OLD-CISCO-INTERFACES-MIB

br
Olivier[/url]


Top
 Profile  
 
 Post subject: Cisco interface errors
PostPosted: Tue Feb 24, 2009 2:12 am 
Offline

Joined: Fri Feb 20, 2009 1:32 pm
Posts: 17
Hi,
attached is a modified interface errors/discards xml and the corresponding interface.xml to monitor additional interface errors on cisco's.
added
Runts, frames, overuns, crc's, discards etc..;

!!!! BE CAREFULL, IT WILL OVERWRITE THE ORIGINAL FILES SO TAKE A BACKUP!!!!!!

Enjoy,
br
Olivier


Attachments:
File comment: copy into snmp_queries after making a backup of the original file.
interface.xml [5.47 KiB]
Downloaded 2776 times
File comment: Import after making a backup of the extisting template
cacti_graph_template_interface_-_errorsdiscards.xml [43.88 KiB]
Downloaded 2748 times
Top
 Profile  
 
 Post subject: Same error
PostPosted: Tue Apr 14, 2009 9:14 am 
Offline

Joined: Thu Oct 23, 2008 10:05 am
Posts: 4
Location: Hyderabad (india)
Hi Team

I am also getting the same error
Data Query Debug Information

+ Running data query [13].
+ Found type = '4 '[script query].
+ Found data query XML file at '/var/www/cacti/resource/script_queries/cisco_IntErr.xml'
+ XML file parsed ok.
+ Executing script for list of indexes '/usr/bin/perl /var/www/cacti/scripts/cisco_IntErr.pl |test| test test index'
+ Executing script query '/usr/bin/perl /var/www/cacti/scripts/cisco_IntErr.pl |test| test test query index'
+ Executing script query '/usr/bin/perl /var/www/cacti/scripts/cisco_IntErr.pl |test| test test query index'
+ Found data query XML file at '/var/www/cacti/resource/script_queries/cisco_IntErr.xml'
+ Found data query XML file at '/var/www/cacti/resource/script_queries/cisco_IntErr.xml'
+ Found data query XML file at '/var/www/cacti/resource/script_queries/cisco_IntErr.xml'


I have tested the Net::Telnet from the server (test is in my hosts file and I have used test for both the username and thepassword):


server:/var/www/cacti/scripts# /usr/bin/perl cisco_IntErr.pl test test test
usage:
./cisco_IntErr.pl IP USERNAME PASSWORD index
./cisco_IntErr.pl IP USERNAME PASSWORD query
./cisco_IntErr.pl IP USERNAME PASSWORD get {input_errors|crc_errors|frame_errors|overrun_errors|ignored_errors} INTERFACE

Permissions have been set to 777 for the all directories including and below /cacti

I am using cacti 0.8.7c on Cent OS -5

Please help.


Top
 Profile  
 
 Post subject: cisco interface errors
PostPosted: Mon Jul 13, 2009 10:04 am 
Offline

Joined: Wed Nov 01, 2006 6:10 am
Posts: 42
Regarding the Net::Telnet option, I have found some time to investigate this further and I have made some headway.
I tried the SNMP version, but there seemed no way of actually adding the graphs.

I am using Debian, so to get the Net::Telent installed I did:

apt-get install libnet-telnet-cisco-perl

I created a simple perl script to test that this is working:

#!/usr/bin/perl

use Net::Telnet::Cisco;

my $host = 'test'
my $login = 'test';
my $password = 'test';


$session = Net::Telnet::Cisco->new(Host => $host);
$session->login($login,$password);
my @output = $session->cmd("sh int s0/0/0");
$session->close();

print @output;


And I get:

Serial0/0/0 is up, line protocol is up
!
! <output removed>
!
37 input errors, 37 CRC, 9 frame, 2 overrun, 0 ignored, 22 abort
53055953 packets output, 1110672772 bytes, 0 underruns
0 output errors, 0 collisions, 0 interface resets
0 output buffer failures, 0 output buffers swapped out
0 carrier transitions
DCD=up DSR=up DTR=up RTS=up CTS=up


I am not sure that the permissions on the files created in the .../scripts/script_logs directory are correct (644), so I made the directory sticky by doing chmod 7777-R ./scripts/script_logs/


Top
 Profile  
 
 Post subject: cisco interface errors
PostPosted: Tue Jul 14, 2009 5:53 am 
Offline

Joined: Wed Nov 01, 2006 6:10 am
Posts: 42
this doesn't work:
"so I made the directory sticky by doing chmod 7777-R ./scripts/script_logs/" ,
so I am doing a chmod 777 ./* on the files each time I add a new device.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 43 posts ]  Go to page Previous  1, 2, 3  Next

All times are UTC - 5 hours


Who is online

Users browsing this forum: Bing [Bot], Google Adsense [Bot] and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group