Pages: [1]   Go Down
Author Topic: CPU stats are only instaneous values... every 5 minutes!  (Read 230 times)
0 Members and 1 Guest are viewing this topic.
daggett
Sr. Member
****

Karma: 0
Offline Offline

Posts: 109


View Profile
« on: December 04, 2006, 05:44:41 PM »

the cpu_* agents are collecting values from vmstat every 5 minutes, but these are instantaneous values, they don't represent what was happening during the 5 minutes.

So maybe it can be replaced by:
cat /proc/stat | head -1 | awk '{print $N}'

where N represents the wanted field:
#2 user: normal processes executing in user mode
#3 nice: niced processes executing in user mode
#4 system: processes executing in kernel mode
#5 idle: twiddling thumbs
#6 iowait: waiting for I/O to complete
#7 irq: servicing interrupts
#8 softirq: servicing softirqs

this returns how many hundredth of a second the processor was occupied by user/total/idle... and they are counters incremented on and on.
So, there are 60*100*5 of 1/100s in 5 minutes, so the percentage is (currentValue-previousValue)/30000.

The only problem is that we CAN'T do any computation in the pandora console when defining a module... (I added this in the wish list).
But never mind, the data won't show percentage, but they'll be an image of it.
Then in Pandora console, take the value as generic_data_inc (wich does currentValue-previousValue).
« Last Edit: January 01, 1970, 01:00:00 AM by daggett » Logged

Pages: [1]   Go Up
Print
 
Jump to:  


SourceForge.net Logo  This site is monitored by Pandora FMS   ArticaST