[rrd-users] Re: ENC: MRTG Archiver
postmaster at gnvfc.net
postmaster at gnvfc.net
Thu Dec 25 12:46:33 MET 2003
Hi,
Archiving means by storing MRTG graphs of each router interfaces on a daily
basis.
The script given below stores .log files in 'today' folder & creates its tar
ball. Is there anyway to create graphs using these same .log files.
We want to store MRTG graphs('Daily' graph) in 'today' folder & also create
a tar ball for later use.
How do we.
rgds,
Hardik
----- Original Message -----
From: "Davi de Paula Cabral - DATAPREVRJ" <davi.cabral at previdencia.gov.br>
To: <rrd-users at list.ee.ethz.ch>
Sent: Tuesday, December 23, 2003 7:32 PM
Subject: [rrd-users] ENC: MRTG Archiver
What do you mean by "archiving"?
I made a script that runs every midnight, reading the last 24 hours data of
the RRD databases, then putting data on CSV files , zipping them and storing
in separated folders.
Everybody, feel free for criticize. The "grep" part can be not necessary if
you use dots as decimal indicator; here in brazil we use commas; and dots we
use for thousand, million and so on.
The "today" folder stores the last information, without "zipping", ready for
use.
Why starting "now - 60s" and ending "now - 86220"?
My MRTG runs every minute. I can't run script at 00:00 because at this time
is already another day, right? If I want to close a day I have to work at
this end, not at the start of the following day. so I work at 23:59.
But I have no warranty that at 23:59 the corresponding fields of RRD
databases have data. So, I extract 60 seconds and start working with 23:58
data.
And the start? Well, 24h = 86400. Each day has 24h, right? Not exactly. If
"now" is 23:58, I can't take 23:58 yesterday. I will take 00:00, that is
86400 - 120 = 86280 seconds.
But remember, I've already subtracted 60 secods, but now I subtract 86220.
See below:
--------------------------
#!/bin/sh
ennd=$(date +%s)
ennd=$(( ennd - 60 ))
starrt=$(( ennd - 86220 ))
todday=$(date +%d-%B-%Y)
path=/var/ftp/logsmrtg/$todday
original=/var/ftp/logsmrtg/today
mkdir $path
rm -f $originais/*.*
cd /var/www/html
for databases in *.rrd; do
rrdtool fetch ${databases} AVERAGE --start $starrt --end $ennd >
$path/a${databases}.log
done
for databases in *.rrd; do
grep ':' $path/a${databases}.log | sed -e 's/: / /' | sed -e 's/\./,/' | sed
-e 's/\./,/' | tac > $original/${databases}.log
done
rm -f $path/*.*
cd $original
rename .rrd.log .log *.rrd.log
unix2dos -q *.log
chmod 755 *.*
tar -cf $path/${todday}.tar .
gzip -rvq $path/${todday}.tar
chmod 755 $path/*.*
--------------------------------
I hope confusion will help.
Davi
-*-*-*-*-*-*-*-*-
-----Mensagem original-----
De: postmaster at gnvfc.net [mailto:postmaster at gnvfc.net]
Enviada em: terca-feira, 23 de dezembro de 2003 02:04
Para: rrd-users at list.ee.ethz.ch
Assunto: [rrd-users] MRTG Archiver
Hello all,
I've been trying to cofigure MRTG archiever on my RedHat linux box.
The script mrtg-archiver seems to be using the HTML file for individual
targets generated inside the WorkDir.
------------------------------------------------------
if(open(HTMLFILE, "$WorkDir/$target.html")) {
------------------------------------------------------
We r using RRD-Tool & 14all.cgi, which does not generate the HTML files in
the WorkDir. It only generates files like <target>-daily.png,
daily.s-i.png, -monthly.png, .rrd, -weekly.png, -yearly.png for each target.
In this case how do we archive our MRTG. Pl suggest.
rgds,
Hardik Pandya
GNFC Ltd.
India.
--
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
--
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
--
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