vnstat

Ayer: Yesterday     Hoy: Today
Semana: Week     Mes: Month

After installing vnstat you have to create a database for it to work from:

sudo vnstat -u -i eth0

(change eth0 for your network interface)

First time you run it you’ll see:

~$ sudo vnstat -u -i eth0
Error:
Unable to read database "/var/lib/vnstat/eth0".
-> A new database has been created.
 
~$

The code that produced the image above:

${goto 10}${font DejaVu Sans Mono:bold:size=9}  ${color5}Ayer:${color3} ${execi 300 vnstat | grep "yesterday" | awk '{print $2 $3}'}${goto 140}${color9}${execi 300 vnstat | grep "yesterday" | awk '{print $5 $6}'}${goto 205}${color5}${execi 300 vnstat | grep "yesterday" | awk '{print $8 $9}'}
${goto 10}   ${color5}Hoy:${color3} ${execi 300 vnstat | grep "today" | awk '{print $2 $3}'}${goto 140}${color9}${execi 300 vnstat | grep "today" | awk '{print $5 $6}'}${goto 205}${color5}${execi 300 vnstat | grep "today" | awk '{print $8 $9}'}
${goto 10}${color5}Semana: ${color3}${execi 300 vnstat -w | grep "current week" | awk '{print $3 $4}'}${goto 140}${color9}${execi 300 vnstat -w | grep "current week" | awk '{print $6 $7}'}${goto 205}${color5}${execi 300 vnstat -w | grep "current week" | awk '{print $9 $10}'}
${goto 10}   ${color5}Mes: ${color3}${execi 300 vnstat -m | grep "`date +"%b '%y"`" | awk '{print $3 $4}'}${goto 140}${color9}${execi 300 vnstat -m | grep "`date +"%b '%y"`" | awk '{print $6 $7}'}${goto 205}${color5}${execi 300 vnstat -m | grep "`date +"%b '%y"`" | awk '{print $9 $10}'}${font}

Have a nice day.
Bruce