BackupPC-users

Re: [BackupPC-users] Creating reports: backup duration, file size, etc.

2010-05-17 02:41:43
Subject: Re: [BackupPC-users] Creating reports: backup duration, file size, etc.
From: "Boniforti Flavio" <flavio AT piramide DOT ch>
To: "General list for user discussion, questions and support" <backuppc-users AT lists.sourceforge DOT net>
Date: Mon, 17 May 2010 08:39:33 +0200
Hallo Matthias,

> Hi Flavio,
> 
> Late, but hopefully not too late. My response :-) Do you know 
> the __TOPDIR__/pc/<host>/backups file?
> It contains all the values you described above.

Any kind of constructive reply to this thread won't ever be "too late"
;-)
Yes, I already know of the file you mention: I'm actually using it to
get the data I mentioned in my first post:

endTime - startTime (my backup duration)
nFiles (number of files for each backup session)
size (total file size)

> I am interested at the measurement with iptables. Would you post it?

Of course. Just consider that I'm using ssh tunnels, that's why you see
port 22.
Here we go:

iptables -A INPUT -s remote.host.com/32 -d 172.16.16.222/32 -p tcp -m
tcp --sport 22
iptables -A OUTPUT -s 172.16.16.222/32 -d remote.host.com -p tcp -m tcp
--dport 22

With above lines, I'm catching the bytes being transferred between one
of the remote hosts I'm backing up and the NIC of my Debian server.
Simple and easy.
Furthermore, I'm using following script to zero the counters and save
the bytes in a txt file:

#!/bin/sh
YEAR_MONTH=`date +%Y-%m`
WWW=/var/www/reports
YEAR=`date +%Y`
MONTH=`date +%m`
#IERI=`date --date='1 day ago' '+%Y-%m-%d'`
TODAY=`date +%Y-%m-%d`
IPT=/sbin/iptables
# CLIENTI.TXT is a file containing a list of IPs, corresponding to the
remote hosts
for i in $(cat CLIENTI.TXT)
do
        $IPT -L -nv --exact | grep $i | awk '{print $2}' | tr '\n' '\t'
>> /tmp/$TODAY-$i.txt
        echo "\r" >> /tmp/$TODAY-$i.txt
        cat /tmp/$TODAY-$i.txt | sed "s/^/`date --date='1 day ago'
'+%Y-%m-%d'`\t/" >> $WWW/$YEAR/$MONTH/$i.dat
        cat /tmp/$TODAY-$i.txt | sed "s/^/`date '+%Y-%m-%d'`\t/" >>
$ANNO_MESE-$i.dat
        rm /tmp/$TODAY-$i.txt
done
# Reset byte counters
$IPT -Z

The resulting txt file looks like:

2010-05-01      1799818574      108214332
2010-05-02      3568287958      216150568
2010-05-03      1203346586      43332940

Columns are: Date, Input, Output.

Improvements, suggestions, critics are wellcome!

Ciao,
Flavio Boniforti

PIRAMIDE INFORMATICA SAGL
Via Ballerini 21
6600 Locarno
Switzerland
Phone: +41 91 751 68 81
Fax: +41 91 751 69 14
URL: http://www.piramide.ch
E-mail: flavio AT piramide DOT ch 

------------------------------------------------------------------------------

_______________________________________________
BackupPC-users mailing list
BackupPC-users AT lists.sourceforge DOT net
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:    http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/

<Prev in Thread] Current Thread [Next in Thread>