Can set your own icons (I have nice up and down arrows).
Make sure you have bc installed, for Debian based systems the command to install it is usually: apt-get install bc
Here's the startup.sh I use to loop the script in screen:
Code: Select all
# Start dd-wrt monitor
/usr/bin/screen -S dd-wrtmonitor -d -m /root/dd-wrt/dd-wrt.sh
Code: Select all
#!/bin/bash
while true; do
# Get internet usage upload / download and load it into Domoticz
currentmonth=$(date +"%B %Y")
dayandyear=$(date +"%m-%Y")
incoming=$(curl -s "http://DDWRTUSERNAME:[email protected]/ttgraph.cgi?"$dayandyear"" | grep "$currentmonth" | tail -n 1 | awk '{print $4}')
incomingconvertedtoGB=$(echo "$incoming" / 1024 | bc -l | sed 's/\(\.[0-9][0-9]\)[0-9]*/\1/g')
outgoing=$(curl -s "http://DDWRTUSERNAME:[email protected]/ttgraph.cgi?"$dayandyear"" | grep "$currentmonth" | tail -n 1 | awk '{print $8}')
outgoingconvertedtoGB=$(echo "$outgoing" / 1024 | bc -l | sed 's/\(\.[0-9][0-9]\)[0-9]*/\1/g')
curl -s "http://DOMOTICZUSERNAME:[email protected]/json.htm?type=command¶m=udevice&idx=377&svalue=${incomingconvertedtoGB}"
curl -s "http://DOMOTICZUSERNAME:[email protected]/json.htm?type=command¶m=udevice&idx=378&svalue=${outgoingconvertedtoGB}"
echo "Download:" "$incomingconvertedtoGB" "GB" "Upload:" "$outgoingconvertedtoGB" "GB"
sleep 60
done