MIB Protocol Statistics (RFC1213) [v2.1 - 2009-05-10]

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

Moderators: Moderators, Developers

Post Reply
Author
Message
User avatar
BSOD2600
Cacti Moderator
Posts: 12160
Joined: Sat May 08, 2004 12:44 pm
Location: USA

MIB Protocol Statistics (RFC1213) [v2.1 - 2009-05-10]

#1 Post by BSOD2600 » Sat Dec 17, 2005 9:56 pm

** MIB Protocol Statistics (RFC1213) **
Created by BSOD2600

-Notes-

These scripts get the various detailed protocol statistics for IP / TCP / UDP / SNMP. Since it polls the standard RFC1213-MIB objects, these should work on any SNMP networked device. The graphs are formatted to show the data 'per 5 minutes'. I did this because the standard output just wasn't as meaningful / pretty.


-Installation-

1) Drop RFC1213.xm into your \cacti\resources\snmp_queries\ folder.
2) Import the data query templates from \templates
3) Add the RFC1213 Statistics Data Query to a device.
4) From the 'Create Graphs for this Host' screen, select the protocol types and click Create.


-Changelog-

2.1 - Fixed graph template data source selection issues (Fixed IP graph template. Re-created SNMP graph template).
2.0 - Rewrite of the scripts ditching the Script server for pure/fast SNMP Data Query. Delete the ss_protocol* scripts from your \cacti\scripts\ folder. Delete the various *protocol statistics Data Input Methods. The Data templates remain the same, so you should be able to continue to use the 1.x graph/data sources post-upgrade.
1.3 - tiny error fixed with ss_protocol_ip.php (gandalf)
1.2 - update to fully support SNMPv3 (gandalf)
1.1 - Updated scripts to account for some values not returned for hosts (thanks lvm).
1.0 - Initial release.
Attachments
proto_stats_2.1.zip
templates & scripts. v2.1. Cacti 0.8.7d
(113.07 KiB) Downloaded 3982 times
proto_stats_2.0.zip
templates & scripts. v2.0. Cacti 0.8.7d
(112.34 KiB) Downloaded 1443 times
proto_stats_1.3.zip
templates & scripts V1.3
(126.32 KiB) Downloaded 2235 times
protocol_stats.png
Sample outputs
protocol_stats.png (88.16 KiB) Viewed 74652 times
Last edited by BSOD2600 on Sun May 10, 2009 11:27 pm, edited 5 times in total.

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

#2 Post by gandalf » Sun Dec 18, 2005 9:03 am

WOW, this is really gooood!
Reinhard

NetDude
Posts: 1
Joined: Sun Dec 18, 2005 1:08 pm

#3 Post by NetDude » Sun Dec 18, 2005 1:09 pm

Your darn right, WOW. Nice work and thank you!

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

#4 Post by gandalf » Tue Jan 17, 2006 5:39 am

Just targeted these Scripts to some z/OS hosts, but proto stats failed due to missing SNMP Out Packets. To get get the other values at last, I decided to change one single line

Code: Select all

[$result = is_numeric($var) ? ($result . $row["key"] . ":" . $var . " ") : ($result . $row["key"] . ":NaN ");
Furthermore, I decided to initialize the $result string

Code: Select all

$result = "";
Please find the upgraded scripts attached
Reinhard
Attachments
ss_protocol.gz
gzipped Protocol Scripts
(2.37 KiB) Downloaded 2190 times
Last edited by gandalf on Fri Jan 27, 2006 3:32 pm, edited 1 time in total.

elady
Posts: 1
Joined: Sun Jan 22, 2006 4:07 am

Re: MIB Protocol Statistics 1.1

#5 Post by elady » Thu Jan 26, 2006 7:57 am

It's really useful templates. Thank You. :)

Halfwalker
Posts: 18
Joined: Tue Jan 24, 2006 6:11 pm

#6 Post by Halfwalker » Fri Jan 27, 2006 3:00 pm

These look really cool - thanks for doing them. I'm testing them out now, but having a few problems (of course). This is on a Debian sarge/stable system, running 0.8.6h and rrdtool v1.0.49. The only graph that seems to work is the Combined one.

I'm targeting this at a Cisco 2621 router, so they should all work, right ?

When I check the IP Protocol Statistics under Graph Management, I see the following :

Code: Select all

/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="Cybercon 1 - IP Protocol Statistics" \
--rigid \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale \
--vertical-label="per 5 minutes" \
DEF:a="/usr/share/cacti/site/rra/cybercon_1_ipinhdrerrors_25.rrd":ipForwDatagrams:AVERAGE \
DEF:b="/usr/share/cacti/site/rra/cybercon_1_ipinhdrerrors_25.rrd":ipFragCreates:AVERAGE \
DEF:c="/usr/share/cacti/site/rra/cybercon_1_ipinhdrerrors_25.rrd":ipFragFails:AVERAGE \
DEF:d="/usr/share/cacti/site/rra/cybercon_1_ipinhdrerrors_25.rrd":ipFragOKs:AVERAGE \
DEF:e="/usr/share/cacti/site/rra/cybercon_1_ipinhdrerrors_25.rrd":ipInAddrErrors:AVERAGE \
DEF:f="/usr/share/cacti/site/rra/cybercon_1_ipinhdrerrors_25.rrd":ipInDiscards:AVERAGE \
DEF:g="/usr/share/cacti/site/rra/cybercon_1_ipinhdrerrors_25.rrd":ipInHdrErrors:AVERAGE \
DEF:h="/usr/share/cacti/site/rra/cybercon_1_ipinhdrerrors_25.rrd":ipInUnknownProtos:AVERAGE \
DEF:i="/usr/share/cacti/site/rra/cybercon_1_ipinhdrerrors_25.rrd":ipOutDiscards:AVERAGE \
DEF:j="/usr/share/cacti/site/rra/cybercon_1_ipinhdrerrors_25.rrd":ipOutNoRoutes:AVERAGE \
DEF:ba="/usr/share/cacti/site/rra/cybercon_1_ipinhdrerrors_25.rrd":ipReasmFails:AVERAGE \
DEF:bb="/usr/share/cacti/site/rra/cybercon_1_ipinhdrerrors_25.rrd":ipReasmOKs:AVERAGE \
DEF:bc="/usr/share/cacti/site/rra/cybercon_1_ipinhdrerrors_25.rrd":ipReasmReqds:AVERAGE \
DEF:bd="/usr/share/cacti/site/rra/cybercon_1_ipinhdrerrors_25.rrd":ipRoutingDiscards:AVERAGE \
CDEF:cdefa=a,300,* \
CDEF:cdefe=b,300,* \
CDEF:cdefi=c,300,* \
CDEF:cdefbc=d,300,* \
CDEF:cdefbg=e,300,* \
CDEF:cdefca=f,300,* \
CDEF:cdefce=g,300,* \
CDEF:cdefci=h,300,* \
CDEF:cdefdd=i,-300,* \
CDEF:cdefde=i,300,* \
CDEF:cdefdh=j,-300,* \
CDEF:cdefdi=j,300,* \
CDEF:cdefeb=ba,-300,* \
CDEF:cdefec=ba,300,* \
CDEF:cdefef=bb,-300,* \
CDEF:cdefeg=bb,300,* \
CDEF:cdefej=bc,-300,* \
CDEF:cdeffa=bc,300,* \
CDEF:cdeffd=bd,-300,* \
CDEF:cdeffe=bd,300,* \
AREA:cdefa#FFF200:"IpForwDatagrams"  \
GPRINT:cdefa:LAST:"  Current\:"  \
GPRINT:cdefa:AVERAGE:"Average\:"  \
GPRINT:cdefa:MAX:"Maximum\:\n"  \
STACK:cdefe#FF6044:"ipFragCreates"  \
GPRINT:cdefe:LAST:"    Current\:"  \
GPRINT:cdefe:AVERAGE:"Average\:"  \
GPRINT:cdefe:MAX:"Maximum\:\n"  \
STACK:cdefi#C4FD3D:"ipFragFails"  \
GPRINT:cdefi:LAST:"      Current\:"  \
GPRINT:cdefi:AVERAGE:"Average\:"  \
GPRINT:cdefi:MAX:"Maximum\:\n"  \
STACK:cdefbc#D8ACE0:"ipFragOKs"  \
GPRINT:cdefbc:LAST:"        Current\:"  \
GPRINT:cdefbc:AVERAGE:"Average\:"  \
GPRINT:cdefbc:MAX:"Maximum\:\n"  \
STACK:cdefbg#CCCCCC:"ipInAddrErrors"  \
GPRINT:cdefbg:LAST:"   Current\:"  \
GPRINT:cdefbg:AVERAGE:"Average\:"  \
GPRINT:cdefbg:MAX:"Maximum\:\n"  \
STACK:cdefca#B90054:"ipInDiscards"  \
GPRINT:cdefca:LAST:"     Current\:"  \
GPRINT:cdefca:AVERAGE:"Average\:"  \
GPRINT:cdefca:MAX:"Maximum\:\n"  \
STACK:cdefce#00BED9:"ipInHdrErrors"  \
GPRINT:cdefce:LAST:"    Current\:"  \
GPRINT:cdefce:AVERAGE:"Average\:"  \
GPRINT:cdefce:MAX:"Maximum\:\n"  \
LINE1:cdefci#623465:"ipInUnknownProtos"  \
GPRINT:cdefci:LAST:"Current\:"  \
GPRINT:cdefci:AVERAGE:"Average\:"  \
GPRINT:cdefci:MAX:"Maximum\:\n"  \
COMMENT:"\n"  \
AREA:cdefdd#55D6D3:"ipOutDiscards"  \
GPRINT:cdefde:LAST:"    Current\:"  \
GPRINT:cdefde:AVERAGE:"Average\:"  \
GPRINT:cdefde:MAX:"Maximum\:\n"  \
STACK:cdefdh#6557D0:"ipOutNoRoutes"  \
GPRINT:cdefdi:LAST:"    Current\:"  \
GPRINT:cdefdi:AVERAGE:"Average\:"  \
GPRINT:cdefdi:MAX:"Maximum\:\n"  \
STACK:cdefeb#35962B:"ipReasmFails"  \
GPRINT:cdefec:LAST:"     Current\:"  \
GPRINT:cdefec:AVERAGE:"Average\:"  \
GPRINT:cdefec:MAX:"Maximum\:\n"  \
STACK:cdefef#0000FF:"ipReasmOKs"  \
GPRINT:cdefeg:LAST:"       Current\:"  \
GPRINT:cdefeg:AVERAGE:"Average\:"  \
GPRINT:cdefeg:MAX:"Maximum\:\n"  \
STACK:cdefej#311F4E:"ipReasmReqds"  \
GPRINT:cdeffa:LAST:"     Current\:"  \
GPRINT:cdeffa:AVERAGE:"Average\:"  \
GPRINT:cdeffa:MAX:"Maximum\:\n"  \
LINE1:cdeffd#FFF200:"ipRoutingDiscards"  \
GPRINT:cdeffe:LAST:"Current\:"  \
GPRINT:cdeffe:AVERAGE:"Average\:"  \
GPRINT:cdeffe:MAX:"Maximum\:\n" 

RRDTool Says:

ERROR: bad format for [G]PRINT in '  Current:'
So this one doesn't graph. Does it require rrdtool v1.2.x ?

TCP Protocol Statistics under Graph Management shows this :

Code: Select all

/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="Cybercon 1 - TCP Protocol Statistics" \
--rigid \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale \
--vertical-label="per 5 minutes" \
DEF:a="/usr/share/cacti/site/rra/cybercon_1_tcpactiveopens_26.rrd":tcpActiveOpens:AVERAGE \
DEF:b="/usr/share/cacti/site/rra/cybercon_1_tcpactiveopens_26.rrd":tcpAttemptFails:AVERAGE \
DEF:c="/usr/share/cacti/site/rra/cybercon_1_tcpactiveopens_26.rrd":tcpEstabResets:AVERAGE \
DEF:d="/usr/share/cacti/site/rra/cybercon_1_tcpactiveopens_26.rrd":tcpInErrs:AVERAGE \
DEF:e="/usr/share/cacti/site/rra/cybercon_1_tcpactiveopens_26.rrd":tcpOutRsts:AVERAGE \
DEF:f="/usr/share/cacti/site/rra/cybercon_1_tcpactiveopens_26.rrd":tcpPassiveOpens:AVERAGE \
DEF:g="/usr/share/cacti/site/rra/cybercon_1_tcpactiveopens_26.rrd":tcpRetransSegs:AVERAGE \
DEF:h="/usr/share/cacti/site/rra/cybercon_1_tcpactiveopens_26.rrd":tcpCurrEstab:AVERAGE \
CDEF:cdefa=a,300,* \
CDEF:cdefe=b,300,* \
CDEF:cdefi=c,300,* \
CDEF:cdefbc=d,300,* \
CDEF:cdefbg=e,300,* \
CDEF:cdefca=f,300,* \
CDEF:cdefce=g,300,* \
AREA:cdefa#FFD660:"tcpActiveOpens"  \
GPRINT:cdefa:LAST:" Current\:"  \
GPRINT:cdefa:AVERAGE:"Average\:"  \
GPRINT:cdefa:MAX:"Maximum\:\n"  \
STACK:cdefe#FF5700:"tcpAttemptFails"  \
GPRINT:cdefe:LAST:"Current\:"  \
GPRINT:cdefe:AVERAGE:"Average\:"  \
GPRINT:cdefe:MAX:"Maximum\:\n"  \
STACK:cdefi#EAAF00:"tcpEstabResets"  \
GPRINT:cdefi:LAST:" Current\:"  \
GPRINT:cdefi:AVERAGE:"Average\:"  \
GPRINT:cdefi:MAX:"Maximum\:\n"  \
STACK:cdefbc#D8ACE0:"tcpInErrs"  \
GPRINT:cdefbc:LAST:"      Current\:"  \
GPRINT:cdefbc:AVERAGE:"Average\:"  \
GPRINT:cdefbc:MAX:"Maximum\:\n"  \
STACK:cdefbg#CDCFC4:"tcpOutRsts"  \
GPRINT:cdefbg:LAST:"     Current\:"  \
GPRINT:cdefbg:AVERAGE:"Average\:"  \
GPRINT:cdefbg:MAX:"Maximum\:\n"  \
STACK:cdefca#C4FD3D:"tcpPassiveOpens"  \
GPRINT:cdefca:LAST:"Current\:"  \
GPRINT:cdefca:AVERAGE:"Average\:"  \
GPRINT:cdefca:MAX:"Maximum\:\n"  \
STACK:cdefce#AD3B6E:"tcpRetransSegs"  \
GPRINT:cdefce:LAST:" Current\:"  \
GPRINT:cdefce:AVERAGE:"Average\:"  \
GPRINT:cdefce:MAX:"Maximum\:\n"  \
LINE1:h#4444FF:"tcpCurrEstab"  \
GPRINT:h:LAST:"   Current\:"  \
GPRINT:h:AVERAGE:"Average\:"  \
GPRINT:h:MAX:"Maximum\:\n" 

RRDTool Says:

ERROR: opening '/usr/share/cacti/site/rra/cybercon_1_tcpactiveopens_26.rrd': No such file or directory
Ah ha. RRD file missing. So go look at the Data Source for that, and ... it's completely blank. No debug output to show what the rrdtool create should have been.

I'm suspecting the XML import isn't quite working properly. It seems that all the imports I've done have had one problem or another. For example, the Advanced CPU Usage one from http://forums.cacti.net/viewtopic.php?t=10537 had problems too - only one datatemplate was correct - the other two had to have the OID and Data Input Method fields corrected.

How can I debug or check this to make sure they're OK ?

D.

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

#7 Post by gandalf » Fri Jan 27, 2006 3:35 pm

What are your Settings for RRDTool Utility Version? I bet there's rrdtool-1.2.x whilst you're running 1.0.x? Both versions differ in escaping colons ...
Reinhard

Halfwalker
Posts: 18
Joined: Tue Jan 24, 2006 6:11 pm

#8 Post by Halfwalker » Fri Jan 27, 2006 4:18 pm

Settings are for 1.0.x. I got bitten by that before :oops:

How about the total lack of a data source for TCP Protocol Statistics (also for IP and UDP btw) ?

D.

PS - appreciate the fast response here.

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

#9 Post by gandalf » Fri Jan 27, 2006 4:55 pm

Please re-import and post a screenshot of the outcome
Reinhard

Halfwalker
Posts: 18
Joined: Tue Jan 24, 2006 6:11 pm

#10 Post by Halfwalker » Fri Jan 27, 2006 6:11 pm

OK - I re-imported the TCP one - results are below. Going to a datasource using it still has a blank debug area. Nothing there.

D.
Attachments
Import-2.png
Data source is still blank.
Import-2.png (28.44 KiB) Viewed 73632 times
Import-1.png
Results of TCP import.
Import-1.png (6.08 KiB) Viewed 73632 times

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

#11 Post by gandalf » Fri Jan 27, 2006 6:28 pm

You surely put the protocol_stats script into the scripts folder, did you? Next thing we need is a debug log: goto Settings and select DEBUG as Logging Level. Run for one polling cycle and please post the log/cacti.log. Don't forget to re-set the Logging Level afterwards
Reinhard

User avatar
BSOD2600
Cacti Moderator
Posts: 12160
Joined: Sat May 08, 2004 12:44 pm
Location: USA

#12 Post by BSOD2600 » Fri Jan 27, 2006 6:59 pm

Halfwalker: Manually run the script via the script server and see if it returns any data.
1) php c:\cacti\script_server.php
2) c:\cacti\scripts\ss_protocol_tcp.php ss_protocol_tcp <hostname> <snmp_community> <snmp_version> <snmp_port> <snmp_timeout> <snmpv3_auth_username> <snmpv3_auth_password>

If no data is returned, then your device does not support that MIB.

User avatar
N3NCY
Cacti User
Posts: 242
Joined: Thu Sep 22, 2005 7:50 pm
Location: Landenberg, PA
Contact:

#13 Post by N3NCY » Sat Feb 18, 2006 1:16 am

BSOD2600: I don't know how I missed getting this back on Dec.17 when you uploaded this wonderful collection!
But, I have it now!
Thank you, this is a nice set of templates and scripts.
I downloaded your tar.gz file, read the readme, installed per your notes and two polling cycles later I am impressed!
Nice work!
:D
Thank you,

Ernie
http://www.NMSWorld.com
[b]Dual Zeon Dual Core 2.6Ghz / 8GB RAM / 4x15k RPM SATA RAID5[/b]
[b]Cacti Version[/b] - 0.8.7b
[b]Poller Type[/b] - cactid 0.8.7 with Boost v1.7
[b]Server Info[/b] - FreeBSD 7.0-RELEASE
[b]Web Server[/b] - Apache/2.2.6 (Unix) mod_ssl/2.2.6 OpenSSL/0.9.8g DAV/2 PHP/5.2.5 mod_perl/2.0.3 Perl/v5.8.8
[b]PHP[/b] - 5.2.6
[b]MySQL[/b] - 5.0.51b Mod: poller_output ENGINE = MEMORY
[b]RRDTool[/b] - 1.3.0
[b]SNMP[/b] - 5.4.1
[b]Plugins[/b] - Host Info (hostinfo - v0.2), Update Checker (update - v0.3), Network Tools (tools - v0.2), FlowView (flowview - v0.3), Read-only Devices Tab (devices - v0.4), Network Discovery (discovery - v0.8.3), Syslog Monitoring (syslog - v0.5.2), Thresholds (thold - v0.3.9), Device Monitoring (monitor - v0.8.2), PHP Network Weathermap (weathermap - v0.941), SuperLinks (superlinks - v0.72), Report Creator (reports - v0.1b)

Diceman
Cacti User
Posts: 142
Joined: Tue Oct 25, 2005 10:01 am

#14 Post by Diceman » Sun Jun 25, 2006 10:59 pm

i have a problem. it seems as though the data is only updating when i run the scripts manually from the command. doesnt seem strange as i have another web hits script that does the same thing. any ideas on how to remedy the situation?

the logs post no errors and return results when logging is set to high.

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

#15 Post by gandalf » Wed Jul 19, 2006 12:23 pm

Diceman wrote:i have a problem. it seems as though the data is only updating when i run the scripts manually from the command. doesnt seem strange as i have another web hits script that does the same thing. any ideas on how to remedy the situation?

the logs post no errors and return results when logging is set to high.
This seems to be an environment thingy. Please check, if all used binaries have to full paths. Are you running cmd.php or cactid?
Reinhard

Post Reply