It all started with a innocuous question: can you detect voice traffic with EEM? Looks simple enough: create a QoS class-map that matches voice calls and read the cbQosClassMapStats table in the CISCO-CLASS-BASED-QOS-MIB. The first obstacle was finding the correct indexes, but a Tcl script quickly solved that; I was ready to create the EEM applet. The applet failed to work correctly and after lots of debugging I figured out the counters in the cbQosClassMapStats table change only every 10 seconds.
I couldn’t believe my eyes and simply had to test other MIB variables as well. As expected, the IF-MIB (standard interface MIB) counters increase in real-time, but obviously someone had the bright idea that we need to detect changes in traffic profile only every now and then. Although I've received suggestions from my readers, none of them works on an 1800 or a 7200. Oh, well, Cisco developers from the days when I started working with routers would know better.
To test the MIB variable behavior I wrote a simple Tcl script to test the MIB variables. It reads the specified MIB variable at fixed intervals and prints the values, so you can monitor the changes in the MIB variable in real-time. I started low-bandwidth UDP flood across the router and monitored the output bytes interface counter. As expected the counter changed in real time and accurately tracked the amount of traffic sent through the router.
GW#pm ifOutOctets.3 public 10 1000 polling ifOutOctets.3 for 10 seconds (10 iterations) 0.000 ifOutOctets.3=42528679 1.000 ifOutOctets.3=42537767 2.000 ifOutOctets.3=42546713 3.000 ifOutOctets.3=42555719 4.000 ifOutOctets.3=42564665 5.000 ifOutOctets.3=42573611 6.000 ifOutOctets.3=42582699 7.000 ifOutOctets.3=42591645 8.000 ifOutOctets.3=42600591 9.000 ifOutOctets.3=42609537
Then I created a simple class-map and policy map …
GW#show policy-map interface FastEthernet1/0 Service-policy output: LAN Class-map: Voice (match-all) 20438 packets, 2902196 bytes 30 second offered rate 70000 bps Match: access-group name Voice Class-map: class-default (match-any) 41 packets, 3967 bytes 30 second offered rate 0 bps, drop rate 0 bps Match: any
… and monitored the pre-policy byte counter (cbQosCMPrePolicyByte64) for the Voice class. The value changed only once every ten seconds:
GW#pm cbQosCMPrePolicyByte64.50.10767521 public 10 1000 polling cbQosCMPrePolicyByte64.50.10767521 for 10 seconds (10 iterations) 0.000 cbQosCMPrePolicyByte64.50.10767521=0x002865366 1.000 cbQosCMPrePolicyByte64.50.10767521=0x002865366 2.000 cbQosCMPrePolicyByte64.50.10767521=0x002865366 3.000 cbQosCMPrePolicyByte64.50.10767521=0x002865366 4.000 cbQosCMPrePolicyByte64.50.10767521=0x002865366 5.000 cbQosCMPrePolicyByte64.50.10767521=0x002865366 6.000 cbQosCMPrePolicyByte64.50.10767521=0x00287acf8 7.000 cbQosCMPrePolicyByte64.50.10767521=0x00287acf8 8.000 cbQosCMPrePolicyByte64.50.10767521=0x00287acf8 9.000 cbQosCMPrePolicyByte64.50.10767521=0x00287acf8
What can I say ... apart from expressing my deepest disappointment :(