#!/bin/bash
# Invoking 'bc' using command substitution
# in combination with a 'here document'.
# pe $1 avem packete
# pe $2 avem bytes
#in bytes

PACK_IN=$(echo `/sbin/iptables -t nat -L count_in -v -n -x |grep -v -i Chain
| \
        grep -v -i pkts | gawk '{ print $1 }'`)
echo $PACK_IN >Xtr
#sed 's/ 0/ /' Xtr

#out bytes
PACK_OUT=$(echo `/sbin/iptables  -L count_out -v -n -x |grep -v -i Chain | \
        grep -v -i pkts | gawk '{ print $1 }'`)
echo $PACK_OUT >Xtr
#sed 's/ 0/ /' Xtr


#in bytes
BYTES_IN=$(echo `/sbin/iptables -t nat -L count_in -v -n -x |grep -v -i
Chain | \
        grep -v -i pkts | gawk '{ print $2 }'`)
echo $BYTES_IN >Xtr
sed 's/ 0/ /' Xtr
echo $BYTES_IN >>/root/bytes_in

#out bytes
BYTES_OUT=$(echo `/sbin/iptables  -L count_out -v -n -x |grep -v -i Chain |
\
        grep -v -i pkts | gawk '{ print $2 }'`)
echo $BYTES_OUT >Xtr
sed 's/ 0/ /' Xtr
echo $BYTES_OUT >>/root/bytes_out
/sbin/iptables -t nat -Z count_in
/sbin/iptables -Z count_out
echo "$(uptime | cut -b 13-30 | gawk -F "," '{ print $1 }')"
echo "comentarii"
date >>/root/watch


count_in count_out sunt chainuri pe care ti le faci tu...


Best regards,
Marinel Darabana,

MindBill Software Engineer
MIND Software (Romania)
NextGen Billing Solutions

E-mail:               [EMAIL PROTECTED]
Web:                 www.mindcti.com

Keep us in mind!
----- Original Message -----
From: "Dan Uscatu" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 28, 2004 2:47 PM
Subject: [rlug] grafice ipchains ipt accounting


> stiti de vreo scula gata facuta care sa prelucreze datele astea intr-un
> format frumos, preferabil similar cu mrtg ?
> motivul e urgentza, ca asha pot sa-mi fac scriptuletze sa extrag
> numerele si sa le pasez la mrtg
>
> Chain input (policy ACCEPT: 226350179 packets, 81179612805 bytes):
>     pkts      bytes target     prot opt    tosa tosx  ifname     mark
> outsize  source                destination           ports
>      214      10454 -          all  ------ 0xFF 0x00  *
> 192.168.0.114        0.0.0.0/0             n/a
>      181     171943 -          all  ------ 0xFF 0x00  *
> 192.168.0.7          0.0.0.0/0             n/a
>
> multumesc
>
> "Live to Win, Dare to Fail" - James Hetfield
>
>
>
>
> ---
> Detalii despre listele noastre de mail: http://www.lug.ro/
>
>
>
>
>
****************************************************************************
********
> This footnote confirms that this email message has been scanned by
> PineApp Mail-SeCure for the presence of malicious code, vandals & computer
viruses.
>
****************************************************************************
********


--- 
Detalii despre listele noastre de mail: http://www.lug.ro/


Raspunde prin e-mail lui