2012-04-17 23:49:02 +02:00
# The 'byprojects' family
2012-12-13 04:56:38 +01:00
Those plugins are used to monitor different projects or vhost (i.e. either different log files or using regular expression as filters) on the same web server.
2012-04-17 23:49:02 +02:00
## munin_byprojects_access
Count the number of hits per projects/vhost.
![byproject_access ](https://www.mantor.org/~northox/misc/munin-plugins/nginx_byprojects_access1-month.png "byproject_access" )
## munin_byprojects_bandwidth
2017-07-08 10:59:33 +02:00
Count the total bandwidth used by each projects/vhost. [Logtail ](https://www.fourmilab.ch/webtools/logtail/ ) is required.
2012-04-17 23:49:02 +02:00
![byproject_bandwidth ](https://www.mantor.org/~northox/misc/munin-plugins/apache_byprojects_bandwidth-month.png "byproject_bandwidth" )
## munin_byprojects_inout_bandwidth
2017-07-08 10:59:33 +02:00
Counts the in/out bandwidth used by each projects/vhost. [Logtail ](https://www.fourmilab.ch/webtools/logtail/ ) is required.
2012-04-17 23:49:02 +02:00
![byproject_inout_bandwidth ](https://www.mantor.org/~northox/misc/munin-plugins/apache_byprojects_inout_bandwidth-month.png "byproject_inout_bandwidth" )
## Installation
2012-12-13 04:56:38 +01:00
The setup is pretty straight forward. First you need to configure the plugin:
2012-04-17 23:49:02 +02:00
2017-07-08 09:16:07 +02:00
In your munin plugin configuration file (for example, a new dedicated /etc/munin/plugin-conf.d/nginx_byprojects), configure the plugins :
2012-04-17 23:49:02 +02:00
2017-07-08 09:16:07 +02:00
[byprojects_*]
env.logtail /usr/local/bin/logtail
2012-04-17 23:49:02 +02:00
2017-07-08 10:36:46 +02:00
Multiple logs can be used for the same project/vhost and a regular expression (regex) can be used as a filter.
Each log is defined in a dedicated environment variable, named env.site.[siteName]. The value is JSON formatted.
env.site.prod [{"path":"/home/prod/log/access.log"}]
env.site.dev [{"path":"/var/log/httpd/ssl-dev-access.log"}, {"path":"/home/dev/log/access*.log"}]
env.site.test [{"path":"/var/log/access.log","regex":"\"[A-Z]+ /test/"}, {"path":"/home/test/log/access.log"}]
2012-04-17 23:49:02 +02:00
In the previous example the prod project graph will be using everything in /home/prod/log/access.log. The test project will be using eveything in /home/test/log/access.log and stuff that match '"[A-Z] /test/' in /var/log/httpd/access.log (e.g. "GET /test/).
Then link the file just as any other plugins.
2012-12-13 04:56:38 +01:00
ln -s /usr/local/sbin/< plugin > /usr/local/etc/munin/plugins/< plugin >
2013-07-02 04:42:28 +02:00
2017-07-08 10:59:33 +02:00
And restart the munin-node service.
2013-07-02 04:42:28 +02:00
## License
MIT