Manuel Kasser <manuel.kasser <at> arcor.de> writes:

> Is
> there a way to use vicious' netwidget to monitor the traffic going over
> both of the interfaces (or just showing the one which is up) or do I
> have to write my own widget? I'm displaying the traffic down as well as
> up next to each other, if that's important in some way.

Here's how I deal with multiple possible network devices (not sure if I got 
if from somewhere else of if I made it myself...)

-- Possible network devices
eths = { 'easytether0', 'wlan0', 'eth0', 'eth1'}
netwidget = widget({type='textbox'})
vicious.register( netwidget, vicious.widgets.net,
                  function(widget,args)
                     t=''
                     for i = 1, #eths do
                        e = eths[i]
                        if args["{"..e.." carrier}"] == 1 then
                           t=t..'|'..e..'(↑'..args['{'..e..' up_kb}']..',↓'
                              ..args['{'..e..' down_kb}']..')kb/s'
                        end
                     end
                     if string.len(t)>0 then -- remove leading '|'
                        return string.sub(t,2,-1)
                     end
                     return 'No network'
                  end
                  , 1 )

You can add whatever you like to the eths array...
This will show the up and down of whatever network interfaces are active.

Evo2.






-- 
To unsubscribe, send mail to [email protected].

Reply via email to