LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Is there a program that will monitor network activity in the background? (https://www.linuxquestions.org/questions/linux-networking-3/is-there-a-program-that-will-monitor-network-activity-in-the-background-4175554827/)

RandomTroll 09-29-2015 04:57 PM

Is there a program that will monitor network activity in the background?
 
I want a program to monitor network access in the background (which tcpdump, netwatch, and iptraf-ng don't seem to do) so I can keep track of total bandwidth used.

schneidz 09-29-2015 05:18 PM

i assume by bandwidth you actually mean how much has been tranceived. :
Code:

[schneidz@hyper ~]$ ifconfig
enp0s10: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.25  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::92fb:a6ff:fe2a:5b68  prefixlen 64  scopeid 0x20<link>
        ether 90:fb:a6:2a:xx:xx  txqueuelen 1000  (Ethernet)
        RX packets 1942713  bytes 948892244 (904.9 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1772049  bytes 338606044 (322.9 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


RandomTroll 09-29-2015 05:30 PM

ifconfig summarizes for that session. I want a program that writes to a log and either keeps a running total or allows me to grep it out. I suppose I could add a task to shutdown to extract the info from ifconfig. I looked more closely at iptraf-ng, which seems to do what I wanted. Sorry for asking before looking more closely.

schneidz 09-30-2015 07:30 AM

thanks, i dont have any experience with iptraf-ng; please explain your solution. it mite help others in the future.

RandomTroll 10-01-2015 02:25 PM

iptraf-ng, when run with the switches -B -i eth0 runs in the background and logs every packet in /var/log/iptraf/ . Unfortunately it quits for no apparent reason for me after a minute or so, even if I set a timeout with the -t switch. Without the -B switch it stays in the foreground and reports traffic.

Because I couldn't get it to work I wrote a short script to log total traffic for every session with ifconfig. Unfortunately that requires me to run it every time I end a session.


All times are GMT -5. The time now is 02:43 PM.