However, my happiness was short lived after i graphed my first interface and cacti returned wrong values for the bandwidth utilization. This was a high speed interface (Gigabit Ethernet), that carries all our mobile internet traffic and the current throughput was about 400 Mbps, yet the cacti graph was reporting a maximum of 120 Mbps and the graph appeared like it was dropping traffic (crazy graph)! see screen shot below:
Problem:
when you try graphing a high speed interface using SNMPv1 and 32-bit counters in cacti |
Like always i hit Google to find some answers and below is what i discovered before i finally fixed my cacti installation (Am super excited i did, and if you are in the same situation, i wish you the best).
Below are the lessons i learned, call them solutions:
Solution:
1. For high speed interfaces, you should use 64-bit counters if the device you are trying to monitor supports them. (refer to this article)
High Speed interfaces (100 Mbps or above)
ifHCInOctets
:1.3.6.1.2.1.31.1.1.1.6
(64-bit Octets in counter)ifHCOutOctets
:1.3.6.1.2.1.31.1.1.1.10
(64-bit Octets out counter)ifHCInUcastPkts
:1.3.6.1.2.1.31.1.1.1.7
(64-bit Packets in counter)ifHCOutUcastPkts
:1.3.6.1.2.1.31.1.1.1.11
(64-bit Packets out counter)ifHighSpeed
:1.3.6.1.2.1.31.1.1.1.15
(An estimate of the interface's current bandwidth in units of 1Mbps)
Low Speed interfaces
Lower speed interfaces can get by with 32-bit counters. If you use 32-bit counters on high-speed interfaces, they can wrap quickly; a 10 Mbps stream of back-to-back, full-size packets causes
ifInOctets
to wrap in just over 57 minutes. At 100 Mbps, the minimum wrap time is 5.7 minutes, and at 1 Gbps, the minimum is 34 secondsifInOctets
:1.3.6.1.2.1.2.2.1.10
(32-bit Octets in counter)ifOutOctets
:1.3.6.1.2.1.2.2.1.16
(32-bit Octets out counter)ifInUcastPkts
:1.3.6.1.2.1.2.2.1.11
(32-bit Packets in counter)ifOutUcastPkts
:1.3.6.1.2.1.2.2.1.17
(32-bit Packets out counter)ifSpeed
:1.3.6.1.2.1.2.2.1.5
(Currently negotiated speed of the interface - Max: 4.294 Gbps)
Another hour bouncing around Google, i found out that 64-bit OID counters are only supported in SNMPv2 yet i was still using SNMPv1!
3. To confirm if my router can support 64-bit OIDs, i tried an SNMPWALK from my cacti server and it returned the correct values. replace the community_string with your actual community string e.g "public" and ip_address with the ip address of the router you are trying to monitor.
//64-bit Octets In Counter
snmpwalk -v2c -c community_string ip_address 1.3.6.1.2.1.2.2.1.6
//64-bit Octets Out Counter
snmpwalk -v2c -c community_string ip_address 1.3.6.1.2.1.31.1.1.1.10
4. At this point, i was using 64-bit counters and SNMPv2 for the snmpwalk test above, so i thought it was a done deal (problem solved!). i deleted the device from cacti and created it again using SNMPv2 and created the graph using 64-bit counters (combined two of the information pieces that i had learnt), and this time round, the graph was empty :-(, And whenever i would try running snmp query in debug mode via cacti, the query was successful but "NO SNMP DATA RETURNED!!!!!"
5. Google again was my immediate friend, and after about 5 hours of reading other people's problems, i landed on my third piece of important information; The php-snmp module requires a version of PHP 5.4 and above to be able to handle "snmpbulkwalks" used in SNMPv2. Refer to this article for details.
6. I was running PHP 5.3 at the moment and i never had PHP-SNMP module installed, i think my installation was using NET-SNMP to do snmpwalks which if you are only dealing with SNMPv1 should be enough to get you cacti working. See how i installed and enabled the PHP-SNMP module here.
7. I upgraded my PHP installation to version PHP 5.5, enabled the PHP-SNMP module, restarted Apache and everything was smooth afterwards. The snmp "Verbose Query" was returning data, i re-created my devices with SNMPv2 and tested. See how my graph returned the correct values (400 Mbps) and it was smooth & accurate. I wish the same for you. Have fun :-)
Cacti Monitoring High Speed Interfaces with SNMPv2 and 64-bit counters |
No comments:
Post a Comment