Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SCO 5.0.5 SNMP Agent not reporting Processor Load

0 views
Skip to first unread message

Jeff Volckaert

unread,
Jun 29, 2000, 3:00:00 AM6/29/00
to
Hello Everybody,

I am using MRTG to graph CPU load via the SNMP agents on my 2
SCO servers, my Linux Server, and my AS/400. The problem is that only
one SCO box is reporting CPU load. The other reports 0 when I query
hrProcessorLoad. I've enable SAR on both and can do 'sar -u' without
trouble. I've resetup SNMP a couple of times without any luck.

Anyone else run into this or have any advice?

TIA,
Jeff Volckaert


Jeff Liebermann

unread,
Jun 29, 2000, 3:00:00 AM6/29/00
to

Duz it *REPORT* a 0 load, or does it simply graph zero as in no-response?
I'll assume the OID is correct as it's working on other machines.
Any particular MRTG version?

My guess is that you don't have hostmib installed or working.

See:
http://www.cruzio.com/~jeffl/sco/snmp_install.txt
for how to setup SNMP on SCO servers. Use:
getmany localhost public iso
to dump the whole tree and see what it's really reporting. If you get a
large block of zeros in the mib-2.25 section (hostmib), something is
broken in the VTCL hostmib pretzel.


--
Jeff Liebermann je...@comix.santa-cruz.ca.us
150 Felker St #D Santa Cruz CA 95060
831-421-6491 pager 831-429-1240 fax
http://www.cruzio.com/~jeffl/sco/ SCO stuff

Jeff Volckaert

unread,
Jun 29, 2000, 3:00:00 AM6/29/00
to
Thanks for responding. I did the getmany and get numbers all over the
place. I can do an snmpget and it reports a load of 0. My %idle is 92
under sar -u and my graph from the last 24 hours is all 0's.

TIA,
Jeff Volckaert

Jeff Liebermann

unread,
Jun 29, 2000, 3:00:00 AM6/29/00
to
On Thu, 29 Jun 2000 10:48:55 -0700, Jeff Liebermann
<je...@comix.santa-cruz.ca.us> wrote:

>On Thu, 29 Jun 2000 12:49:36 -0400, Jeff Volckaert
><JVolc...@BellMemorial.org> wrote:
>
>>I am using MRTG to graph CPU load via the SNMP agents on my 2
>>SCO servers, my Linux Server, and my AS/400. The problem is that only
>>one SCO box is reporting CPU load. The other reports 0 when I query
>>hrProcessorLoad. I've enable SAR on both and can do 'sar -u' without
>>trouble. I've resetup SNMP a couple of times without any luck.
>>
>>Anyone else run into this or have any advice?
>
>Duz it *REPORT* a 0 load, or does it simply graph zero as in no-response?
>I'll assume the OID is correct as it's working on other machines.
>Any particular MRTG version?
>
>My guess is that you don't have hostmib installed or working.
>
>See:
> http://www.cruzio.com/~jeffl/sco/snmp_install.txt
>for how to setup SNMP on SCO servers. Use:
> getmany localhost public iso
>to dump the whole tree and see what it's really reporting. If you get a
>large block of zeros in the mib-2.25 section (hostmib), something is
>broken in the VTCL hostmib pretzel.

Groan. Bad guess. I'm in my office and I just did a quick test. It
doesn't work on OSR5. hrProcessorLoad.7 does not return the 1 minute
load average as advertised in RFC1514. The OID should be:
1.3.6.1.2.1.25.3.3.1.1.7
I'll do the bug report thing later. Meanwhile I have a workaround
that will extract any value for graphing with just a simple shell
script. You can expand the method to graph just about anything that
will belch a number.

I use the following shell script, idle.sh as a starting point:
================

#!/bin/sh
# @(#) idle.sh Belch current idle percentage for mrtg graphing.
# Remember to have two output numbers on different lines.
#
# Typical output of sar -u 1
# 21:25:20 %usr %sys %wio %idle
# 21:25:21 0 4 5 92
#
# Really disgusting way to get rid of extra leading spaces
# by feeding it to a shell variable. Retch.
bletch=`sar -u 1 | tail -1`
echo $bletch | cut -d" " -f5
echo $bletch | cut -d" " -f5

================

# Local sar idle time for mrtg.cfg.
Target[idle]: `idle.sh`
Title[idle]: Sar Idle Percentage
PageTop[idle]: <H1>Sar Idle Percentage</H1>
Options[idle]: growright, gauge
MaxBytes[idle]: 100
#WithPeak[idle]: dwmy
Unscaled[idle]: dwmy
YLegend[idle]: Idle
ShortLegend[idle]: Idle

================

This works nicely on the local machine and will graph the
idle percentage. No big deal. However there are many ways
to get the same results from a remote machine.

1. rcmd
Modify the bletch= line to read:
bletch=`rcmd $1 "sar -u 1 | tail -1"`
which will run the sar -u 1 command on a remote system
passed as arguement $1. The line in the mrtg.cfg file
would read:
Target[192.168.111.1]:`idle.sh 192.168.111.1`
to get idle statistics from 192.168.111.1. This requires
some security games with hosts.equiv.


2. Telnet to an IP socket.
Edit /etc/inetd.conf and add the line:
space stream tcp nowait root /usr/bin/sar -u 1
to the bottom of the file.

Edit /etc/services and add the line:
space 9999/tcp # sar idle percentage report

Find the PID for inetd and signal it to re-read
it's configuration files with:
ps -ef | grep inetd
root 333 1 0 Aug 9 ? 0:29 ietd
kill -1 333
You will need to do this again for any other changes in
/etc/services and /etc/inetd.conf

Test with:
telnet localhost 9999
which should belch:

comix comix 3.2 2 i386 09/02/98
21:49:13 %usr %sys %wio %idle
21:49:14 0 3 0 97

=====================

A much more complex example is how to extract freemem and freeswp from
the sar output which require scaleing and a bit of math.


#!/bin/ksh
# by Jeff Liebermann 04/23/98
#
# Get sar -r paging output for MRTG
#
# Output of sar -r 1 from SCO Unix.
# SCO_SV sloth 3.2v5.0.2 Pentium 04/23/98
# 21:32:03 freemem freeswp
# 21:32:04 2990 108912
#
#
# path dev swaplo blocks free
# /dev/swap 1,41 0 120000 109056
#
# Freemem is in 4KB pages and freeswp is in 512 byte blocks.
#
# Really disgusting way to get rid of extra leading spaces
# by feeding it to a shell variable. Ugly at best.
#
# Define as variables as int. (ksh only does int)
typeset -i ram swapsize freemem freeswap
#
# Define memory and swap sizes
let ram="16 * 1024000" # ram size in bytes.
swapsize=120000 # block count from swap -l
#
retch=`sar -r 1 | tail -1` # get last line only
set $retch # break apart into fields using IFS
seperators
#
let freemem="$2 * 4096 * 100 / $ram" # convert to percent
echo $freemem # belch % freemem
#
let freeswap="$3 * 100 / $swapsize" # calculate swap percent
echo $freeswap # belch % freeswap
#

============

# Swap info from sar.
#
# Be sure to set MaxBytes to a realistic value
# based upon the number of 512byte blocks in
# the swap. This is my 60MB swap output of
# the swap -l command.
# path dev swaplo blocks free
# /dev/swap 1,41 0 120000 109056
Target[paging.4]: `sarr.sh`
Title[paging.4]: Percent FreeMem and FreeSwap
PageTop[paging.4]: <H1>Percent FreeMem and FreeSwap</H1>
Options[paging.4]: growright, gauge, nopercent
MaxBytes[paging.4]: 100
Unscaled[paging.4]: dwmy
YLegend[paging.4]: % Avail
ShortLegend[paging.4]: %
Legend1[paging.4]: Avg FreeMem Percent
Legend2[paging.4]: Avg FreeSwap Percent
LegendI[paging.4]: FreeMem
LegendO[paging.4]: FreeSwap

# Jeff Liebermann 150 Felker St #D Santa Cruz CA 95060
# 831.336.2558 voice
# 831.426.1240 fax http://www.cruzio.com/~jeffl
# 831.421.6491 digital_pager je...@comix.santa-cruz.ca.us

Jeff Volckaert

unread,
Jun 30, 2000, 3:00:00 AM6/30/00
to
Wow, thanks for the detailed reply. The funny thing is, my other 5.0.5 box
is reporting CPU load just fine. On it I use hrProcessorLoad.8 and on the
first box I use hrProcessorLoad.12. I assume the numbering is different on
each box depending on installed hardware?

Jeff Volckaert

Jeff Liebermann

unread,
Jun 30, 2000, 3:00:00 AM6/30/00
to
On Fri, 30 Jun 2000 08:13:33 -0400, Jeff Volckaert
<JVolc...@BellMemorial.org> wrote:

>Wow, thanks for the detailed reply. The funny thing is, my other 5.0.5 box
>is reporting CPU load just fine. On it I use hrProcessorLoad.8 and on the
>first box I use hrProcessorLoad.12. I assume the numbering is different on
>each box depending on installed hardware?

Dunno for sure. It shouldn't be any different unless you have a
multiprocessor (MPX) system which adds extra processors to the puzzle
under the hrProcessor branch.

It also may have been broken by one of the network related upgrades.
Run:
customquery listpatches | head -1
for a list of applied OS patches and see if they're the same. Just to
make things really weird, my MIB browser reports that it's not belching
0.00 but that it's returning a null value. The other nearby values look
correct, but ProcessorLoad is wacko. I'll dig through the VTCL hostmib
mess under /etc/sysadm.d, check other machines, and see if I can figure
out what broke.

Also, the shell script trick does work. I find it easier to extract
performance numbers from sar than from hostmib because of the wider
selection of values worth graphing. Graphs of cache efficiency and
freemem have been quite useful. However, for network traffic monitoring,
SNMP has much more detail.


--
Jeff Liebermann je...@comix.santa-cruz.ca.us


150 Felker St #D Santa Cruz CA 95060

Christian Hernoux

unread,
Jul 3, 2000, 3:00:00 AM7/3/00
to
I have the same Pb on my French box SCO.
Our idea with telnet command is fun, It's work very well !

Christian


"Jeff Liebermann" <je...@comix.santa-cruz.ca.us> a écrit dans le message
news: jb0ols4ttk56ue3pl...@4ax.com...

Jeff Volckaert

unread,
Jul 3, 2000, 3:00:00 AM7/3/00
to
I had to reboot today since my server locked up, and now it doesn't even report
CPU load at all. This is on the machine that was reporting fine. When I walk
the tree it's not even an option.

Jeff

Jeff Volckaert

unread,
Jul 3, 2000, 3:00:00 AM7/3/00
to
Opps, spoke too soon. It's wokring now. Must have taken a while to populate the
values.

Here are the versions i'm using...

SCO box reporting fine...
# customquery listpatches | head -1
SCO:Unix::5.0.5Eb rs505a.Unix505.1.0a oss600a.Unix505

SCO box reporting 0
# customquery listpatches | head -1
SCO:Unix::5.0.2Dp OSS449F.Unix504.0.1.a sls436.Unix500.3.6.a sls438a.500.a
sls452.502.7.1a oss456b oss468a.Unix502.1.0.a oss496a.Unix502.1.0a
oss601a.Unix502

Jeff

Jeff Liebermann

unread,
Jul 3, 2000, 3:00:00 AM7/3/00
to
On Mon, 3 Jul 2000 09:17:25 +0200, "Christian Hernoux"
<cn...@normandnet.fr> wrote:

>I have the same Pb on my French box SCO.
>Our idea with telnet command is fun, It's work very well !
>Christian

Be careful with adding additional "services". If you accidentally add
a shell command, or a command with a shell escape (i.e. more), you
have created a security hole that can give shell command access to
your machine. Also, do not add a service to a command that does not
exit. Since the socket is opened only for output, there is no way to
sent it a signal to close or exit.

One handy trick for adding a service is to use it to detect port
scans. For example when port 666 (doom) is opened, it adds a log
entry that includes whatever info I can grab before the attacker
disconnects.

Rant: I'll work on the SNMP problem later in the week. Too many of
my customers dumped off their broken Windoze boxes and disappeared for
July 4 vacation. I get to work instead and have everything ready by
July 5. Meanwhile, the one and only RAID array that I don't have a
spare drive handy decided to blow a drive. So much for vacation.


--

Jeff Liebermann 150 Felker St #D Santa Cruz CA 95060

(831)421-6491 pgr (831)426-1240 fax (831)336-2558 home
http://www.cruzio.com/~jeffl WB6SSY
je...@comix.santa-cruz.ca.us je...@cruzio.com

Christian Hernoux

unread,
Jul 5, 2000, 3:00:00 AM7/5/00
to
One problem, when I want to 'telnet' by MRTG, the script didn't stop !!!
I run the command with ksh it's OK
>/ telnet SBD 9999 | tail -1
Connection closed by foreign host.
10:39:43 0 0 0 100
>/

Any idea ?

#!/bin/ksh
#
# SNMPspace.sh
#

# Never return, Telnet din't stopped !!!!
#SNMPvalues=`/usr/bin/telnet SBD 9999 | /bin/tail -1`

# Run well on localhost
SNMPvalues=`sar -u 1 | tail -1`

disk=`print $SNMPvalues | cut -d" " -f4`
idle=`print $SNMPvalues | cut -d" " -f5`
cpu=`expr 100 - $idle`
days=`uptime | cut -d" " -f5,6 | sed s/,//`

print $disk
print $cpu
print $days
print $machine


MRTG.cfg file
===========
Background[sbd.systemIdle]: #FFFFE0
WithPeak[sbd.systemIdle]: dwmy
Options[sbd.systemIdle]: gauge
Target[sbd.systemIdle]: `/usr/local/mrtg-2.8.12/run/SNMPspace.sh`
MaxBytes1[sbd.systemIdle]: 100
MaxBytes2[sbd.systemIdle]: 100
Title[sbd.systemIdle]: SERVEUR SCO SBD
Unscaled[sbd.systemIdle]: dwmy
YLegend[sbd.systemIdle]: % Utilisation
ShortLegend[sbd.systemIdle]: util.
Legend1[sbd.systemIdle]: Processeur
Legend2[sbd.systemIdle]: Disque
LegendI[sbd.systemIdle]: &nbsp;Processeur:
LegendO[sbd.systemIdle]: &nbsp;Disque:
PageTop[sbd.systemIdle]: <H1 ALIGN=CENTER STYLE="background-color:
ivory;border-style:solid; border-color:darkblue"><FONT FACE="Arial Black"
SIZE="5">Utilisation du processeur et du disque sur le serveur SBD
</FONT></H1>
<CENTER><TABLE BORDER=2 BORDERCOLOR="red" BGCOLOR="ivory">
<TR><TD><B>Entit\351</B></TD><TD><B>Serveur SCO SBD</B></TD></TR>
<TR><TD><B>ADRESSE IP</B></TD><TD><B>55.149.12.158</B></TD></TR>
<TR><TD><B>LOCALISATION</B></TD><TD><B>Salle serveur
4<SUP>\350me</S
UP> \351tage</B></TD></TR>
<TR><TD><B>% Utilisation du processeur</B></TD></TR>
<TR><TD><B>% Utilisation du disque</B></TD></TR>
</TABLE>


Christian Hernoux

unread,
Jul 5, 2000, 3:00:00 AM7/5/00
to
If I do #/ telnet SBD 9999 &, I got

[6] 13569
# Trying 127.0.0.1...
Connected to sbd.cpam-rouen.cnamts.fr.
Escape character is '^]'.

and never return !

Jeff Liebermann

unread,
Jul 6, 2000, 3:00:00 AM7/6/00
to
On Wed, 5 Jul 2000 10:43:14 +0200, "Christian Hernoux"
<cn...@normandnet.fr> wrote:

>One problem, when I want to 'telnet' by MRTG, the script didn't stop !!!
>I run the command with ksh it's OK

It should work. I've only used the telnet and MRTG trick once and don't
recall if there were any tricks. I will not have time to do much playing
until Monday (overwork and weekend RAID rebuild). You may want to
experiment with tricking telnet into exiting with:
SNMPvalues=`/usr/bin/telnet SBD 9999 < exitfile | /bin/tail -1`
where exitfile contains a ctrl-], quit, and ctrl-M. I don't have a Unix
box in front of me to try it right now.

Meanwhile, I suggest using rcmd instead. Modifying your posting.
(Thanks for fixing the missing 2 lines in the output. I forgot).

You will need to deal with /.rhosts and possibly /etc/hosts.equiv to
allow rcmd to run on the romote host. This has some serious security
implications so be careful. I use this for machines behind a firewall,
but would never consider using it for machines that traverse the
internet.

If the target machine is an SCO box, then consider using the "asroot"
command to allow UID=mrtguser to run specific commands. This would
change the command line to something like:
SNMPvalues=`su -c mrtguser rcmd $1 "sar -u 1 | tail -1"`
so that the sar command is executed as UID=mrtguser instead of root.

#!/bin/ksh
#
# SNMPspace.sh
#

# Run well on localhost

SNMPvalues=`rcmd $1 "sar -u 1 | tail -1"`


disk=`print $SNMPvalues | cut -d" " -f4`
idle=`print $SNMPvalues | cut -d" " -f5`
cpu=`expr 100 - $idle`
days=`uptime | cut -d" " -f5,6 | sed s/,//`
print $disk
print $cpu
print $days
print $machine


MRTG.cfg file where xxxxx is the IP address of the target machine.


===========
Background[sbd.systemIdle]: #FFFFE0
WithPeak[sbd.systemIdle]: dwmy
Options[sbd.systemIdle]: gauge

Target[sbd.systemIdle]: `/usr/local/mrtg-2.8.12/run/SNMPspace.sh xxxxx`


MaxBytes1[sbd.systemIdle]: 100
MaxBytes2[sbd.systemIdle]: 100
Title[sbd.systemIdle]: SERVEUR SCO SBD

(...)


--
Jeff Liebermann je...@comix.santa-cruz.ca.us


150 Felker St #D Santa Cruz CA 95060

0 new messages