Traffic - tray network activity monitor!

Moderator: Forum moderators

Post Reply
User avatar
stemsee
Posts: 656
Joined: Sun Jul 26, 2020 8:11 am
Location: lattitude 0
Has thanked: 160 times
Been thanked: 104 times
Contact:

Traffic - tray network activity monitor!

Post by stemsee »

'Traffic' is a standalone network tray animated icon to monitor network interface activity.

Traffic creates a tray icon display per interface!

Code: Select all

ls /sys/class/net | grep -v 'lo'

sensitivity can be adjusted by editing the script.

It is a spin off from snapp development.

stemsee

traffic-v0.1.sfs
(24 KiB) Downloaded 91 times

edit: traffic_0.5

traffic-v0.5.sfs
(32 KiB) Downloaded 69 times
Attachments
menu.png
menu.png (29.71 KiB) Viewed 1726 times
Last edited by stemsee on Sun Aug 22, 2021 5:05 pm, edited 4 times in total.
User avatar
puppy_apprentice
Posts: 661
Joined: Tue Oct 06, 2020 8:43 pm
Location: land of bigos and schabowy ;)
Has thanked: 4 times
Been thanked: 107 times

Re: Traffic - tray network activity monitor!

Post by puppy_apprentice »

There is an option to store amount of send/received data per day/month/year?

User avatar
stemsee
Posts: 656
Joined: Sun Jul 26, 2020 8:11 am
Location: lattitude 0
Has thanked: 160 times
Been thanked: 104 times
Contact:

Re: Traffic - tray network activity monitor!

Post by stemsee »

puppy_apprentice wrote: Sat Jul 10, 2021 2:50 pm

There is an option to store amount of send/received data per day/month/year?

Ha Ha ... you mean like on android!

I think that on a secure frugal puppy system where it is possible to boot fresh each time with anonimity, such browsing information, is available from your provider, wether landline or mobile data. Of course that is easily possible in an itemised way. So I am interested to know why do you want that??

stemsee

User avatar
puppy_apprentice
Posts: 661
Joined: Tue Oct 06, 2020 8:43 pm
Location: land of bigos and schabowy ;)
Has thanked: 4 times
Been thanked: 107 times

Re: Traffic - tray network activity monitor!

Post by puppy_apprentice »

Of course it could be optional switch. I like to know how many data i've downloaded. I get sms message before my allowance is end. But always i notice this sms when i lose some money from my pay-as-you-go simcard.

I've wrote a script for this some years ago:
https://oldforum.puppylinux.com/viewtop ... 47#p982947

Ok never mind.

User avatar
stemsee
Posts: 656
Joined: Sun Jul 26, 2020 8:11 am
Location: lattitude 0
Has thanked: 160 times
Been thanked: 104 times
Contact:

Re: Traffic - tray network activity monitor!

Post by stemsee »

puppy_apprentice wrote: Sat Jul 10, 2021 4:17 pm

Of course it could be optional switch. I like to know how many data i've downloaded. I get sms message before my allowance is end. But always i notice this sms when i lose some money from my pay-as-you-go simcard.

I've wrote a script for this some years ago:
https://oldforum.puppylinux.com/viewtop ... 47#p982947

Ok never mind.

I think it is a good idea. I have the same problem! It will be good to set data limits for usb0 tethered, bluetooth tether and Wifi tether, and why not ethernet, and pppoe. I will see what I can integrate from your script...thanks

stemsee

EDIT: I can save data per interface. But lets suppose one use i connect my laptop to phone using usb0 tether. Next time i connect using bluetooth tether. Then i connect using wifi. Sometimes i also connect to free wifi in coffee shops or library. So it becomes clear that either one connection method is used between phone and computer to consistenly record correct data usage ... or user initiates script each usage. So only usb0 or usb0 and bn0 are collated. For security and power usage using usb tether is better than wifi hotspot. So I can implement this feature such that an upper limit is set by user for a given interface and/or wifi/bt mac address. So usb0 is always assumed to use phone data, and the phones wifi mac address or ssid is used also; the usage from these gets subtracted from the upper limit, when the limit reduces to 0 those interfaces and mac address connections shutdown with a notification.

In order to do this securely and assuming the user sometimes boots without a savefile the rtx-iface data should be stored on a small partition which is unlikely to get overwritten or deleted...eg /mnt/sdb7 or sdc3 or on a cloud storage ! Or a partition could be renamed each time as the remaining data limit.

Any thoughts?

User avatar
puppy_apprentice
Posts: 661
Joined: Tue Oct 06, 2020 8:43 pm
Location: land of bigos and schabowy ;)
Has thanked: 4 times
Been thanked: 107 times

Re: Traffic - tray network activity monitor!

Post by puppy_apprentice »

Fore me file with amount of downloaded data could be stored everywhere. If you wish you could give option to choose that file by the user (he will know where he want to store that file: hdd, usb, cloud). you could encode that file with base64 ;) or cipher:
https://linoxide.com/cipher-command-lin ... rectories/
or any other encoder.

User avatar
stemsee
Posts: 656
Joined: Sun Jul 26, 2020 8:11 am
Location: lattitude 0
Has thanked: 160 times
Been thanked: 104 times
Contact:

Re: Traffic - tray network activity monitor!

Post by stemsee »

That seems better to leave it up to the user!

Another problem i foresee, is that, assuming the data used is from a smartphone and not a data sim in a usb dongle or onboard sim-slot, is that seperate phone browsing will not be accounted for. The best way to control data usage in that case is to set the data limit on the phone, this is available in settings on android at least, and likely on apple.

In the case of an onboard data sim, then it makes sense to implement this function. In the case of a portable hotspot device, that other devices could also access then that also could not be moitored well. So let's assume that it is for an onboard data sim.

User avatar
stemsee
Posts: 656
Joined: Sun Jul 26, 2020 8:11 am
Location: lattitude 0
Has thanked: 160 times
Been thanked: 104 times
Contact:

Re: Traffic - tray network activity monitor!

Post by stemsee »

Im using a loop to get rx tx bytes, but that uses too much cpu. I found this code

Code: Select all

watch -n 1 -d ifconfig usb0

which seems more efficient, but how to use output??

can udev be used to monitor an interface? change?

which kernel events??

User avatar
BarryK
Posts: 2273
Joined: Tue Dec 24, 2019 1:04 pm
Has thanked: 93 times
Been thanked: 564 times

Re: Traffic - tray network activity monitor!

Post by BarryK »

In case you find it useful, rerwin introduced code a very long time ago, to log network data transfer. See this, line 100:

https://github.com/puppylinux-woof-CE/w ... c.shutdown

That was back in 2010, and the network tray icon back then also showed the accumulated data transfer.

That seems to have disappeared from the woof-ce master branch, it isn't in rc.shutdown anyway.

@rerwin would know what the current situation is in the pups.

Um, can't remember, think that I might have written that code in rc.shutdown. rerwin did have some input, see:

https://github.com/puppylinux-woof-CE/w ... rc.sysinit

and also he worked on the network tray app.

User avatar
stemsee
Posts: 656
Joined: Sun Jul 26, 2020 8:11 am
Location: lattitude 0
Has thanked: 160 times
Been thanked: 104 times
Contact:

Re: Traffic - tray network activity monitor!

Post by stemsee »

BarryK wrote: Sun Jul 11, 2021 3:14 pm

In case you find it useful, rerwin introduced code a very long time ago, to log network data transfer. See this, line 100:

https://github.com/puppylinux-woof-CE/w ... c.shutdown

That was back in 2010, and the network tray icon back then also showed the accumulated data transfer.

That seems to have disappeared from the woof-ce master branch, it isn't in rc.shutdown anyway.

@rerwin would know what the current situation is in the pups.

Um, can't remember, think that I might have written that code in rc.shutdown. rerwin did have some input, see:

https://github.com/puppylinux-woof-CE/w ... rc.sysinit

and also he worked on the network tray app.

thanks Barry

but line 100 is empty! I did try to scan through to find relevant entries...but not sure what I am looking for exactly.

User avatar
BarryK
Posts: 2273
Joined: Tue Dec 24, 2019 1:04 pm
Has thanked: 93 times
Been thanked: 564 times

Re: Traffic - tray network activity monitor!

Post by BarryK »

stemsee wrote: Sun Jul 11, 2021 7:52 pm
BarryK wrote: Sun Jul 11, 2021 3:14 pm

In case you find it useful, rerwin introduced code a very long time ago, to log network data transfer. See this, line 100:

https://github.com/puppylinux-woof-CE/w ... c.shutdown

That was back in 2010, and the network tray icon back then also showed the accumulated data transfer.

That seems to have disappeared from the woof-ce master branch, it isn't in rc.shutdown anyway.

@rerwin would know what the current situation is in the pups.

Um, can't remember, think that I might have written that code in rc.shutdown. rerwin did have some input, see:

https://github.com/puppylinux-woof-CE/w ... rc.sysinit

and also he worked on the network tray app.

thanks Barry

but line 100 is empty! I did try to scan through to find relevant entries...but not sure what I am looking for exactly.

Sorry, it is line 100 in EasyOS. In woof-CE legacy, above link, it is line 182.

I posted this info, because thought you might be interested to know that the kernel logs all sent and received bytes to:

/sys/class/net/${ACTIVE_INTERFACE}/statistics/rx_bytes and tx_bytes

The network applet monitors this, I presume that it polls it periodically. At least it used to, in the legacy pups, don't know about current pups. You used to be able to mouse-over the tray applet and see accumulated data transfer.

User avatar
stemsee
Posts: 656
Joined: Sun Jul 26, 2020 8:11 am
Location: lattitude 0
Has thanked: 160 times
Been thanked: 104 times
Contact:

Re: Traffic - tray network activity monitor!

Post by stemsee »

Ok....

Code: Select all

/sys/class/net/$INTERFACE/statistics/rx_bytes|tx_bytes

That's what I needed.

So the loop now cats those files every second, and no other binary or script is called resulting in a drop from 8% cpu usage to 1% ... that's the entire desktop idling. I tried to use watch binary but permissions denied.

So I will just update that loop!

thanks again Barry!

stemsee

User avatar
stemsee
Posts: 656
Joined: Sun Jul 26, 2020 8:11 am
Location: lattitude 0
Has thanked: 160 times
Been thanked: 104 times
Contact:

Re: Traffic - tray network activity monitor!

Post by stemsee »

Here is version_0.2

There is now a less cpu demanding way of monitoring received and sent data. Thanks for Barry K's input on that one.

I have added data limit set function. You input in MB your desired data limit. This is displayed in the tray menu and icon info when mouse hovers over it. If you set a new datalimit then previous stored values will be replaced. I had some confusion between kilobytes megabytes and gigabyte maths, so that side of things definetely needs looking at, but basically is seems to be working. When the data limit is almost reached, actually 100mb less then tray icon should change to a red gtk-refresh icon flashing!.

As long as only one interface is used each time the traffic is running then even if a different interface is used at other times the tally should have integrity.

I know this isn't perfect and storing used data for month or year can be added once this has been debugged.

stemsee

tray info.png
tray info.png (7.48 KiB) Viewed 1649 times
menu.png
menu.png (29.71 KiB) Viewed 1649 times
traffic-v0.2.sfs
(28 KiB) Downloaded 52 times
User avatar
puppy_apprentice
Posts: 661
Joined: Tue Oct 06, 2020 8:43 pm
Location: land of bigos and schabowy ;)
Has thanked: 4 times
Been thanked: 107 times

Re: Traffic - tray network activity monitor!

Post by puppy_apprentice »

I currently have two interfaces: eth0 (wired) and eth1 (huawei E3372 usb dongle works as virtual ethernet interface). Eth0 is not connected (no cable in port). Traffic shows sometimes 2 icons with monitors or 2 flask icons (what they mean?). I think that only icon for active interface (eth1) should be present in tray.
This:

Code: Select all

route | grep "default" | awk '{ print $8 '}

shows only eth1.

User avatar
stemsee
Posts: 656
Joined: Sun Jul 26, 2020 8:11 am
Location: lattitude 0
Has thanked: 160 times
Been thanked: 104 times
Contact:

Re: Traffic - tray network activity monitor!

Post by stemsee »

Use ifconfig to bring unused interface down, then start traffic.

Code: Select all

ifconfig eth0 down
traffic

I sometimes connect to my wireless printer on wlano while also connected to net through mobile phone on usb0.... So one icon per interface !

User avatar
puppy_apprentice
Posts: 661
Joined: Tue Oct 06, 2020 8:43 pm
Location: land of bigos and schabowy ;)
Has thanked: 4 times
Been thanked: 107 times

Re: Traffic - tray network activity monitor!

Post by puppy_apprentice »

Still have 2.

traffic.jpg
traffic.jpg (61.2 KiB) Viewed 1633 times

ifconfig shows only eth1 and lo even without:

Code: Select all

ifconfig eth0 down

BTW. When i click MMB on those icons traffic is still visible in htop.

Running on Slacko64 6.3.2. Maybe yad from PPM is to old?

I think that traffic should show only icons for active interfaces. Or list all of them but give a choice to user what interfaces he wants to observe.

BTW. For my Huawei E3372 USB dongle which is working as eth1 Puppy Networking Applet show overall download/upload data - Month:XXXX.

User avatar
stemsee
Posts: 656
Joined: Sun Jul 26, 2020 8:11 am
Location: lattitude 0
Has thanked: 160 times
Been thanked: 104 times
Contact:

Re: Traffic - tray network activity monitor!

Post by stemsee »

puppy_apprentice wrote: Thu Jul 15, 2021 9:56 pm

Still have 2.

.......

I think that traffic should show only icons for active interfaces. Or list all of them but give a choice to user what interfaces he wants to observe.

Ok .... I changed some code, so now all faces are brought down, then a yad list opens giving the user the task of selecting which interface/s to raise.... traffice will open tray icons only for the raised interface/s.

Some might not like the interfaces being taken down! The way it works at the moment is the user can close any tray icon for any interface they dont want to see. As it is, it is less intrusive. This additional code adds that step of downing the interfaces and then raising those selected by the user...as opposed to opening icons for all interfaces and then closing those not wanted. If there are many interfaces to deal with then this new code is more useful.

Code: Select all

ls /sys/class/net | grep -v 'lo' > /tmp/traffic/faces #finds all interfaces
while read line; do ifconfig $line down; done </tmp/traffic/faces 
cat /tmp/traffic/faces | yad --list --column="Found Interfaces" --multiple --window-title="Choose Interface/s to traffic" | tr '|' '\n' >/tmp/traffic/iface # brings down interfaces and lists them for selection
while read line; do ifconfig $line up; done </tmp/traffic/iface # raises selected interface/s

for i in `ifconfig | while read line; do grep -i 'flags' | cut -f1 -d':'; done` # creates traffic tray icon for raised interface/s
do
traffic-v0.3.sfs
(32 KiB) Downloaded 43 times
User avatar
BarryK
Posts: 2273
Joined: Tue Dec 24, 2019 1:04 pm
Has thanked: 93 times
Been thanked: 564 times

Re: Traffic - tray network activity monitor!

Post by BarryK »

Throwing this in, just in case you find it useful. getlocalip is in EasyOS, the source is attached, with false ".gz". Compile:

# gcc -o getlocalip getlocalip.c
# strip --strip-unneeded getlocalip

EasyOS has it at /usr/sbin

It returns the IP addresses assigned to all active interfaces.

Attachments
getlocalip.c.gz
(536 Bytes) Downloaded 49 times
User avatar
stemsee
Posts: 656
Joined: Sun Jul 26, 2020 8:11 am
Location: lattitude 0
Has thanked: 160 times
Been thanked: 104 times
Contact:

Re: Traffic - tray network activity monitor!

Post by stemsee »

BarryK wrote: Wed Jul 21, 2021 12:05 pm

Throwing this in, just in case you find it useful. getlocalip is in EasyOS, the source is attached, with false ".gz". Compile:

# gcc -o getlocalip getlocalip.c
# strip --strip-unneeded getlocalip

EasyOS has it at /usr/sbin

It returns the IP addresses assigned to all active interfaces.

Without even looking at it....I KNOW it's going to be useful!! Getting local ip for each interface across distros will be easier ... so thanks for that!

... Traffic version_0.4

1) Does not down any interface of its own accord. Instead it merely begins an instance for a selected interface.
2) New animations of the tray icon ...
i. when interface is down.
ii. when total data exceeds limits.
iii. rx tx was swapped round.

3) Theme is now a toggle with menu icon synced to change ... (to do ... theme change per face)
4) About function displays license and copyright and a button 'traffic' to initiate a new instance for another iface
5) Selecting interfaces code is now in a pipe (yad'n'all), more efficient.
6) Timing is more responsive
7) Added menu entry to quit traffic cleanly, as well as the entry to close tray icon individually.
8) added a function to handle Kib Mib convrsions.

traffic-v04.sfs
(32 KiB) Downloaded 46 times
User avatar
stemsee
Posts: 656
Joined: Sun Jul 26, 2020 8:11 am
Location: lattitude 0
Has thanked: 160 times
Been thanked: 104 times
Contact:

Re: Traffic - tray network activity monitor!

Post by stemsee »

Traffic_0.5

traffic-v0.5.sfs
(32 KiB) Downloaded 55 times
User avatar
stemsee
Posts: 656
Joined: Sun Jul 26, 2020 8:11 am
Location: lattitude 0
Has thanked: 160 times
Been thanked: 104 times
Contact:

Re: Traffic - tray network activity monitor!

Post by stemsee »

traffic_0.7 bugfix!

traffic_0.7.sfs
(32 KiB) Downloaded 48 times
User avatar
stemsee
Posts: 656
Joined: Sun Jul 26, 2020 8:11 am
Location: lattitude 0
Has thanked: 160 times
Been thanked: 104 times
Contact:

Re: Traffic - tray network activity monitor!

Post by stemsee »

update

Code: Select all

#!/bin/sh
# by stemsee
# Copyright (C) 2021 Marcos Contant
# gpl v3 license applies for personal use. for commercial use an arbitrary license must be obtained from the copyright holder.
# no liability accepted, no warranty, use at own risk.
# With input from Barry Kauler, (Puppy Master) and puppy_apprentice
#
if [[ $(id -u) -ne 0 ]]; then
	[ "$DISPLAY" ] && exec gtksu "traffic" "$0" "$@"
	exec su -c "$0 $*"
fi
export version=0.8
export OUTPUT_CHARSET=UTF-8
export camino=/root/.config/snapp
export track=/tmp/traffic-$$
[ -d "$track" ] && rm -rf "$track"
mkdir -p "$track"
touch "$track"/poll # set loop flag

function bytesToHR(){
        local SIZE=$1
        local UNITS="B KiB MiB GiB TiB PiB"
        for F in $UNITS; do
                local UNIT=$F
                test ${SIZE%.*} -lt 1024 && break;
                SIZE=$(echo "$SIZE / 1024" | bc -l)
        done
    if [ "$UNIT" == "B" ]; then
        printf "%4.0f %s\n" "$SIZE" "$UNIT"
    else
        printf "%7.02f %s\n" "$SIZE" "$UNIT"
    fi
};export -f bytesToHR

function limitrtxfn (){
	export DATALIMIT=`yad --form --title="Traffic-RTX-Limit" --field="Set data limit in megabytes for $1":NUM "$DATALIMIT" | cut -f1 -d'|'`
	DATALIMIT=$((DATALIMIT-"$i"))
	[ ! -z "$DATALIMIT" ] && echo "$DATALIMIT" > "$camino/DATA-LIMIT-$i"
	[ -f "$camino/TOT-PREV-$i" ] && rm -f "$camino/TOT-PREV-$i"
};export -f limitrtxfn

function about (){
	yad --splash --text="$(gettext 'traffic network interface monitor by stemsee 2021 \n GPL 3.0 license applies for personal use')" --timeout=7 --button="traffic:bash -c traffic" &
};export -f about

function dhpfn {
dhcpcd -z $1
};export -f dhpfn

if [[ -f "$camino/DATA-LIMIT-$i" ]]; then
	export DATALIMIT="`cat $camino/DATA-LIMIT-$i`"
	if [ -f "$camino/TOT-PREV-$i" ]; then
		TOTPREV=`cat "$camino/TOT-PREV-$i"`
		TOTPREV=$(bytesToHR "$TOTPREV")
		export TEXT="${DATALIMIT} $(gettext 'is the data limit. You have used ${TOTPREV} MiB of data')"
		export TOTPREV=`cat $camino/TOT-PREV-"$i"`
	fi
else
	export TEXT="$(gettext 'Data limit not set')"
fi

# setup each interface monitor
for i in `ls /sys/class/net | grep -v 'lo' | yad --list --mouse --column="$*gettext 'Found Interfaces')" --multiple --window-icon=$camino/icons/connectedy.png --title="Choose Interface/s to traffic" | tr '|' '\n'` # creates traffic tray icon for raised interface/s
do
# change theme command
echo "if [ -d $camino/icons/light ]; then
	mv -f $camino/icons/traffic $camino/icons/dark
	mv -f $camino/icons/light $camino/icons/traffic
elif [ -d $camino/icons/dark ]; then
	mv -f $camino/icons/traffic $camino/icons/light
	mv -f $camino/icons/dark $camino/icons/traffic
fi" > "$track"/themefn
chmod 755 "$track"/themefn
mkfifo "$track/$i"
exec 3<> "$track/$i"
yad --notification --text="Traffic_$version-$i" --icon-size=48 --image="$camino/icons/network.png" \
--command="bash -c \"yad --button=traffic:'bash -c traffic' --timeout=7 --splash --text='yad network-card animated tray icons with info, by stemsee 2021' \"" \
--menu="~ Traffic-$i ~!bash -c about!$camino/icons/connectedy.png|${TEXT}!bash -c 'xdg-open $camino/DATA-LIMIT!$camino/icons/red.png|Light / Dark theme!bash -c '$track/themefn'!$camino/icons/traffic/offon.png|Set Data Limit for $i!bash -c 'limitrtxfn $i'!$camino/icons/network.png|Up $i!bash -c 'ifconfig $i up'!$camino/icons/up.png|Down $i!bash -c 'ifconfig $i down'!$camino/icons/down.png|Close $i Traffic!quit!gtk-quit|" --listen <& 3 &
echo "menu:~ Traffic-$i ~!bash -c about!$camino/icons/connectedy.png|${TEXT}!bash -c 'xdg-open $camino/DATA-LIMIT!$camino/icons/red.png|Light / Dark theme!bash -c '$track/themefn'!$camino/icons/traffic/offon.png|Set Data Limit for $i!bash -c 'limitrtxfn $i'!$camino/icons/network.png|Up $i!bash -c 'ifconfig $i up'!$camino/icons/up.png|Down $i!bash -c 'ifconfig $i down'!$camino/icons/down.png|Start dhcp!bash -c 'dhpfn $i'!gtk-refresh|Close $i Traffic!quit!gtk-quit|" > $track/$i

while [ -f "$track"/poll ]
do
function on_exit (){
    echo "quit" > "$track/$i"
    rm -rf "$track"
	[ ! -z "$TOTTOT" ] && echo "$TOTTOT" > "$camino"/TOT-PREV
	killall traffic
};trap on_exit EXIT

ifconfig "$i" > "$track/info-$i"
ip4=`cat $track/info-"$i" | grep 'inet addr' | awk '{print $2}' | cut -f2 -d':'`
ip6=`cat $track/info-"$i" | grep 'inet6 addr' | awk '{print $3}'`

RX1=`cat /sys/class/net/$i/statistics/rx_bytes` # read received bytes
TX1=`cat /sys/class/net/$i/statistics/tx_bytes` # read transmitted bytes
sleep 0.4
RX2=`cat /sys/class/net/"$i"/statistics/rx_bytes` # second reading
TX2=`cat /sys/class/net/"$i"/statistics/tx_bytes` # second reading

# logic gate to determine rx or tx on or off, 
if [[ "$RX2" -gt "$RX1" ]]; then
	rpoll=on
else
	rpoll=off
fi
if [[ "$TX2" -gt "$TX1" ]]; then
	tpoll=on
else
	tpoll=off
fi
poll="${tpoll}${rpoll}" # icon to display
echo "icon:$camino/icons/traffic/${poll}.png" > "$track/$i" # display icon

TOTTOT=$((RX2 + TX2 + TOTPREV))
TTTT=$(bytesToHR $TOTTOT)
REC=$(bytesToHR $RX2)
TRN=$(bytesToHR $TX2)

sleep 0.4

[ -f "$camino"/DATA-LIMIT ] && export DATALIMIT=`cat "$camino"/DATA-LIMIT`

if [ ! -z "$DATALIMIT" ]; then
	INFO=`iwconfig "$i" | grep -e ESSID -e 'Access Point' | rev | awk -F' ' '{print $1}' | rev`
	SSID=`echo "$INFO" | head -1 | cut -f2 -d'"'`
	BSSID=`echo "$INFO" | tail -1`
	export TOTTOT=$((((RX2 + TX2 + TOTPREV) / 1024) / 1024))
	echo "tooltip:Data Limit: ${DATALIMIT} MB\nData Used: ${TTTT}\nAP: $SSID\nMAC: $BSSID\niFace: $int\nIPv4 Address: ${ip4}\nIPv6 Address: ${ip6}\nRx: $REC\nTx: $TRN" >> "$track/$i" # icon info on cursor hover
	TOT=$((TOTTOT + 100))
		if [[ "$TOT" -gt "$DATALIMIT" ]]; then
			echo "tooltip:WARNING!!! Data Limit: ${DATALIMIT}MB\nData Used: ${TTTT} \n DATA LIMIT REACHED!!!" >> "$track/$i"
			echo "icon:$camino/icons/red.png" > "$track/$i"
			sleep 1
			echo "icon:$camino/icons/traffic/$poll.png" > "$track/$i"
			sleep 1
			echo "icon:$camino/icons/red.png" > "$track/$i"
		fi
	TOT=$(((TOTTOT - 100)))
else
	echo "tooltip:iFace: $i\nIPv4 Address: ${ip4}\nIPv6 Address: ${ip6}\nRx: $REC\nTx: $TRN" >> "$track/$i"
fi
unset TOTTOT
if [[ -z `ifconfig | grep $i` ]]; then
	echo "tooltip:iFace: $i is DOWN\nIPv4 Address: ${ip4}\nIPv6 Address: ${ip6}\nRx: $REC\nTx: $TRN" >> "$track/$i"
	echo "icon:$camino/icons/network.png" > "$track/$i"
fi
done &
done
Post Reply

Return to “Network”