munin plugin for nginx

Grant emailgrant at gmail.com
Tue Jun 18 14:10:12 UTC 2013


> My config looks like:
>
> /etc/munin/plugin-conf.d/munin-node
>
> ...
> [nginx_*]
> user root
>
> /etc/nginx/sites-enabled/default

I don't have /etc/nginx/sites-enabled/ at all.  What kind of stuff is
in the default file?  I'm on Gentoo.

- Grant


> ...
> ## munin nginx status (request/ connections handeled)
> location /nginx_status {
>    stub_status on;
>    access_log   off;
>    allow 127.0.0.1;
>    deny all;
> }
> ...
> This runs for me very well, so try to edit your
> /etc/munin/plugin-conf.d/munin-node.
> You can also Debug by
>
>  munin-configure --suggest
>
> Am 18.06.2013 15:42, schrieb Grant:
>>>>> 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.
>> You fixed it!  Reducing it to the simplest config that still works, I
>> found that the location /nginx_status block doesn't work with munin
>> inside of any other server block.  It only works inside its own server
>> block like so:
>>
>> server {
>>    location ~ ^/nginx_status$ {
>>       stub_status on;
>>       access_log off;
>>       allow 127.0.0.1;
>>       deny all;
>>    }
>> }
>>
>> Is this a munin bug?
>>
>> Thank you!
>>
>> - Grant



More information about the nginx mailing list