Rép. : RE: [Nagios-users] Is there a way to check the cpu %?

Thibault Genessay tgenessay at aliadis.fr
Fri May 5 16:18:10 CEST 2006


Serveur-Faucon Surveillance wrote:
> Unfortunatly, check_load only show the load and not the cpu utilisation, the equivalent of typing "w" in shell. What I am looking for is more something like "top". See below I have copy the result of "top".
>
> load = number of tasks in the queue and running  (average)
> cpu utilisation = % of cpu in use.
>
> Here is the result of top.
> --- top ---
> 09:48:53  up 310 days, 17:31,  1 user,  load average: 0.76, 0.51, 0.52
> 65 processes: 58 sleeping, 7 running, 0 zombie, 0 stopped
> CPU0 states:  48.0% user   4.0% system    0.0% nice   0.0% iowait  46.0% idle
> CPU1 states:  48.0% user   0.1% system    0.0% nice   0.0% iowait  50.0% idle
>   
You can get this info with
top -b -n 1
Then you can awk, grep or pythonize the output to get whatever you need

However, I do not recommend this method as it is both slow and heavy in 
resources usage. Furthermore, those CPU loads are instantaneous values 
that represent only 1 second (or any delay top uses to compute those 
numbers), and thus can be aberrant regarding what the CPU has during all 
the time it was not checked for; i.e. if your check_interval is 5 
minutes you should not take a random, 1 second long sample in a 5 min 
period but an average value computed over the 5 minutes.
> You can get the first line of infos with check_load and check_uptime (contrib)
> The second with check_proc
>
> But currently I don't see any way of getter the other lines.
>   
Have a look check_snmp_load.pl and its *netsc *option for the -T 
argument (see http://www.manubulon.com/nagios/snmp_load.html)
This might be what you are looking for.

-- 
Thibault




-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list