The purpose is to get DHCP servers statistics from Cisco routers (and associated IOS) who do not support a few MIBs related to DHCP.
It's my case with a Cisco 3750 who provides 4 DHCP pools, and a c1803 providing one pool.
For persons who are working with c3750, they know this equipment is a piece of sh*t to monitor a bit deeply (no temp env available, ...).
As a workaround, Cisco provides an embedded script in Tcl (tool command language) to convert datas to snmp, but it breaks small routers (100% cpu) - and sometimes erase flash memory :/
There're 3 parts in the perl script :
-> get the dhcp server memory (the only usefull stats for ths command):
Code: Select all
#sh ip dhcp server statistics
Memory usage 70884
...
. number of excluded IPs
. number of leased IPs
. max number IPs available in the pool, as a legend in the graphs
-> get the IPs conflicts (differenciating gratuitous ARP detection method and ping detection method)
I had only one problem : make the perl script working with Spine, that's just impossible, I searched a solution everywhere in Google and this forum, I just saw there's bugs with some kind of script outputs.
(if Mister TheWitness could listen ...
In the attached file, you will find all captures images, the perl script, and all the XML I exported through the cacti web gui, 0.8.7g.
All the infos and the use of the files are in the README inside the compressed attached file, I let the content here :
Code: Select all
# ------------------ #
# Cisco DHCP stats #
# ------------------ #
# -- Environment:
- Cacti:
Cacti Version - 0.8.7g
Plugin Architecture - 2.8
Poller Type - CMD.php
- Server:
Server Info - Linux 2.6.32-22-server
Web Server - lighttpd 1.4.26 (ssl)
PHP - 5.3.2-1ubuntu4.5
MySQL - 5.1.41-3ubuntu12.8
RRDTool - 1.3.8
SNMP - 5.4.2.1
- Plugins:
Host Info (hostinfo - v0.2)
Login Page Mod (loginmod - v1.0)
PHP Network Weathermap (weathermap - v0.97a)
Global Plugin Settings (settings - v0.5)
Syslog Monitoring (syslog - v0.5.2)
Read-only Devices Tab (devices - v0.4)
# -- Installation:
1. place cisco_dhcp_stats.pl in $cacti_path/scripts directory
2. create the data input methods as shown in the images (conflicts, memstats, poolstats)
3. import cisco_dhcp_*_template.xml files to Cacti using web interface
4. add the graph templates to your device with your values (username, ...)
5. create graphs
5 bis. if you have many pools for a server, add new poolstats graph for each one,
and don't forget to indicate the |pool_name| for data sources and graph.
6. add graphs to your trees
# -- Data Input Methods command line :
1. pool statistics :
/usr/bin/perl <path_cacti>/scripts/cisco_dhcp_stats.pl --host <hostname> --port <port> --username <username> --password <password> --enable <enable> --appli poolstats --pool <poolname>
2. IP conflicts stats :
/usr/bin/perl <path_cacti>/scripts/cisco_dhcp_stats.pl --host <hostname> --port <port> --username <username> --password <password> --enable <enable> --appli conflicts
3. memory stats :
/usr/bin/perl <path_cacti>/scripts/cisco_dhcp_stats.pl --host <hostname> --port <port> --username <username> --password <password> --enable <enable> --appli memstats
# -- Notes:
the perl script works only with the CMD.php poller, it never wanna work with Spine (0.8.7).
tried too with the compile option "nifty popen" ...
a few infos : http://forums.cacti.net/viewtopic.php?f=2&t=38693&start=15
if you have the solution, please share it !
As an ending of my post, the time to execute the script :
Code: Select all
~/scripts$ time /usr/bin/perl cisco_dhcp_stats.pl --host ... --port 22023 --username ... --password ... --enable ... --appli poolstats --pool DATA-POOL
poolexcl:10 poolleased:120 poolmax:2046
real 0m0.776s
user 0m0.070s
sys 0m0.000s