Difference between revisions of "vnstat"
From thelinuxwiki
(→scratch) |
|||
(3 intermediate revisions by one user not shown) | |||
Line 11: | Line 11: | ||
Info: -> A new database has been created. | Info: -> A new database has been created. | ||
+ | |||
+ | == last 24 hours stats, custom output == | ||
+ | I don't like the stats reported by vnstat -h. I am not interested in KB/hour. I want average Mb/s. The following command will give those stats... | ||
+ | |||
+ | # vnstat --dumpdb | grep ^h | awk -F ";" '{ print "hour", $2 "-" $2+1,"rx(Mb/s):", $4/3600000*8, "tx(Mb/s):", $5/3600000*8 }' | ||
+ | |||
+ | == startup == | ||
+ | |||
+ | on redhat and (check point firewalls) | ||
+ | |||
+ | add line | ||
+ | /usr/sbin/vnstatd -d | ||
+ | |||
+ | to | ||
+ | /etc/rc.d/rc3.d/S99local: | ||
== scratch == | == scratch == | ||
+ | |||
+ | |||
+ | create monitor accounts on destinations | ||
+ | configure authorized_keys | ||
+ | test account | ||
+ | install vncstat / vncstatd | ||
+ | add vncstatd to startup | ||
+ | |||
# chown root:monitor /var/lib/vnstat/* | # chown root:monitor /var/lib/vnstat/* | ||
− | echo | + | echo '#!/bin/bash' >> /etc/rc4.d/S11vncstatd |
echo "/usr/sbin/vnstatd -d" >> /etc/rc4.d/S11vncstatd | echo "/usr/sbin/vnstatd -d" >> /etc/rc4.d/S11vncstatd |
Latest revision as of 20:48, 24 May 2014
# vnstat --testkernel
# vnstat --iflist Available interfaces: lo eth0
# vnstat -u -i eth0 Error: Unable to read database "/var/lib/vnstat/eth0". Info: -> A new database has been created.
last 24 hours stats, custom output
I don't like the stats reported by vnstat -h. I am not interested in KB/hour. I want average Mb/s. The following command will give those stats...
# vnstat --dumpdb | grep ^h | awk -F ";" '{ print "hour", $2 "-" $2+1,"rx(Mb/s):", $4/3600000*8, "tx(Mb/s):", $5/3600000*8 }'
startup
on redhat and (check point firewalls)
add line
/usr/sbin/vnstatd -d
to
/etc/rc.d/rc3.d/S99local:
scratch
create monitor accounts on destinations configure authorized_keys test account install vncstat / vncstatd add vncstatd to startup
# chown root:monitor /var/lib/vnstat/* echo '#!/bin/bash' >> /etc/rc4.d/S11vncstatd echo "/usr/sbin/vnstatd -d" >> /etc/rc4.d/S11vncstatd