munin plugin for nginx

Steve Holdoway steve at greengecko.co.nz
Mon Jun 17 06:44:50 UTC 2013


On Mon, 2013-06-17 at 16:34 +1000, Daniel Black wrote:
> 
> ----- Original Message -----
> > I'm having some trouble getting the nginx plugin working for munin.
> > I've added the following to nginx config and restarted:
> > 
> > location /nginx_status {
> > stub_status on;
> > access_log off;
> > allow 127.0.0.1;
> > deny all;
> > }
> > 
> > I've added the following munin config:
> > 
> > [nginx*]
> > env.url http://localhost/nginx_status
> > 
> > Unfortunately I still get:
> > 
> > # munin-run nginx_request
> > request.value U
> > # munin-run nginx_status
> > total.value U
> > reading.value U
> > writing.value U
> > waiting.value U
> > 
> > If I remove the allow/deny, I can browse to /nginx_status and I get:
> > 
> > Active connections: 13
> > server accepts handled requests
> > 15 15 16
> > Reading: 0 Writing: 1 Waiting: 12
> > 
> > What could be the problem?
> 
> the munin plugin is broken or not getting the status information.
> 
> Try stracing the munin-run, network capature or turning on the access logs on /nginx_status just to be sure.
> 

Well, I run it all over the place with no problem. I usually set it up
only on localhost 

server {
        listen 127.0.0.1:80 default;
        server_name localhost;
	root   /var/www;

        access_log  /var/log/nginx/localhost.access.log;
        error_log  /var/log/nginx/localhost.error.log;

        location ~ /nginx_status {
                stub_status on;
                access_log   off;
                allow 127.0.0.1;
                deny all;
        }
}

( in /etc/nginx/conf.d/stub, or /etc/nginx/sites-available/stub,
symlinked to ../sites-enabled/stub depending on preference ) and restart
nginx. 

Then test this bit works...

$ wget -O - http://localhost/nginx_status 2> /dev/null
Active connections: 1 
server accepts handled requests
 67892 67892 70215 
Reading: 0 Writing: 1 Waiting: 0

Some os's seem to like

[nginx*]
env.url http://localhost/nginx_status

added to /etc/munin/plugin-conf.d/munin_node

then 

munin-run nginx_status 

should run just fine.


Steve

-- 
Steve Holdoway BSc(Hons) MNZCS 
http://www.greengecko.co.nz
Linkedin: http://www.linkedin.com/in/steveholdoway
Skype: sholdowa



More information about the nginx mailing list