CPU stats again with solution

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

Moderators: Developers, Moderators

Post Reply
Stephan
Posts: 6
Joined: Fri Mar 14, 2003 2:20 am

CPU stats again with solution

Post by Stephan »

Hi all,

at last I found a way to display the CPU-usage independent of the number of the installed CPU's.

Using another OID additionaly to the three already there in cacti:

.1.3.6.1.4.1.2021.11.50.0 (User)
.1.3.6.1.4.1.2021.11.51.0 (Nice)
.1.3.6.1.4.1.2021.11.52.0 (System)
.1.3.6.1.4.1.2021.11.53.0 (Idle - new)

These OID's exist in the ucd-snmp-MIB for linux. Under solaris they do not exist.

ToDo:

- Edit the DataTemplates for : ucd/net - CPU Usage - (System|User|Nice). Set the Maximum Value to 10000

- Add another DataTemplate (duplicate System) for Idle and use the OID above

- Add a CDEF:

Item #1 Special Data Source: CURRENT_DATA_SOURCE
Item #2 Special Data Source: ALL_DATA_SOURCES_NODUPS
Item #3 Operator: /
Item #4 Custom String: 100
Item #5 Operator: *

- In the GraphTemplate: delete the Line-definition and add the Idle-Datasource. It should look like that:

Item # 1 (cpu_system): System AREA AVERAGE
Item # 2 (cpu_system): Current: GPRINT LAST
Item # 3 (cpu_system): Average: GPRINT AVERAGE Item # 4 (cpu_system): Maximum:<HR> GPRINT MAX Item # 5 (cpu_user): User STACK AVERAGE Item # 6 (cpu_user): Current: GPRINT LAST
Item # 7 (cpu_user): Average: GPRINT AVERAGE Item # 8 (cpu_user): Maximum:<HR> GPRINT MAX Item # 9 (cpu_nice): Nice STACK AVERAGE
Item # 10 (cpu_nice): Current: GPRINT LAST
Item # 11 (cpu_nice): Average: GPRINT AVERAGE Item # 12 (cpu_nice): Maximum:<HR> GPRINT MAX Item # 13 (cpu_idle): Idle STACK AVERAGE Item # 14 (cpu_idle): Current: GPRINT LAST
Item # 15 (cpu_idle): Average: GPRINT AVERAGE Item # 16 (cpu_idle): Maximum: GPRINT MAX

Idle CPU Data Spurce
Nice CPU Data Source
System CPU Data Source
User CPU Data Source

- Set in every GraphTemplateItem the CDEF-Function you have defined before.

Hope it helps somebody

I can supply screenshots if necessary!

by
Stephan
dude4you
Posts: 15
Joined: Wed Nov 19, 2003 5:11 pm

Post by dude4you »

cmd.php

snmp: 127.0.0.1:161, dsname: cpu_system, oid: .1.3.6.1.4.1.2021.11.52.0, value: No Such Object available on this agent at this OID

why is that?
le-stratege
Posts: 9
Joined: Fri Sep 05, 2003 1:04 pm

Post by le-stratege »

what daemon you use for snmp ?
dude4you
Posts: 15
Joined: Wed Nov 19, 2003 5:11 pm

Post by dude4you »

I tried this on my laptop and it works better:

LPME:/var/www/php/cacti# snmpd -v

NET-SNMP version: 5.0.7
Web: http://www.net-snmp.org/
Email: net-snmp-coders@lists.sourceforge.net

In about 2 weeks I will be at work again and I check what version didn't work there.
I guess it s 5.0.8 and its Redhat 9.


BUT NOW when I exeute cmd.php I just don't get a result back:
snmp: 127.0.0.1:161, dsname: cpu_nice, oid: .1.3.6.1.4.1.2021.11.51.0, value:
snmp: 127.0.0.1:161, dsname: cpu_system, oid: .1.3.6.1.4.1.2021.11.52.0,
value:
snmp: 127.0.0.1:161, dsname: cpu_user, oid: .1.3.6.1.4.1.2021.11.50.0, value:
snmp: 127.0.0.1:161, dsname: cpu_idle, oid: .1.3.6.1.4.1.2021.11.53.0, value:

update /var/www/php/cacti/rra/localhost_cpu_nice_10.rrd --template cpu_nice N:U
update /var/www/php/cacti/rra/localhost_cpu_system_11.rrd --template cpu_system N:U
update /var/www/php/cacti/rra/localhost_cpu_user_12.rrd --template cpu_user N:U
update /var/www/php/cacti/rra/localhost_cpu_idle_13.rrd --template cpu_idle N:U

Why that?

PS: Localhost (127.0.0.1) SNMP Information
System: LINUX:LPME:2.4.23:#2:SMP:FRI:DEC:19:17:44:04:CET:2003:I686
Uptime: Timeticks: (945090) 2:37:30.90
Hostname: LPME
Guest

Post by Guest »

Hello Stephan,

I´ve followed your instructions but my results look very strange. Maybe you can figure out my error. Please have a look at my screenshot attached.

Thank you in advice!

Ingo
Attachments
ucd/net - CPU Usage
ucd/net - CPU Usage
CPU.jpg (59.32 KiB) Viewed 4113 times
Guest

Post by Guest »

I had trouble with this as well. The changes that were necessary for me were:

1) Instead of 10000, I needed a max limit of 0. Some of the SNMP returned results are greater then 10^9!.
2) In the data templates, you must specify Data Source Type of GAUGE for all the "ucd/net - CPU Usage*" templates.

With those changes it works great! Thanks for posting the instructions!
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests