LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 01-25-2011, 03:42 AM   #1
murmur101
LQ Newbie
 
Registered: Apr 2010
Posts: 15

Rep: Reputation: 1
Up-/download rate for a single host (from shell)


Hi all,

I have a slave node uploading all kinds of backups to my server in the internet. Now I would like to display the actual upload and download rate to this server (not the entire nic-traffic, any protocol) in a small php-page for easy monitoring.

I had a look at quite some monitoring tools and the one which kind of offers what I am looking for is iftop with a filter on the IP of my server. As I would like to periodically update a file with the actual rates, an interactive program won't do.

A possibility would be to filter the packages myself using http://search.cpan.org/~kcarnut/Net-Pcap-0.05/Pcap.pm
but this seems to be quite a long shot.

The optimal solution would be a program or script printing out the actual upload to a host specified in the options to STDOUT.

Thank you for your help
 
Old 01-25-2011, 04:39 AM   #2
tva
Member
 
Registered: Jul 2010
Location: Finland
Distribution: Open SUSE 13.1
Posts: 83

Rep: Reputation: 8
Have you looked at ntop? http://www.ntop.org/

Not sure about filtering capabilities but I think its worth trying.
 
Old 01-25-2011, 10:26 AM   #3
murmur101
LQ Newbie
 
Registered: Apr 2010
Posts: 15

Original Poster
Rep: Reputation: 1
Hi tva,

yeah I looked into it - it is pretty heavyweight and a bit complicated to get the actual up/download rate with a script (I tried filtering through the output with perl regexp). looking into gathering packets for a second or two with ngrep and dumping them into a temp file - but this too is ugly as hell...
 
Old 01-26-2011, 07:19 AM   #4
murmur101
LQ Newbie
 
Registered: Apr 2010
Posts: 15

Original Poster
Rep: Reputation: 1
Hi,

solved it using iptables:


Code:
iptables -N myserver
iptables -A INPUT
iptables -A OUTPUT
iptables -A OUTPUT -d myserverip/32 -j myserver
iptables -A INPUT -s myserverip/32 -j myserver
and I query it every minute with:

Code:
iptables -L -v -n -x -Z
with a little reformatting and some minor calculations I get what I want without having to collect any packets.
Cheers!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
single shell script to download software updates narendra1310 Linux - Software 2 02-20-2010 02:14 AM
Why is Fedora 9 download rate 1/10 th of W*****s XP? lelmo82 Linux - Wireless Networking 19 12-09-2008 11:51 AM
Wireless rate, two interfaces on single node. (help) ERBRMN Linux - Wireless Networking 0 08-31-2006 04:30 AM
dat transfter rate on a single port.....? shahg_shahg Linux - Networking 1 05-05-2006 06:05 AM
Fast Download Site for Linux, enables >4GB Download of single file TigerLinux Linux - Distributions 9 10-29-2005 12:45 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 12:35 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration