RE: Recording and displaying total internet traffic.

Many thanks for the replies, James reply put me on the track, vnstat just reads /proc/net/dev this give full stats for all up interfaces. All I need to do is when ppp0 comes up is to start reading /proc/net/dev and feed it to grep ppp0, extracting the transmit and recieve count will be trivial. Flamming horrible weather must be making my brain freeze. Up here in NE Vic we normall get frost mornings and sunny days. We have had lots of cloudy days either drizzle (mostly) or rain top temperatures of between 7 and 10 degrees. To cold to do anything outside particularly in the machine shop. My fitness program has gone completely to the dogs.........sigh...... Lindsay

zlinw@mcmedia.com.au <zlinw@mcmedia.com.au> wrote:
Many thanks for the replies, James reply put me on the track, vnstat just reads /proc/net/dev this give full stats for all up interfaces. All I need to do is when ppp0 comes up is to start reading /proc/net/dev and feed it to grep ppp0, extracting the transmit and recieve count will be trivial.
There are always more commands to learn, it seems. Vnstat was new to me.

On 13/07/15 10:15, zlinw@mcmedia.com.au wrote:
Many thanks for the replies, James reply put me on the track, vnstat just reads /proc/net/dev this give full stats for all up interfaces. All I need to do is when ppp0 comes up is to start reading /proc/net/dev and feed it to grep ppp0, extracting the transmit and recieve count will be trivial. Flamming horrible weather must be making my brain freeze. Up here in NE Vic we normall get frost mornings and sunny days. We have had lots of cloudy days either drizzle (mostly) or rain top temperatures of between 7 and 10 degrees. To cold to do anything outside particularly in the machine shop. My fitness program has gone completely to the dogs.........sigh...... Lindsay
Or you could just run this config file with conky and have the info on your desktop! You would of course need to change the relevant interface to /dev/ppp0, the file is currently set up for eth0 and wlan1, but that is simple to change/add to as necessary. -------start config------ robert@robert-p4p800e ~ $ cat /etc/conky/conky.conf # Conky, a system monitor, based on torsmo # # Any original torsmo code is licensed under the BSD license # # All code written since the fork of torsmo is licensed under the GPL # # Please see COPYING for details # # Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen # Copyright (c) 2005-2010 Brenden Matthews, Philip Kovacs, et. al. (see AUTHORS) # All rights reserved. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # # Parsix-CONKY # ## A comprehensive conky script, configured for use on # Ubuntu / Debian Gnome, without the need for any external scripts. # # Based on conky-jc and the default .conkyrc. # INCLUDES: # - tail of /var/log/messages # - netstat connections to your computer # # -- Pengo (conky@pengo.us) # # Create own window instead of using desktop (required in nautilus) own_window yes # own_window_type override own_window_transparent yes own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager # Use double buffering (reduces flicker, may not work for everyone) double_buffer yes # fiddle with window use_spacer right # values of left, right or none use_xft yes # Update interval in seconds update_interval 2.0 # Minimum size of text area minimum_size 350 50 maximum_width 1200 # Draw shades? draw_shades no # Text stuff # draw_outline yes # amplifies text if yes draw_borders no xftfont LCDMono:size=10 # nvidia_display uppercase no # set to yes if you want all text to be in uppercase # Stippled borders? stippled_borders 3 # border margins border_margin 5 # border width border_width 0 # Default colors and also border colors, grey90 == #e5e5e5 default_color darkblue own_window_type normal # own_window_colour brown # Text alignment, other possible values are commented #alignment top_left alignment top_right #alignment bottom_left #alignment bottom_right # Gap between borders of screen and text gap_x 10 gap_y 0 # stuff after 'TEXT' will be formatted on screen TEXT $color ${color #88ECE0}SYSTEM ${hr 2}$color $nodename $sysname $kernel on $machine ${color #88ECE0}CPU ${hr 2}$color ${freq}MHz Load: ${loadavg} Uptime: ${uptime} ${color}Thread 1 Usage:$color ${alignc} ${cpu cpu1}% ${color}${cpubar cpu1} ${color}Thread 2 Usage:$color ${alignc} ${cpu cpu2}% ${color}${cpubar cpu2} ${cpugraph 000000 DFEC88} NAME PID CPU% MEM% ${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1} ${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2} ${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3} ${top name 4} ${top pid 4} ${top cpu 4} ${top mem 4} ${color #88ECE0}MEMORY / DISK ${hr 2}$color RAM: $memperc% ${membar 6}$color Swap: $swapperc% ${swapbar 6}$color Root: ${fs_free_perc /}% ${fs_bar 6 /}$color Home: ${fs_free_perc /home}% ${fs_bar 6 /home}$color ${color}DiskI/O:${color}${diskio} ${diskiograph 000000 88D5EC} ${color #88ECE0}WIRED NETWORK (${addr eth0}) ${hr 2}$color Down: $color${downspeed eth0} k/s ${alignr}Up: ${upspeed eth0} k/s ${downspeedgraph eth0 25,140 000000 ff0000} ${alignr}${upspeedgraph eth0 25,140 000000 00ff00}$color Total: ${totaldown eth0} ${alignr}Total: ${totalup eth0} ${color #88ECE0}WIRELESS NETWORK (${addr wlan1}) ${hr 2}$color Down: $color${downspeed wlan1} k/s ${alignr}Up: ${upspeed wlan1} k/s ${downspeedgraph wlan1 25,140 000000 ff0000} ${alignr}${upspeedgraph wlan1 25,140 000000 00ff00}$color Total: ${totaldown wlan1} ${alignr}Total: ${totalup wlan1} Inbound: ${tcp_portmon 1 32767 count} Outbound: ${tcp_portmon 32768 61000 count}${alignr}Total: ${tcp_portmon 1 65535 count} -------end config-------
participants (3)
-
Jason White
-
Robert Moonen
-
zlinw@mcmedia.com.au