Monitoring Bandwidth for Individual Virtual Hosts on Nginx

Good Morning Everyone,

I have been doing some research for the last few days, and I can't quite find the right tool for the job. Basically, all I want is a readout of how much bandwidth each of my nginx virtual hosts is using. It doesn't even have to be a pretty graph (although it could be) – a simple numerical display would be fine.

Google Analytics is installed on all of my sites. Its an awesome tool, but as you may know it doesn't report bandwidth. I started looking into programs that I can use on my server to accomplish this task.

I gave Munin a shot, and was directed to the nginxvhosttraffic plugin by some helpful person on the IRC chat. I had a hard time getting the plugin to work, and I thought that Munin was taking up too much resources for my "simple" means. On to the next one…

I've been looking at the log parsers AWStats and Webalizer. They do report bandwidth used, but they also cover about 100+ other things that Google Analytics already takes care of for me. It just seems like overkill to me.

After a while, I realized that for no reason I was limiting myself to web interfaces. A command line readout would work fine for me as well. I found vnStat which would have been PERFECT, but unfortunately you can only make it listen to interfaces, not specific virtual hosts.

I can't be the only one that wants these numbers. The bandwidth graph in the Linode manager is great, but it doesn't provide fine granularity I need to see individual virtual hosts. So what do you guys use? Thanks everyone in advance.

– devsforev

1 Reply

I use a little perl script I snagged from my previous host that parses Apache's access logs and gathers the total hits and bandwidth served in B, KB and MB

Without giving out a script I don't have permission to share I did a bit of searching and found this:

http://www.intuitive.com/wicked/84-expl … ript.shtml">http://www.intuitive.com/wicked/84-exploring-apache-access_log-shell-script.shtml

also:

http://search.cpan.org/~akira/Apache-Pa … arseLog.pm">http://search.cpan.org/~akira/Apache-ParseLog-1.02/ParseLog.pm

There might be more help here too:

http://www.google.com/search?q=print+total+hits+bytes

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct