New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
CentOS/Debian - Total Monthly Traffic tool?
I have a bunch of CentOS 5/6 boxes plus a couple of Debian servers. I'm looking for some sort of tool that runs in the background that will give me total traffic that is passed through the network adapter each month. Nothing fancy needed like graphs or anything like that...just the raw MB/GB numbers. I realize that I could get these same numbers from the OpenVZ control panels that are hosting my VMs, but that requires a whole lot more work than just SSH'ing into my VM and dumping the number from the console.
Anyone know of such a tool? Thanks!
Comments
vnstat should do the trick.
Cacti for example.
Or observium.
Or any other server monitoring tool.
Here's a simple bash script since you have a lot of boxes. This will read the SSH credentials per box and output the bandwidth usage according to "ifconfig eth0". You may use any other command there of course to execute a specific command for other purposes - modify the "file" variable to the file where you keep the credentials:
P.S You must have "sshpass". To install it, execute "yum install sshpass" on CentOS; there should also be an entry for that host inside ~/.ssh/known_hosts for this to work. If there isn't, connect the first time normally through "ssh" and then press "y" when prompted to add the host to the known hosts.
Example boxes file:
vnstat is quick and easy to use and install for openvz and kvm.
vnstat -d for daily usage
vnstat -m for monthly usage
I'm giving vnstat a go... However, with vnstat, how do you do create a database on the venet0:0 adapter? I get this error on that adapter but it seems to work on the tun0 adapter:
Thanks for the help.
Venet0:0 is not an interface. It's an alias.
Venet0 is the interface.
Sure enough, if I target that, it works. Thanks!
You're most welcome .
Have a lovely weekend. Don't work too much!
Nifty script. I'll have to implement something like this later on. I had no idea that running the ifconfig command with a specific adapter dumped out all that extra info. Thanks!