Tuesday, February 25, 2014

Graphing Windows host's CPU load using Cacti

This post will show the use of xml files to graph an indexed SNMP data. Graphing a Windows host's Intel Core Duo CPUs load will be used to illustrate this.
CPU load is an indexed SNMP data; as such the cacti Data Query will be used. an XML file is required to tell Cacti Poller which SNMP data to use as input (used to select data to graph), and which one to use as output (data to graph).
The CPU load SNMP OID can be accessed from hrProcessorTable of HOST-RESOURCES-MIB. The content of this table can be shown using snmptable command
The content details of this table can be viewed in a dotted-decimal format using snmpwalk command
The hrProcessorLoad OID has a base address of .1.3.6.1.2.1.25.3.3.1.2 and one digit index; 4 and 5; which represents the processor ID (one for each Core).  This one digit index can be retrieved in one of two manners

1. Extracting the index from hrProcessorFrwID
For this, we will use the following xml file. "*\.([0-9]{1,3})$" is a regular expression that instruct Cacti to extract the last digit of ProcessorFrwID OID and use it as an index
in "Create Graphs for this host" step in the Data Query configuration process, the following screen will be shown
2. Using hrDeviceTable
The index can be retrieved form hrDeviceIndex OID of  hrDeviceTable, another table of the HOST-RESOURSES-MIB. In this case there is no need to a regular expression, the index will be taken directly from  the value of hrDeviceIndex OID
 We will, also, use hrDeviceDescr OID from  hrDeviceTable as an input for Cacti

Following, is the xml file to be used
The "Create Graph for this host" step will show the following screen


No comments:

Post a Comment