Hallo, at Monday 01.10.2001 (16:12 +0200), Jan.Albrecht@bertelsmann.de wrote:
Aloha,
gibt es für einen Linux-DSL-Router ein Tool, dass mir den Traffic anzeigt? IPTRAF oder SNMP Tools kommen nicht in Frage. Es muss keine Grafik sein, es würde mir schon reichen, wenn ich besuchte Internetseiten und den Tages/Wochen/Monatstraffic angezeigt bekäme (auch als Textfile, dass ich hinterher mit Excel bearbeiten kann).
Ich habe folgende Zeilen in meiner ip-down hinzugefügt. #----------------------- /etc/ppp/ip-down ----------------------------------- # The date and time DATE=$(date +"%d.%m.%Y %H:%M:%S") # Log some data # Format: Date/Time Onlinetime [s] Bytes send Bytes reveived /bin/echo $DATE $CONNECT_TIME $BYTES_SENT $BYTES_RCVD >> /var/log/ppp-usage #----------------------- /etc/ppp/ip-down ----------------------------------- Die Logdtei kann ich mit folgendem Script auslesen: #!/bin/sh # # onlinecalc: summarizes your onlinetime, tranfervolume and number of # connects and prints out a little statistic # # Options: -d prints out the data for today # -m prints out the data for this month # -y prints out the data for this year # <pattern> prints out the data included "pattern" # # Examples: - onlineclac 01.2001 # prints out the data for January 2001 # - onlinecalc -m # prints out the data for the actual month # # Heavily based upon "calc" by Ulrich Schmitz # # Needs a call from /etc/ppp/ip-down like this (to generate the logfile): # # ----------------------- /etc/ppp/ip-down ----------------------------------- # # The date and time # DATE=$(date +"%d.%m.%Y %H:%M:%S") # # Log some data # Format: Date/Time Onlinetime [s] Bytes send Bytes reveived # /bin/echo $DATE $CONNECT_TIME $BYTES_SENT $BYTES_RCVD >> /var/log/ppp-usage # ----------------------- /etc/ppp/ip-down ----------------------------------- # # Version: 0.1 Tue Sep 16 07:36:01 CEST 2001 case $* in -d) PARAM=`/bin/date +%d.%m.%Y`;; -m) PARAM=`/bin/date +%m.%Y`;; -y) PARAM=`/bin/date +%Y`;; -v|-V|--version) echo echo "Version 0.1" echo exit;; -?|-h|--help) echo echo "onlinecalc [-d | -m | -y | <pattern>]" echo "Calculates online-time, tranfervolume and connects" echo exit;; *) PARAM="$*";; esac grep "$PARAM" /var/log/ppp-usage | awk 'BEGIN { total=0 } NF == 5 { TIME=TIME+$3 SEND=SEND+$4 RECV=RECV+$5 } END { print "\nDSL-Statistic\n-------------" printf "%-16s %d\n","Connects : ",NR printf "%-16s %.2f %1s\n","Online-Time : ",TIME/3600,"h" printf "%-16s %.2f %2s\n","MB send : ",SEND/1024/1024,"MB" printf "%-16s %.2f %2s\n","MB received : ",RECV/1024/1024,"MB" printf "%-16s %.2f %2s\n","Transfer-Volume : ",RECV/1024/1024+SEND/1024/1024,"MB" print "" }' Gruß Michael -- Phone/Fax +49 7000 MACBYTE (+49 7000-6222983) // Registered Linux User #228306 HomePage http://www.macbyte-computing.de/ PGP-Key http://www.macbyte-computing.de/shared/mykey.pkr ++ CGI-Hosting ++ Domains ++ Webspace ++ PHP Development ++