Interface errors scripts and templates

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

Moderators: Moderators, Developers

Author
Message
User avatar
gandalf
Developer
Posts: 22375
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

#16 Post by gandalf » Tue May 30, 2006 11:41 am

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

chadd
Cacti User
Posts: 382
Joined: Thu Mar 24, 2005 3:53 pm
Location: Ocoee, Florida

removed due to bugs - will post again when it is fixed..

#17 Post by chadd » Thu Jun 08, 2006 11:53 am

Removed.

chadd
Cacti User
Posts: 382
Joined: Thu Mar 24, 2005 3:53 pm
Location: Ocoee, Florida

Ok try this!

#18 Post by chadd » Tue Jun 13, 2006 3:49 pm

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 5291 times

chadd
Cacti User
Posts: 382
Joined: Thu Mar 24, 2005 3:53 pm
Location: Ocoee, Florida

Updated Templates

#19 Post by chadd » Wed Jun 14, 2006 10:34 am

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 4122 times

bidzer
Posts: 30
Joined: Tue Jun 20, 2006 12:49 pm

HELP!!!

#20 Post by bidzer » Fri Jun 30, 2006 1:22 pm

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????

bidzer
Posts: 30
Joined: Tue Jun 20, 2006 12:49 pm

#21 Post by bidzer » Fri Jun 30, 2006 3:24 pm

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!!!!

chadd
Cacti User
Posts: 382
Joined: Thu Mar 24, 2005 3:53 pm
Location: Ocoee, Florida

#22 Post by chadd » Mon Jul 03, 2006 7:44 am

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!

r_chetanjain
Cacti User
Posts: 83
Joined: Fri Aug 22, 2003 4:33 am

how to graph this

#23 Post by r_chetanjain » Tue Jun 19, 2007 2:42 am

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

iharvey
Posts: 42
Joined: Wed Nov 01, 2006 6:10 am

#24 Post by iharvey » Wed Apr 02, 2008 9:02 am

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.

iharvey
Posts: 42
Joined: Wed Nov 01, 2006 6:10 am

#25 Post by iharvey » Wed Apr 02, 2008 9:32 am

I have just installed hostinfo in case it helps:
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)

iso1779
Posts: 17
Joined: Fri Feb 20, 2009 1:32 pm

using snmp for interface errors

#26 Post by iso1779 » Sun Feb 22, 2009 3:11 am

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/ ... RFACES-MIB

br
Olivier[/url]

iso1779
Posts: 17
Joined: Fri Feb 20, 2009 1:32 pm

Cisco interface errors

#27 Post by iso1779 » Tue Feb 24, 2009 2:12 am

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
cacti_graph_template_interface_-_errorsdiscards.xml
Import after making a backup of the extisting template
(43.88 KiB) Downloaded 3474 times
interface.xml
copy into snmp_queries after making a backup of the original file.
(5.47 KiB) Downloaded 3506 times

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

Same error

#28 Post by rajputbhanu27 » Tue Apr 14, 2009 9:14 am

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.

iharvey
Posts: 42
Joined: Wed Nov 01, 2006 6:10 am

cisco interface errors

#29 Post by iharvey » Mon Jul 13, 2009 10:04 am

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/

iharvey
Posts: 42
Joined: Wed Nov 01, 2006 6:10 am

cisco interface errors

#30 Post by iharvey » Tue Jul 14, 2009 5:53 am

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.

Post Reply