NSCLIENT output
Tom DE BLENDE
tdeblend at gcc.dhl.com
Mon Oct 21 09:49:11 CEST 2002
Hi William,
I use a simple shell script to graph CPU usage in MRTG. I do the same
for lots of things by the way: memory usage, sql connections, oracle
backlog,... hell, I even graph the Warcraft III levels and scores of
me and some of my colleagues with it :-)
This is what I use for CPU load:
[root at netsaint logging]# cat cleanload.sh
#!/bin/sh
hostname=$1
uptime=`/usr/local/netsaint/libexec/check_nt -H $1 -p 1248 -v UPTIME |
cut -d: -f2`
stat=`/usr/local/netsaint/libexec/check_nt -H $1 -p 1248 -v CPULOAD -l
5,80,95,60,80,95,1440,80,95 | cut -d\% -f1 | awk '{print $5}'`
if [ "$stat" = "out" ]; then
stat=0
fi
if [ "$stat" = "" ]; then
stat=0
fi
if [ "$stat" = "seconds" ]; then
stat=0
fi
echo $stat
echo $stat
echo $uptime
echo $hostname
In mrtg.cfg this is:
### System: servername
Target[servername]:`/usr/local/netsaint/logging/cleanload.sh
servername`
MaxBytes[servername]: 100
AbsMax[servername]: 2500
Options[servername]: gauge, unknaszero, withzeroes
WithPeak[servername]: w
Title[servername]: System load stats for servername
BodyTag[servername]:<BODY BACKGROUND="" BGCOLOR="#F7FFFF">
PageTop[servername]: <H1>Load for servername</H1>
Legend1[servername]: system load average ( % )
Legend2[servername]:
Legend3[servername]: maximal 5 minute system load average (% )
Legend4[servername]:
LegendI[servername]: load
LegendO[servername]:
YLegend[servername]: loadavg (%)
ShortLegend[servername]: / 100
Hope it helps.
Kind regards,
Tom
> "Hiatt, William" wrote:
>
> Is there a way to parse the output from NSCLIENT on the CPU load
> information: CPU Load (5 min. 0) and get it to just display just the
> number?? I.E. I want to pipe this over to MRTG but have been unable
> to write a shells cript to take that 0 out and give it to me?
>
> I tried using the processor performance counter, but I would
> constantly get 99.98% back, even when the box had no load! For
> processor though, I do prefer using NSCLIETN's output
>
> Thanks
> william
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
More information about the Users
mailing list