Here is another example of using gnuplot. The first script parses
collection files and the second one plots it.
With regards,
Arnon
-----Oorspronkelijk bericht-----
Van: Mearl Danner [SMTP:jmdanner@SAMFORD.EDU]
Verzonden: maandag 6 juli 1998 17:59
Aan: NV-L@UCSBVM.UCSB.EDU
Onderwerp: Re: GnuPlot as report tools
This is the script I use. The snmp collection is
Utilization percentages for two of our 3Com switches. They
are collected every 10 minutes ( tail n -143 gives last 24
hours).
It runs as a cron job at midnight every night. The printer
is a HP5SI postscript.
The sed statements toward the bottom of each case statement
are to insert the attached device, date, and file to plot
in the script that gnuplot uses (intest.plot).
# Utilization.scr
#!/bin/sh
#
DT=`date +"%m-%d-%y"`
if [ -f /usr/OV/mearl/3000* ]
then
rm -f /usr/OV/mearl/3000*
fi
for INT in 101 102 103 104 105
do
case $INT in
101) LAB=3com2500-1 ;;
102) LAB=3Com2500-2 ;;
103) LAB=3com3000-2 ;;
104) LAB=Samnet-1 ;;
105) LAB=Server1 ;;
esac
/usr/OV/bin/snmpColDump
/usr/OV/databases/snmpCollect/SwitchUtilization.$INT\
| /usr/bin/grep 3000.sam\
| /usr/bin/tail -n 143\
| /usr/bin/awk '{ printf $2 "\t" $4 "\n" }'\
| /usr/bin/sed 's/:/ /g'\
| /usr/bin/awk '{ printf $1 "." $2/60 "\t" $4 "\n" }'\
| /usr/bin/sed 's/\.0\./\./'\
>> /usr/OV/mearl/3000-$LAB /usr/bin/sed \
's/^plot.*/plot \"\/usr\/OV\/mearl\/3000-'$LAB'\" title \"'$LAB'
'$DT'\"/' \
/usr/OV/mearl/intest.plot | /usr/local/bin/gnuplot\
> /usr/OV/mearl/$LAB.ps
/usr/bin/lpr -Pbkh318ps /usr/OV/mearl/$LAB.ps
done
for INT in 102 103 104 105 106 107 108 109 do
case $INT in
101) LAB=3com3000 ;;
102) LAB=Netview ;;
103) LAB=WWW ;;
104) LAB=Vinca-1 ;;
105) LAB=ADSM ;;
106) LAB=Brooks3 ;;
107) LAB=VM ;;
108) LAB=Netbuilder ;;
109) LAB=Samnet-Backup ;;
esac /usr/OV/bin/snmpColDump
/usr/OV/databases/snmpCollect/SwitchUtilization.$INT\
| /usr/bin/grep 3000-2.sam\
| /usr/bin/tail -n 143\
| /usr/bin/awk '{ printf $2 "\t" $4 "\n" }'\
| /usr/bin/sed 's/:/ /g'\
| /usr/bin/awk '{ printf $1 "." $2/60 "\t" $4 "\n" }'\
| /usr/bin/sed 's/\.0\./\./'\
>> /usr/OV/mearl/3000-2-$LAB /usr/bin/sed \
's/^plot.*/plot \"\/usr\/OV\/mearl\/3000-2-'$LAB'\" title
\"'$LAB' '$DT'\"/' \
/usr/OV/mearl/intest.plot | /usr/local/bin/gnuplot\
> /usr/OV/mearl/$LAB.ps
/usr/bin/lpr -Pbkh318ps /usr/OV/mearl/$LAB.ps
done
This is the gnuplot script. I set the terminal type to
postscript because of the printer. There several terminal
types available in gnuplot that output in formats that be
converted using netpbm or other utilities if you want a
different graphical output (GIF, etc.). There also several
options that will change the graphing formats. Check the
online help and man pages.
set terminal postscript landscape monochrome dashed
"Helvetica" 14 set output
set noclip points set clip one
set noclip two set border
set boxwidth set dummy x,y
set format x "%g" set format y "%g"
set format z "%g" set nogrid
set key set nolabel
set noarrow set nologscale
set offsets 0, 0, 0, 0 set nopolar
set angles radians set noparametric
set view 60, 30, 1, 1 set samples 100, 100
set isosamples 10, 10 set surface
set nocontour set clabel
set nohidden3d set cntrparam order 4
set cntrparam linear set cntrparam levels auto 5
set cntrparam points 5 set size 1,1
set data style lines set function style lines
set xzeroaxis set yzeroaxis
set tics in set ticslevel 0.5
set xtics 0,1,24 set ytics
set ztics set title "" 0,0
set notime set rrange [-0 : 10]
set trange [-5 : 5] set urange [-5 : 5]
set vrange [-5 : 5] set xlabel "Time" 0,0
set xrange [0 : 24] set ylabel "Utilization Percentage" 0,0
set zlabel "" 0,0 set zrange [-10 : 10]
set autoscale r set autoscale t
set autoscale x set autoscale y
set autoscale z set zero 1e-08
plot "" title ""
On Fri, 3 Jul 1998 13:37:44 -0500
=?iso-8859-1?B?TmVpbCBO+vFleg==?= <nnunez@ESPOL.EDU.EC>
wrote:
> I'm trying to use the gnuplot to graph the info that
snmpcollector get, but
> I can do to the gnuplot to graph well.
>
> I know that this is not group topic but if anyone could help
to graph with
> gnuplot. I format the data as gnuplot required but
> not accept time format.
>
> Please send me a demo or example of how to do this.
>
> Thanks in advanced.
>
> Neil Nu~ez
> Network Assistant
> ESPOL - Guayaquil (Ecuador)
> nnunez@espol.edu.ec
-----------------------------------------
Mearl Danner
Network Engineer
Email: jmdanner@samford.edu
Samford University
<<application/ms-tnef>>
|