On Fri, Jan 12, 2001 at 09:40:45AM +0800, [EMAIL PROTECTED] wrote: > Hi Brian, > > Yes we can also find the load average at /etc/snmpd/snmpd.conf. > As you said, we'd like to get the CPU usage in % (1-100%) for user, > system, idle, as we seen from the 'top' command. Is it the per-second > CPU usage you mentioned?
You can not get those values from snmpd, as it has no way of fetching them from the kernel. > We'd like to use the value in MRTG report. If we can't get it from SNMP, > perhaps we better goto to write a script to get it from somewhere else > (proc filesystem?). :( Again, as I said, You can -not- get that from the kernel. The ONLY way to do it is to read /proc/stat, sleep for a while, then read it again. But that is only "cpu usage for the period I was sleeping". Are you willing to sleep for 5 minutes to find the average cpu over the last 5 minutes? Willing to make your snmpd do that? And, of course, willing to rewrite your snmp client to know that querying that value -will- take several seconds (or 5 minutes?) to calculate and that it should not assume the UDP packet was lost and retransmit it.... Oh, and a way to distinguish between "this query will take a while" and "this query must have been lost" The kernel has -no- "how busy was I in the last <interval> period". You can't query a value that doesn't exist. You -will- have to sleep for whatever interval you want to collect statistics for, and that sleep is not likely to work with a UDP based protocol like SNMP, which assumes a timeout means a packet was lost on the network. -- CueCat decoder .signature by Larry Wall: #!/usr/bin/perl -n printf "Serial: %s Type: %s Code: %s\n", map { tr/a-zA-Z0-9+-/ -_/; $_ = unpack 'u', chr(32 + length()*3/4) . $_; s/\0+$//; $_ ^= "C" x length; } /\.([^.]+)/g;