Re: Implementing hrProcessorLoad

marktom@caliper.netlabs.com Thu, 22 September 1994 00:54 UTC

Received: from ietf.nri.reston.va.us by IETF.CNRI.Reston.VA.US id aa11040; 21 Sep 94 20:54 EDT
Received: from CNRI.Reston.VA.US by IETF.CNRI.Reston.VA.US id aa11036; 21 Sep 94 20:54 EDT
Received: from PO2.ANDREW.CMU.EDU by CNRI.Reston.VA.US id aa22578; 21 Sep 94 20:54 EDT
Received: (from postman@localhost) by po2.andrew.cmu.edu (8.6.9/8.6.9) id NAA21220; Wed, 21 Sep 1994 13:51:01 -0400
Received: via switchmail for hostmib+@andrew.cmu.edu; Wed, 21 Sep 1994 13:50:59 -0400 (EDT)
Received: from po3.andrew.cmu.edu via qmail ID </afs/andrew.cmu.edu/service/mailqs/q000/QF.ciU75aC00UdbIa1E5x>; Wed, 21 Sep 1994 13:46:19 -0400 (EDT)
Received: from netlabs.com (vaccine.netlabs.com [192.94.48.47]) by po3.andrew.cmu.edu (8.6.9/8.6.9) with SMTP id NAA09698 for <hostmib@andrew.cmu.edu>; Wed, 21 Sep 1994 13:45:59 -0400
Sender: ietf-archive-request@IETF.CNRI.Reston.VA.US
From: marktom@caliper.netlabs.com
Received: from caliper (caliper.netlabs.com) by netlabs.com (4.1/SMI-4.1) id AA04983; Wed, 21 Sep 94 10:44:14 PDT
Received: from Localhost by caliper (4.1/SMI-4.1) id AA15318; Wed, 21 Sep 94 10:46:52 PDT
Message-Id: <9409211746.AA15318@caliper>
To: GBEST01 <GBEST01@isdlink1.ess.harris.com>
Cc: hostmib@andrew.cmu.edu
Subject: Re: Implementing hrProcessorLoad
In-Reply-To: Your message of "Tue, 20 Sep 94 09:52:22 EST." <9408207800.AA780080154@isdlink1.ess.harris.com>
Date: Wed, 21 Sep 1994 10:46:52 -0700

Hi George,

>     
>     If any of the RFC 1514 authors or contributors are listening, could 
>     you please describe the implementation approaches that came to mind 
>     when defining this object?
>     

A cheap and dirty way (at least on SunOS4, SunOS5, HP A.09.x, and 
AIX 3.x) is to use a system utility like `iostat' or `vmstat' and 
parse the output. Both `iostat' and `vmstat' support an interval 
option. To get the average CPU usage over the last minute, just
use a pipe and invoke the utility with an interval of 60 seconds.
You should get something back over the pipe every 60 seconds or so.
For sun4m machines I would probably use `mpstat' so that I would get 
the cpu usage for each cpu.

*NOTE* Accessing the kernal and the /dev/kmem file directly offers 
       better performance, given that there is less overhead.
       The iostat/vmstat will occur the cost of two additional processes
       (e.g., one for the iostat/vmstat call and one for the shell)
       plus context switches.  It can be worst if you use awk/grep/sed
       to parse the output.
       
>
>     Has anyone implemented this object on a UNIX platform without having  
>     to wait an entire minute (blocked) while the average is computed?
>     

This would not be a problem if you added the pipe to the same `select' call
you are using for the incoming SNMP port.

By the way, 

marktom

-------
Mark Tom <marktom@netlabs.com>
NetLabs, Incorporated
4920 El Camino Real
Los Altos, CA 94022
(415) 961-9500 (work)/(415) 961-9300 (fax)