|
|
| Author |
Message |
BSOD2600 Cacti Moderator
Joined: 08 May 2004 Posts: 6662 Location: WA, USA
|
Posted: Sat Dec 17, 2005 9:56 pm Post subject: MIB Protocol Statistics 1.2 (full SNMPv3 Support) |
|
|
I was bored so I created various scripts which use the new PHP script server in Cacti. 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. All SNMP versions are supported, as much as possible.
The graphs are formatted to show the data 'per 5 minutes'. I did this because the standard output just wasn't as meaningful / pretty.
-Changelog-
1.3 - tiny error fixed with ss_protocol_ip.php
1.2 - update to fully support SNMPv3
1.1 - Updated scripts to account for some values not returned for hosts (thanks lvm).
1.0 - Initial release.
| Description: |
|
| Filesize: |
88.16 KB |
| Viewed: |
20867 Time(s) |

|
| Description: |
|
 Download |
| Filename: |
proto_stats_1.3.zip |
| Filesize: |
126.32 KB |
| Downloaded: |
438 Time(s) |
| Description: |
|
 Download |
| Filename: |
proto_stats_1.2.zip |
| Filesize: |
126.32 KB |
| Downloaded: |
273 Time(s) |
| Description: |
|
 Download |
| Filename: |
protocol_stats.zip |
| Filesize: |
123.18 KB |
| Downloaded: |
2253 Time(s) |
Last edited by BSOD2600 on Sun Apr 15, 2007 8:03 pm; edited 2 times in total |
|
| Back to top |
|
 |
gandalf Developer
Joined: 02 Dec 2004 Posts: 11619 Location: Muenster, Germany
|
Posted: Sun Dec 18, 2005 9:03 am Post subject: |
|
|
WOW, this is really gooood!
Reinhard
|
|
| Back to top |
|
 |
NetDude
Joined: 18 Dec 2005 Posts: 1
|
Posted: Sun Dec 18, 2005 1:09 pm Post subject: |
|
|
| Your darn right, WOW. Nice work and thank you!
|
|
| Back to top |
|
 |
gandalf Developer
Joined: 02 Dec 2004 Posts: 11619 Location: Muenster, Germany
|
Posted: Tue Jan 17, 2006 5:39 am Post subject: |
|
|
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: | | [$result = is_numeric($var) ? ($result . $row["key"] . ":" . $var . " ") : ($result . $row["key"] . ":NaN "); | Furthermore, I decided to initialize the $result stringPlease find the upgraded scripts attached
Reinhard
| Description: |
|
 Download |
| Filename: |
ss_protocol.gz |
| Filesize: |
2.37 KB |
| Downloaded: |
807 Time(s) |
Last edited by gandalf on Fri Jan 27, 2006 3:32 pm; edited 1 time in total |
|
| Back to top |
|
 |
elady
Joined: 22 Jan 2006 Posts: 1
|
Posted: Thu Jan 26, 2006 7:57 am Post subject: Re: MIB Protocol Statistics 1.1 |
|
|
It's really useful templates. Thank You.
|
|
| Back to top |
|
 |
Halfwalker
Joined: 24 Jan 2006 Posts: 18
|
Posted: Fri Jan 27, 2006 3:00 pm Post subject: |
|
|
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: | /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: | /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.
|
|
| Back to top |
|
 |
gandalf Developer
Joined: 02 Dec 2004 Posts: 11619 Location: Muenster, Germany
|
Posted: Fri Jan 27, 2006 3:35 pm Post subject: |
|
|
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
|
|
| Back to top |
|
 |
Halfwalker
Joined: 24 Jan 2006 Posts: 18
|
Posted: Fri Jan 27, 2006 4:18 pm Post subject: |
|
|
Settings are for 1.0.x. I got bitten by that before
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.
|
|
| Back to top |
|
 |
gandalf Developer
Joined: 02 Dec 2004 Posts: 11619 Location: Muenster, Germany
|
Posted: Fri Jan 27, 2006 4:55 pm Post subject: |
|
|
Please re-import and post a screenshot of the outcome
Reinhard
|
|
| Back to top |
|
 |
Halfwalker
Joined: 24 Jan 2006 Posts: 18
|
Posted: Fri Jan 27, 2006 6:11 pm Post subject: |
|
|
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.
| Description: |
|
| Filesize: |
6.08 KB |
| Viewed: |
19848 Time(s) |

|
| Description: |
| Data source is still blank. |
|
| Filesize: |
28.44 KB |
| Viewed: |
19848 Time(s) |

|
|
|
| Back to top |
|
 |
gandalf Developer
Joined: 02 Dec 2004 Posts: 11619 Location: Muenster, Germany
|
Posted: Fri Jan 27, 2006 6:28 pm Post subject: |
|
|
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
|
|
| Back to top |
|
 |
BSOD2600 Cacti Moderator
Joined: 08 May 2004 Posts: 6662 Location: WA, USA
|
Posted: Fri Jan 27, 2006 6:59 pm Post subject: |
|
|
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.
|
|
| Back to top |
|
 |
N3NCY Cacti User
Joined: 22 Sep 2005 Posts: 238 Location: Landenberg, PA
|
Posted: Sat Feb 18, 2006 1:16 am Post subject: |
|
|
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!
|
|
| Back to top |
|
 |
Diceman Cacti User
Joined: 25 Oct 2005 Posts: 139
|
Posted: Sun Jun 25, 2006 10:59 pm Post subject: |
|
|
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.
|
|
| Back to top |
|
 |
gandalf Developer
Joined: 02 Dec 2004 Posts: 11619 Location: Muenster, Germany
|
Posted: Wed Jul 19, 2006 12:23 pm Post subject: |
|
|
| 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
|
|
| Back to top |
|
 |
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|