Nicola Ferrari (#554252) <[email protected]> wrote:
> Is there any better way to proceed?
Now I've got access to some of my saved bits, this is how I got interface stats
- not really my own work, someone else suggested ways of doing it in Bash
without spawning masses of new processes and chewing through CPU cycles. The
trick is doing almost all the work using internal text operators in Bash - the
only new processes spawned each cycle are for the date/time and the update.
#!/bin/bash
# Get traffic count from interface counters of global interface
HostName=$( /usr/bin/head -1 /etc/hostname )
while true
do
TimeStamp=$( /bin/date +%s )
Utmp=$(< /proc/net/dev)
Utmp=(${Utmp#*ethext:})
UpdateVal=${Utmp[0]}:${Utmp[8]}
/usr/bin/rrdtool update ${HostName}/global.rrd --daemon xx.xx.xx.xx
"${TimeStamp}:${UpdateVal}"
sleep 2
done
Feel free to copy, adapt, or just ignore as best fits your needs.
_______________________________________________
Shorewall-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/shorewall-users