Graphing the total CPU usage on a linux host using SNMP and the UCD-SNMP-MIB MIB

Submitted by admin on Sat, 11/06/2010 - 15:31

CPU usage on a linux host

This example uses the following OID's from the UCD-SNMP-MIB_MIB:

OID TYPE DESCRIPTION
ssCpuRawUser Counter Total CPU usage by applications run by nonprivileged users since the system booted. Adding the user, system, and nice values can give a good approximation of total CPU usage..
ssCpuRawSystem Counter Total CPU usage by applications run by privileged system processes since the system booted.
ssCpuRawNice Counter Total CPU usage by applications running at a nondefault priority level.
ssCpuRawIdle Counter The percentage of the time the CPU is running idle. Subtracting this value from 100 can give a good approximation of total CPU usage.

Below is the xml config file. Be aware that since this example uses OID's from the "private" branch, this example only works with a valid license key!

<?xml version="1.0"?>
<rtgraph>
   <programtitle>Uranium ... CpuUtilizationUcdavisMibGR10I0</programtitle>
   <charttitle>CPU Utilization (ucdavis MIB)</charttitle>
   <savesettfile>LinuxOS_CpuUtilizationUcdavisMibGR10I0_D3_FCRTGraph.xml</savesettfile>
   <savessfile></savessfile>
   <yaxis>%CPU utilization</yaxis>
   <xaxis>X-axis</xaxis>
   <contpanvisible>true</contpanvisible>
   <charttype>bar</charttype>
   <barstyle>rectangle</barstyle>
   <multibartype>stacked</multibartype>
   <chart3d>true</chart3d>
   <legendalignment>right</legendalignment>
   <maxlegendlength>30</maxlegendlength>
   <preferredinstance></preferredinstance>
   <top20only>false</top20only>
   <showvaluelabels>false</showvaluelabels>
   <automaticupdownscaling>false</automaticupdownscaling>
   <refreshinstances>false</refreshinstances>
   <left>120</left>
   <top>131</top>
   <width>740</width>
   <height>450</height>
   <host>192.168.3.253</host>
   <community>public</community>
   <snmpversion>2</snmpversion>
   <snmpport>161</snmpport>
   <username></username>
   <password></password>
   <pollinginterval>10</pollinginterval>
   <shooter>
      <raw>false</raw>
      <linear>true</linear>
      <shootertargettable>
         <shootertargetentry>
            <oid>1.3.6.1.4.1.2021.11.50</oid>
            <instance>.0</instance>
            <visible>false</visible>
            <formula></formula>
         </shootertargetentry>
         <shootertargetentry>
            <oid>1.3.6.1.4.1.2021.11.51</oid>
            <instance>.0</instance>
            <visible>false</visible>
            <formula></formula>
         </shootertargetentry>
         <shootertargetentry>
            <oid>1.3.6.1.4.1.2021.11.52</oid>
            <instance>.0</instance>
            <visible>false</visible>
            <formula></formula>
         </shootertargetentry>
         <shootertargetentry>
            <oid>&Formula1</oid>
            <instance></instance>
            <visible>false</visible>
            <formula>%User.0,A/$PI,A=1.3.6.1.4.1.2021.11.50.0,</formula>
         </shootertargetentry>
         <shootertargetentry>
            <oid>&Formula2</oid>
            <instance></instance>
            <visible>false</visible>
            <formula>%Nice.0,B/$PI,B=1.3.6.1.4.1.2021.11.51.0,</formula>
         </shootertargetentry>
         <shootertargetentry>
            <oid>&Formula3</oid>
            <instance></instance>
            <visible>false</visible>
            <formula>%System.0,C/$PI,C=1.3.6.1.4.1.2021.11.52.0,</formula>
         </shootertargetentry>
      </shootertargettable>
   </shooter>
   <oidtable>
      <oidentry>
         <oid>1.3.6.1.4.1.2021.11.50</oid>
         <oiddescr>ssCpuRawUser</oiddescr>
         <format></format>
         <scolor></scolor>
      </oidentry>
      <oidentry>
         <oid>1.3.6.1.4.1.2021.11.51</oid>
         <oiddescr>ssCpuRawNice</oiddescr>
         <format></format>
         <scolor></scolor>
      </oidentry>
      <oidentry>
         <oid>1.3.6.1.4.1.2021.11.52</oid>
         <oiddescr>ssCpuRawSystem</oiddescr>
         <format></format>
         <scolor></scolor>
      </oidentry>
   </oidtable>
   <vendorspecific>
      <vlogofile></vlogofile>
      <vappname></vappname>
      <vappversion></vappversion>
   </vendorspecific>
</rtgraph>

Paul van Bergen

2 comments

Disabling polling box?

Submitted by PeterPan on Sat, 11/13/2010 - 22:20.

Hi,

I've tried this example on my linux boxes and it works great. There's only one minor thing left. Is it possible to disable or hide the polling box. What I mean is that a user can select a different polling interval but my linux boxes only work well with an interval > 5 seconds. The snmp counters are refreshed every 5 seconds.

Thank you

Use the <contpanvisible> tag

Submitted by Paul van Bergen on Sun, 11/14/2010 - 10:40.

Hi PeterPan,

I think that the <contpanvisible> tag (combined with a predefined polling interval in the xml config file) more or less does what you need. The <contpanvisible> tag hides "the control panel" and all controls on it, making it practically impossible to select a different interval.

For the next release of the components I've put the new tag <piboxvisible> ("Polling Interval box visibility") on the To-Do list. I think that this provides a more fine-grained configuration option for the component(s).

Paul - FineConnection

© 2000-2012 FineConnection. Drupal theme by Kiwi Themes.