Search This Blog

Monday, July 23, 2012

How to monitor Cisco QoS using SNMP


In the following post i will explain a way to get the correct OID, in order to monitor QoS policies using SNMP.

From time to time we may encounter situations were we will need to monitor specific policy-map, which configured on certain interface, for knowing and differentiate between traffic types. For example a policy-map which mark international and domestic traffic on the same interface.

Few notes for the above example:
- I'm using snmpwalk utility on Linux based machine to get and show the SNMP OID values
- The device that i monitor is Cisco 2811 router
- SNMP community is "snmp-community"
- Router IP is 192.168.10.1
- The descriptions and OID information is taken from Cisco SNMP navigator (http://tools.cisco.com/Support/SNMP/do/BrowseOID.do?local=en)

First let's list look at router interfaces description:

ifDescr
A textual string containing information about the interface, this string should include the name of the
manufacturer, the product name and the version of the interface hardware/software
snmpwalk -v 2c -c snmp-community 192.168.10.1 1.3.6.1.2.1.2.2.1.2

Output:

 
[root@linux-srv ~]# snmpwalk -v 2c -c snmp-community 192.168.10.1 1.3.6.1.2.1.2.2.1.2
IF-MIB::ifDescr.1 = STRING: FastEthernet0/0
IF-MIB::ifDescr.2 = STRING: FastEthernet0/1
IF-MIB::ifDescr.3 = STRING: FastEthernet0/0/0
IF-MIB::ifDescr.4 = STRING: FastEthernet0/0/1
IF-MIB::ifDescr.5 = STRING: FastEthernet0/0/2
IF-MIB::ifDescr.6 = STRING: FastEthernet0/0/3
IF-MIB::ifDescr.7 = STRING: Null0
IF-MIB::ifDescr.8 = STRING: Vlan1
IF-MIB::ifDescr.9 = STRING: Vlan2
IF-MIB::ifDescr.11 = STRING: Vlan5


Next let's see the QoS policies attached to these interfaces:


cbQosIfIndex
ifIndex for the interface to which this service is attached.

snmpwalk -v 2c -c snmp-community 192.168.10.1 1.3.6.1.4.1.9.9.166.1.1.1.1.4

Output:

 
[root@linux-srv ~]# snmpwalk -v 2c -c snmp-community 192.168.10.1 1.3.6.1.4.1.9.9.166.1.1.1.1.4
SNMPv2-SMI::enterprises.9.9.166.1.1.1.1.4.16 = INTEGER: 1
SNMPv2-SMI::enterprises.9.9.166.1.1.1.1.4.32 = INTEGER: 2
SNMPv2-SMI::enterprises.9.9.166.1.1.1.1.4.34 = INTEGER: 2

From the output above we can see that  there is one policy (16) over FastEthernet 0/0 and two policies (32 and 34) over Fastethernet 0/1.

In order to determine to which type of interface the policy is attached we will use the following:


cbQosIfType
This describes the logical interface/media type to which this service policy is attached following this table:
InterfaceType
1:mainInterface
2:subInterface
3:frDLCI
4:atmPVC
5:controlPlane
6:vlanPort
snmpwalk -v 2c -c snmp-community 192.168.10.1 1.3.6.1.4.1.9.9.166.1.1.1.1.2

Output:


[root@linux-srv ~]# snmpwalk -v 2c -c snmp-community 192.168.10.1 1.3.6.1.4.1.9.9.166.1.1.1.1.2
SNMPv2-SMI::enterprises.9.9.166.1.1.1.1.2.16 = INTEGER: 1
SNMPv2-SMI::enterprises.9.9.166.1.1.1.1.2.32 = INTEGER: 1
SNMPv2-SMI::enterprises.9.9.166.1.1.1.1.2.34 = INTEGER: 1

 We can see that all three policies (16,32,34) are attached to the main interface (using the above table).

Now let's determine the policy direction - input or output:
 
cbQosPolicyDirection
This indicates the direction of traffic for which this service policy is applied
TrafficDirection
1:input
2:output
snmpwalk -v 2c -c snmp-community 192.168.10.1 1.3.6.1.4.1.9.9.166.1.1.1.1.3

Output:

 
[root@linux-srv ~]# snmpwalk -v 2c -c snmp-community 192.168.10.1 1.3.6.1.4.1.9.9.166.1.1.1.1.3
SNMPv2-SMI::enterprises.9.9.166.1.1.1.1.3.16 = INTEGER: 1
SNMPv2-SMI::enterprises.9.9.166.1.1.1.1.3.32 = INTEGER: 1
SNMPv2-SMI::enterprises.9.9.166.1.1.1.1.3.34 = INTEGER: 2


We can see that policy 16 and 32 are in the input direction and policy 34 is in the output direction.


Next we will see the bit-rate for a specific policy usin the following:

cbQosCMPrePolicyBitRate

The bit rate of the traffic prior to executing any QoS policies

snmpwalk -v 2c -c snmp-community 192.168.10.1
1.3.6.1.4.1.9.9.166.1.15.1.1.7.XXX

Replace the XXX with the policy number, in my example 16,32 or 34

Output:

 
[root@ib-tools ~]# snmpwalk -v 2c -c bynet8001 80.74.118.138 1.3.6.1.4.1.9.9.166.1.15.1.1.7.32
SNMPv2-SMI::enterprises.9.9.166.1.15.1.1.7.32.13311825 = Gauge32: 105000
SNMPv2-SMI::enterprises.9.9.166.1.15.1.1.7.32.14640113 = Gauge32: 910000

From the output we can see that the bit-rate for policy 32, which goes in the input direction and attached to FastEthernet 0/1, is 105000 bps and 910000 bps.

the reason for the two values is deriving from the fact that there is also class-default for this policy.

looking on the router interface shows:
 
Router# show policy-map interface  fastEthernet 0/1
 FastEthernet0/1

  Service-policy input: POLICY1

    Class-map: CLASS1 (match-all)
      213152018 packets, 204489798566 bytes
      30 second offered rate 105000 bps, drop rate 0 bps
      Match: access-group name ACL_IB_NET
      QoS Set
        dscp 19
          Packets marked 213152020

    Class-map: class-default (match-any)
      243225777 packets, 189119340706 bytes
      30 second offered rate 910000 bps, drop rate 0 bps
      Match: any
      QoS Set
        dscp default
          Packets marked 243225788

  Service-policy output: POLICY1

    Class-map: CLASS1 (match-all)
      191459549 packets, 119638333572 bytes
      30 second offered rate 95000 bps, drop rate 0 bps
      Match: access-group name ACL_IB_NET
      QoS Set
        dscp 19
          Packets marked 191459550

    Class-map: class-default (match-any)
      381851041 packets, 87361395996 bytes
      30 second offered rate 860000 bps, drop rate 0 bps
      Match: any
      QoS Set
        dscp default
          Packets marked 381726600

we can also use the following for post policy rate and drop bit-rate:

cbQosCMPostPolicyBitRate

The bit rate of the traffic after executing QoS policies

snmpwalk -v 2c -c snmp-community 192.168.10.1
1.3.6.1.4.1.9.9.166.1.15.1.1.11

cbQosCMDropBitRate

The bit rate of the drops per class as the result of all features that can produce drops (e.g., police, random detect, etc.).

snmpwalk -v 2c -c snmp-community 192.168.10.1
1.3.6.1.4.1.9.9.166.1.15.1.1.18

2 comments:

  1. Great post!! Thanks.

    ReplyDelete
  2. The second output box under the cbQosCMPrePolicyBitRate section may have some sensitive info you may want to obscure. Just a heads up in case.

    ReplyDelete