[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Monitoring bandwidth

Mark Woodward

4/2/2008 10:20:00 AM

Hi all,

Is there some code somewhere (library/script) that I can look at
that will help with the following:

I would like to monitor *all* traffic along the lines of
http://www.bwmo... on whatever network(s) is/are active at the
time. Wireless and/or Ethernet.

Is there a way to monitor traffic in general moving across say wlan0
rather than specific protocols/ports (HTTP, FTP, etc)?

A Ruby solution would be good but Java/Python/Perl/ would be OK as well.

(The pipe dream was that I was going to try to write something like this
in all the languages above as a way to evaluate each of them).

(The even bigger pipe dream was that I could expand this to include a
GUI and make it into an open source project eventually. Pretty much
like 'Bandwidth Monitor' shown in the link above.)


thanks,


--
Mark

9 Answers

Michael Fellinger

4/2/2008 11:29:00 AM

0

On Wed, Apr 2, 2008 at 12:25 PM, Mark <markonlinux@internode.on.net> wrote:
> Hi all,
>
> Is there some code somewhere (library/script) that I can look at
> that will help with the following:
>
> I would like to monitor *all* traffic along the lines of
> http://www.bwmo... on whatever network(s) is/are active at the
> time. Wireless and/or Ethernet.
>
> Is there a way to monitor traffic in general moving across say wlan0
> rather than specific protocols/ports (HTTP, FTP, etc)?
>
> A Ruby solution would be good but Java/Python/Perl/ would be OK as well.
>
> (The pipe dream was that I was going to try to write something like this
> in all the languages above as a way to evaluate each of them).
>
> (The even bigger pipe dream was that I could expand this to include a
> GUI and make it into an open source project eventually. Pretty much
> like 'Bandwidth Monitor' shown in the link above.)
>
>
> thanks,

Take a look at the ifstat program.

^ manveru

M. Edward (Ed) Borasky

4/2/2008 1:48:00 PM

0

Mark wrote:
> Hi all,
>
> Is there some code somewhere (library/script) that I can look at
> that will help with the following:
>
> I would like to monitor *all* traffic along the lines of
> http://www.bwmo... on whatever network(s) is/are active at the
> time. Wireless and/or Ethernet.
>
> Is there a way to monitor traffic in general moving across say wlan0
> rather than specific protocols/ports (HTTP, FTP, etc)?
>
> A Ruby solution would be good but Java/Python/Perl/ would be OK as well.
>
> (The pipe dream was that I was going to try to write something like this
> in all the languages above as a way to evaluate each of them).
>
> (The even bigger pipe dream was that I could expand this to include a
> GUI and make it into an open source project eventually. Pretty much
> like 'Bandwidth Monitor' shown in the link above.)
>
>
> thanks,
>
>

There are literally hundreds of tools that do exactly that, many of them
open source. However, as the saying goes, "With great power comes great
responsibility."

1. You haven't specified what "all" means. Is it all the traffic in and
out of one specific host, all the traffic in an enterprise, etc.? The
more network segments you care about, the tougher the job becomes and
the bigger the risks are.

2. There are, in addition to hundreds of tools, hundreds -- no, millions
-- of privacy and security concerns associated with network monitoring.

A good place to start is with RRDTool, an open source package that runs
on most platforms, including Windows, and has a Ruby binding.


Jano Svitok

4/2/2008 2:55:00 PM

0

On Wed, Apr 2, 2008 at 3:47 PM, M. Edward (Ed) Borasky
<znmeb@cesmail.net> wrote:
> A good place to start is with RRDTool, an open source package that runs on
> most platforms, including Windows, and has a Ruby binding.

Offtopic: Do you know of a windows rrd binding? In recent thread [1]
the poster had problems with installing RubyRRDtool gem.

[1] http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-t...

Todd Benson

4/2/2008 3:12:00 PM

0

On Wed, Apr 2, 2008 at 5:25 AM, Mark <markonlinux@internode.on.net> wrote:
> Hi all,
>
> Is there some code somewhere (library/script) that I can look at
> that will help with the following:
>
> I would like to monitor *all* traffic along the lines of
> http://www.bwmo... on whatever network(s) is/are active at the
> time. Wireless and/or Ethernet.
>
> Is there a way to monitor traffic in general moving across say wlan0
> rather than specific protocols/ports (HTTP, FTP, etc)?
>
> A Ruby solution would be good but Java/Python/Perl/ would be OK as well.
>
> (The pipe dream was that I was going to try to write something like this
> in all the languages above as a way to evaluate each of them).
>
> (The even bigger pipe dream was that I could expand this to include a
> GUI and make it into an open source project eventually. Pretty much
> like 'Bandwidth Monitor' shown in the link above.)
>
>
> thanks,
>
>
> --
> Mark

Keep in mind, too, that you need the port on the switch/router/gateway
that you are on to be promiscuous.

Todd

Eleanor McHugh

4/2/2008 3:51:00 PM

0

On 2 Apr 2008, at 14:47, M. Edward (Ed) Borasky wrote:
> Mark wrote:
>> Hi all,
>> Is there some code somewhere (library/script) that I can look at
>> that will help with the following:
>> I would like to monitor *all* traffic along the lines of
>> http://www.bwmo... on whatever network(s) is/are active at the
>> time. Wireless and/or Ethernet.
>> Is there a way to monitor traffic in general moving across say wlan0
>> rather than specific protocols/ports (HTTP, FTP, etc)?
>> A Ruby solution would be good but Java/Python/Perl/ would be OK as
>> well.
>> (The pipe dream was that I was going to try to write something like
>> this
>> in all the languages above as a way to evaluate each of them).
>> (The even bigger pipe dream was that I could expand this to include a
>> GUI and make it into an open source project eventually. Pretty much
>> like 'Bandwidth Monitor' shown in the link above.)
>> thanks,
>>
>
> There are literally hundreds of tools that do exactly that, many of
> them open source. However, as the saying goes, "With great power
> comes great responsibility."
>
> 1. You haven't specified what "all" means. Is it all the traffic in
> and out of one specific host, all the traffic in an enterprise,
> etc.? The more network segments you care about, the tougher the job
> becomes and the bigger the risks are.
>
> 2. There are, in addition to hundreds of tools, hundreds -- no,
> millions -- of privacy and security concerns associated with network
> monitoring.
>
> A good place to start is with RRDTool, an open source package that
> runs on most platforms, including Windows, and has a Ruby binding.

Also libpcap has Ruby bindings if you just want to catch packets and
examine them. You can find basic details in the Camping presentation
at the link in my sig.


Ellie

Eleanor McHugh
Games With Brains
http://slides.games-with-...
----
raise ArgumentError unless @reality.responds_to? :reason



M. Edward (Ed) Borasky

4/3/2008 3:27:00 AM

0

Eleanor McHugh wrote:
> Also libpcap has Ruby bindings if you just want to catch packets and
> examine them. You can find basic details in the Camping presentation at
> the link in my sig.

;) I deliberately avoided mention of libpcap because of the "great
power/great responsibility" issue. I don't want any Rubyists getting
hurt. :)


M. Edward (Ed) Borasky

4/3/2008 3:31:00 AM

0

Jano Svitok wrote:
> On Wed, Apr 2, 2008 at 3:47 PM, M. Edward (Ed) Borasky
> <znmeb@cesmail.net> wrote:
>> A good place to start is with RRDTool, an open source package that runs on
>> most platforms, including Windows, and has a Ruby binding.
>
> Offtopic: Do you know of a windows rrd binding? In recent thread [1]
> the poster had problems with installing RubyRRDtool gem.
>
> [1] http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-t...
>
>

Well ... RRDTool does run on Windows and I know there's a Perl binding.
IIRC it requires Perl to even run. I suspect a Windows Ruby binding
could be made.

Eleanor McHugh

4/3/2008 10:00:00 AM

0

On 3 Apr 2008, at 04:27, M. Edward (Ed) Borasky wrote:
> Eleanor McHugh wrote:
>> Also libpcap has Ruby bindings if you just want to catch packets
>> and examine them. You can find basic details in the Camping
>> presentation at the link in my sig.
>
> ;) I deliberately avoided mention of libpcap because of the "great
> power/great responsibility" issue. I don't want any Rubyists getting
> hurt. :)

yes, don't do this at home kiddies - innocent packets may die lol


Ellie

Eleanor McHugh
Games With Brains
http://slides.games-with-...
----
raise ArgumentError unless @reality.responds_to? :reason



Mark Woodward

4/4/2008 11:43:00 AM

0

Hi Ed,

On Wed, 2 Apr 2008 08:47:47 -0500
"M. Edward (Ed) Borasky" <znmeb@cesmail.net> wrote:

>
> There are literally hundreds of tools that do exactly that, many of
> them open source. However, as the saying goes, "With great power
> comes great responsibility."

that's scary ;-)

> 1. You haven't specified what "all" means. Is it all the traffic in
> and out of one specific host, all the traffic in an enterprise, etc.?
> The more network segments you care about, the tougher the job becomes
> and the bigger the risks are.

>> whatever network(s) is/are active at the time
^^^^^^^^^

Yes, definitely wrong choice of words. Network adapter would have been
more appropriate.

>
> 2. There are, in addition to hundreds of tools, hundreds -- no,
> millions -- of privacy and security concerns associated with network
> monitoring.

I'm not interested in what the packets contain, just how many packets
are passing across the network adapter (NIC).
ie a download/upload rate. Regardless of what protocol is involved (FTP
or HTTP etc).

For example, I'm downloading Ubuntu updates as we speak and suspect its
going a tad slowly. Because I have this mail window maximized I can't
see Update Managers dialog so can't see the Download Rate (18.2Kb/sec
by the way. Which *is* slow ;-().

What I'd eventually like is (both of these would be applets on a gnome
panel for eg):

1 - to have something similar to the System Monitors CPU History graph,
but showing download speed.

or

2 - even just '18.2Kb/s' displayed on the panel (updates at a specified
refresh rate). Much like a temperature applet displays 17 degrees C
for eg.


sorry for the inaccuracy,


--
Mark