Adding Nginx plugin to munin in Cpanel servers

In munin different plugins have different permission or settings to fetch the data. Easiest way to get that information is by running command

cd /etc/munin/plugins
munin-run PLUGINNAME

To setup the nginx modules, we need to give url to the munin from where it can fetch data: 

setting up url just for munin as location host: 

open and edit the nginx config file, ( you can also create seperate vhost files for this configuration)

for nginx main config file you can edit nginx.conf inside /etc/nginx/ by command line vi /etc/nginx/nginx.conf

server {
       listen 127.0.0.1;
       server_name localhost;
       location /nginx_status {
               stub_status on;
               access_log   off;
               allow 127.0.0.1;
               deny all;
       }
 }


To create a seperate vhost file:
 you can create the vhost file eg: nginx-example inside /etc/nginx/vhost/
and copy and past above data. 

Setting munin to point to the file: 
Open the cpanel.conf inside /etc/munin/plugin-conf.d and add or edit the line 

[nginx plugin name ]
env.url http://localhost/nginx_status

restart the nginx server by : 
service nginx restart

and also restart the munin node 
service munin-node restartwait 10 to 15 min for muinin to gather data.
Advertisements