Munin - a great thing. A lot of various plug-ins allow to look through statistics of loading practically all linux system services.
When you host many sites, there is necessary to know, which of them consumes the most of all resources. Besides the standard plug-ins, there is one, which shows traffic of sites in nginx. However , there is a plug-in option with defects in public.
Faulty plug-in is bad, so will will fix. Fixed you can download here.
In configuration nginx (/etc/nginx/nginx.conf) you should write:
log_format main '"$remote_addr" $host [$time_local] ' '"$request" $status $body_bytes_sent ' '$request_length $bytes_sent "$http_referer" ' '"$http_user_agent" $request_time "$gzip_ratio"';
To operate, plug-in needs to have all the logs from all the sites in one file. In each site configuration write:
access_log /var/log/nginx/access_big.log main; error_log /var/log/nginx/error_big.log;
Add into Munin configuration:
[nginx_vhost_traffic] group adm env.vhosts mygento.net example.ru exmaple.com env.logdir /var/log/nginx env.logfile access_big.log
Do the restart (/etc/init.d/munin-node restart) wait for five minutes and enjoy.
By the way, logtail must be installed for proper operation.