[rrd-users] Re: my solution: distributed rrd files
krd-rrd-users at roka.net
krd-rrd-users at roka.net
Wed Jun 6 12:41:54 MEST 2001
On Fri, Jun 01, 2001 at 08:44:45AM +0200, Patrick Ammann wrote:
> as i'm also interested in doing the same as you want to do i would ask if
> it is possible that you post the whole cgi script.
> i'm pretty sure that also other rrd users would use it
Here we go, even if I don't think this is useful.
(Perhaps some details might be an idea to anyone.)
Please note that this is not build by hand but by a perl script (which is
highly customized for our network environment and is useless for you.)
#!/bin/bash
mkdir -p /data2/router1
scp -p -q -B user at linux1:/data/router1/P4-1.rrd /data2/router1/
mkdir -p /data2/router2
scp -p -q -B user at linux2:/data/router2/P4-0.rrd /data2/router2/
/usr/bin/rrdcgi - <<EOF
<HTML>
<HEAD><TITLE>Traffic Monitor Overview</TITLE></HEAD>
<BODY>
<H1>Traffic Monitor Overview</H1>
<TABLE>
<TR>
<TD><P>
<RRD::GOODFOR 300>
<RRD::GRAPH -a PNG /docs/rrd/zzz/router1_P4-1_60h.png --lazy
--alt-autoscale-max
-s '-60h' -w '495' -t 'router1 POS4/1' --imginfo '<A HREF=https://linux1.mcbone.net/cgi-bin/rrd/router1/P4-1><IMG BORDER=0 SRC='/rrd/zzz'/%s WIDTH=%lu HEIGHT=%lu></A>'
DEF:inoctets=/data2/router1/P4-1.rrd:input:AVERAGE
DEF:outoctets=/data2/router1/P4-1.rrd:output:AVERAGE
CDEF:inbits=inoctets,8,* CDEF:outbits=outoctets,8,*
CDEF:inpct=inbits,1550000,/
CDEF:outpct=outbits,1550000,/
CDEF:innorm=inpct,UN,inbits,inpct,60,GT,93000000,inbits,IF,IF
CDEF:inwarn=inpct,UN,inbits,inpct,60,GT,inpct,80,GT,124000000,93000000,-,inbits,93000000,-,IF,0,IF,IF
CDEF:inaler=inpct,UN,inbits,inpct,60,GT,inpct,80,GT,inbits,124000000,-,0,IF,0,IF,IF
HRULE:155000000#FF0000:
CDEF:outnorm=outpct,UN,outbits,outbits,IF
CDEF:outwarn=outpct,UN,outbits,outpct,60,GT,outbits,UNKN,IF,IF
CDEF:outaler=outpct,UN,outbits,outpct,80,GT,outbits,UNKN,IF,IF
AREA:innorm#00FF00:","
STACK:inwarn#FFFF00:","
STACK:inaler#FF0000:"In traffic ;"
LINE2:outnorm#0000FF:","
LINE2:outwarn#FF00FF:","
LINE2:outaler#000000:"Out traffic\l"
COMMENT:"<RRD::TIME::NOW %c>\r"
GPRINT:inbits:LAST:"Current In\: %6.2lf %s" GPRINT:inpct:LAST:" %4.1lf %%"
GPRINT:outbits:LAST:"Current Out\: %6.2lf %s" GPRINT:outpct:LAST:" %4.1lf %%\r"
GPRINT:inbits:AVERAGE:"Average In\: %6.2lf %s" GPRINT:inpct:AVERAGE:" %4.1lf %%"
GPRINT:outbits:AVERAGE:"Average Out\: %6.2lf %s" GPRINT:outpct:AVERAGE:" %4.1lf %%\r"
GPRINT:inbits:MAX:" Peak In\: %6.2lf %s" GPRINT:inpct:MAX:" %4.1lf %%"
GPRINT:outbits:MAX:" Peak Out\: %6.2lf %s" GPRINT:outpct:MAX:" %4.1lf %%\r">
</P></TD>
</TR>
<TR>
<TD><P>
<RRD::GOODFOR 300>
<RRD::GRAPH -a PNG /docs/rrd/zzz/router2_P4-0_60h.png --lazy
--alt-autoscale-max
-s '-60h' -w '495' -t 'router2 POS4/0' --imginfo '<A HREF=https://linux2.mcbone.net/cgi-bin/rrd/router2/P4-0><IMG BORDER=0 SRC='/rrd/zzz'/%s WIDTH=%lu HEIGHT=%lu></A>'
DEF:inoctets=/data2/router2/P4-0.rrd:input:AVERAGE
DEF:outoctets=/data2/router2/P4-0.rrd:output:AVERAGE
CDEF:inbits=inoctets,8,* CDEF:outbits=outoctets,8,*
CDEF:inpct=inbits,1550000,/
CDEF:outpct=outbits,1550000,/
CDEF:innorm=inpct,UN,inbits,inpct,60,GT,93000000,inbits,IF,IF
CDEF:inwarn=inpct,UN,inbits,inpct,60,GT,inpct,80,GT,124000000,93000000,-,inbits,93000000,-,IF,0,IF,IF
CDEF:inaler=inpct,UN,inbits,inpct,60,GT,inpct,80,GT,inbits,124000000,-,0,IF,0,IF,IF
HRULE:155000000#FF0000:
CDEF:outnorm=outpct,UN,outbits,outbits,IF
CDEF:outwarn=outpct,UN,outbits,outpct,60,GT,outbits,UNKN,IF,IF
CDEF:outaler=outpct,UN,outbits,outpct,80,GT,outbits,UNKN,IF,IF
AREA:innorm#00FF00:","
STACK:inwarn#FFFF00:","
STACK:inaler#FF0000:"In traffic ;"
LINE2:outnorm#0000FF:","
LINE2:outwarn#FF00FF:","
LINE2:outaler#000000:"Out traffic\l"
COMMENT:"<RRD::TIME::NOW %c>\r"
GPRINT:inbits:LAST:"Current In\: %6.2lf %s" GPRINT:inpct:LAST:" %4.1lf %%"
GPRINT:outbits:LAST:"Current Out\: %6.2lf %s" GPRINT:outpct:LAST:" %4.1lf %%\r"
GPRINT:inbits:AVERAGE:"Average In\: %6.2lf %s" GPRINT:inpct:AVERAGE:" %4.1lf %%"
GPRINT:outbits:AVERAGE:"Average Out\: %6.2lf %s" GPRINT:outpct:AVERAGE:" %4.1lf %%\r"
GPRINT:inbits:MAX:" Peak In\: %6.2lf %s" GPRINT:inpct:MAX:" %4.1lf %%"
GPRINT:outbits:MAX:" Peak Out\: %6.2lf %s" GPRINT:outpct:MAX:" %4.1lf %%\r">
</P></TD>
</TR>
</TABLE>
<HR><BR>
<RRD::GOODFOR 300>
<RRD::GRAPH -a PNG /docs/rrd/zzz/sum_60h.png --lazy
--alt-autoscale-max
-s '-60h' -e '-10min' -w '693' -t 'Sum' --imginfo '<IMG BORDER=0 SRC='/rrd/zzz'/%s WIDTH=%lu HEIGHT=%lu>'
DEF:inpadda=/data2/router1/P4-1.rrd:input:AVERAGE
DEF:outpadda=/data2/router1/P4-1.rrd:output:AVERAGE
CDEF:inpadda2=inpadda,UN,0,inpadda,IF
CDEF:outpadda2=outpadda,UN,0,outpadda,IF
DEF:inpaddb=/data2/router2/P4-0.rrd:input:AVERAGE
DEF:outpaddb=/data2/router2/P4-0.rrd:output:AVERAGE
CDEF:inpaddb2=inpaddb,UN,0,inpaddb,IF
CDEF:outpaddb2=outpaddb,UN,0,outpaddb,IF
CDEF:inoctets=inpadda2,inpaddb2,+
CDEF:outoctets=outpadda2,outpaddb2,+
CDEF:inbits=inoctets,8,* CDEF:outbits=outoctets,8,*
AREA:inbits#00FF00:" In traffic"
LINE2:outbits#0000FF:"Out traffic\l"
COMMENT:"<RRD::TIME::NOW %c>\r"
GPRINT:inbits:LAST:"Current In\: %6.2lf %s"
GPRINT:outbits:LAST:"Current Out\: %6.2lf %s\r"
GPRINT:inbits:AVERAGE:"Average In\: %6.2lf %s"
GPRINT:outbits:AVERAGE:"Average Out\: %6.2lf %s\r"
GPRINT:inbits:MAX:" Peak In\: %6.2lf %s"
GPRINT:outbits:MAX:" Peak Out\: %6.2lf %s\r">
</BODY>
</HTML>
EOF
> >On Wed, May 30, 2001 at 03:10:13PM +0200, rrd-users at gulu.net wrote:
> > > I have several machines collecting different rrd data.
> > >
> > > [...]
> >
> >Thanks to everyone who answered my question.
> >
> >As always, shortly after posting to the list my solution became obvious.
> >I already did create cgi files for my index pages who called rrdcgi,
> >so I just had to put some more code there:
> >
> >$ cat old
> >#!/usr/bin/rrdcgi
> >[...]
> >$ cat new
> >#!/bin/bash
> >mkdir -p /data2/router1
> >scp -p -q -B user at host1:/data/router1/{P10-1.rrd,G9-0.rrd,A4-2.rrd} \
> > /data2/router1/
> >/usr/bin/rrdcgi - <<EOF
> >[...]
> >EOF
> >$
> >
> >So this works fine, fast and smooth, please take my question as never asked.
> >
> >Tobi: Please forget my feature request. ;)
> >
> >Thanks again to all people who answered!
krd.
--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive http://www.ee.ethz.ch/~slist/rrd-users
WebAdmin http://www.ee.ethz.ch/~slist/lsg2.cgi
More information about the rrd-users
mailing list