Struggling to get CPU loads sampled

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Developers, Moderators

Post Reply
sgtrock
Posts: 9
Joined: Fri Feb 08, 2008 5:21 pm

Struggling to get CPU loads sampled

Post by sgtrock »

Let me preface this by saying that I'm NOT interested in tracking nice/user/system load right now, so please don't refer me to the various threads that talk about that. I've looked through them and I've even gotten one graph up that works OK until my system comes under a very heavy load.

Also, I'm not new to SNMP in general. I've used SNMP gathering tools of various sorts for years. However, I have very little experience with cacti. I'm clearly screwing something up but I don't have a clue as to what it might be.

All I want to record is the total utilization per CPU. Therefore, I'm trying to figure out how to grab hrProcessorLoad for each CPU. snmpwalk against net-snmp gives me the following:
jim@llama ~ $ snmpwalk -c public -v 1 localhost .1.3.6.1.2.1.25.3.3.1.2
HOST-RESOURCES-MIB::hrProcessorLoad.768 = INTEGER: 4
HOST-RESOURCES-MIB::hrProcessorLoad.769 = INTEGER: 3
HOST-RESOURCES-MIB::hrProcessorLoad.770 = INTEGER: 1
HOST-RESOURCES-MIB::hrProcessorLoad.771 = INTEGER: 1
jim@llama ~ $
Great! Now I know how to grab the value as either an index or instance. I know from reading the HOST-RESOURCES-MIB docs that the values displayed are the loads for each CPU expressed as a percentage. I think I created a valid import file:

Code: Select all

<query>
   <name>Get SNMP Per CPU Utilization</name>
   <description>Queries a host for a list of monitorable CPUs</description>

   <oid_index>.1.3.6.1.2.1.25.3.3.1.2</oid_index>
   <oid_index_parse>OID/REGEXP:.*\.([0-9]{1,3}\.[0-9]{1,3})$</oid_index_parse>
   <oid_num_indexes>.1.3.6.1.2.1.25.3.2.1.1</oid_num_indexes>
   <index_order>HOST-RESOURCES-MIB::hrDeviceID</index_order>

   <index_order_type>numeric</index_order_type>
   <index_title_format>|chosen_order_field|</index_title_format>

   <fields>
      <ifIndex>

         <name>Index</name>
         <method>walk</method>
         <source>value</source>
         <direction>input</direction>

         <oid>.1.3.6.1.2.1.25.3.3.1.2</oid>
      </ifIndex>
   </fields>
</query>
However, to date I've been almost completely unsuccessful in getting this to work within cacti. The only success that I've had to date was one time I got one poll sample to graph for one instance. Unfortunately, all polls after that showed NAN, which tells me that I've got something very basic wrong.

I'm at a loss as how to proceed. I've gone around and around with defining Data Sources, Graph Templates, New Graphs, Graph Management, SNMP Cache Items, Poller Cache until I'm so dizzy I don't know which way is up. I do know that the SNMP Cache Items doesn't show the OID that I'm trying to query. However, I can't figure out how to tell why that is.

How do I verify whether or not I'm getting the data collected? How do I verify that the cacti engine is reading the data correctly? Where do I start?

Thanks in advance for any and all help that you can provide. I am one poor, confused newb!
User avatar
fmangeant
Cacti Guru User
Posts: 2345
Joined: Fri Sep 19, 2003 8:36 am
Location: Sophia-Antipolis, France
Contact:

Post by fmangeant »

Hi

can you run that :

Code: Select all

$ snmpwalk -c public -v 1 localhost -On .1.3.6.1.2.1.25.3.3.1.2
[size=84]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]
sgtrock
Posts: 9
Joined: Fri Feb 08, 2008 5:21 pm

Post by sgtrock »

Sure, no problem:
jim@llama ~ $ snmpwalk -c public -v 1 localhost -On .1.3.6.1.2.1.25.3.3.1.2
.1.3.6.1.2.1.25.3.3.1.2.768 = INTEGER: 6
.1.3.6.1.2.1.25.3.3.1.2.769 = INTEGER: 1
.1.3.6.1.2.1.25.3.3.1.2.770 = INTEGER: 3
.1.3.6.1.2.1.25.3.3.1.2.771 = INTEGER: 1
jim@llama ~ $
BTW, this is an Gentoo Linux (stable version) server that's kept fully up to date with the exception of the kernel (currently at 2.6.22). net-snmp is version 5.4.1. Physically, it's a dual 2.4 Ghz Xeon with HyperThreading enabled. I'm arranging to have HT disabled in the BIOS soon. uname -a shows:
Linux llama 2.6.22-gentoo-r9 #7 SMP PREEMPT Wed Feb 13 22:38:21 CST 2008 i686 Intel(R) XEON(TM) CPU 2.40GHz GenuineIntel GNU/Linux
Any thoughts?

Thanks for your help!
User avatar
fmangeant
Cacti Guru User
Posts: 2345
Joined: Fri Sep 19, 2003 8:36 am
Location: Sophia-Antipolis, France
Contact:

Post by fmangeant »

Can you add 4 data sources using the "SNMP Generic OID" data template (one for each OID), then use the "SNMP Generic OID" graph template ?

Final part would be to use the Aggregate plugin to make a single graph.
[size=84]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]
sgtrock
Posts: 9
Joined: Fri Feb 08, 2008 5:21 pm

Post by sgtrock »

I'll give that a shot. :)
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests