Skip to main content Logo (IEC resistor symbol) logo

Quis custodiet ipsos custodes?
Home | About | All pages | RSS Feed | Gopher

Munin - Set up the NGINX status plugin on Ubuntu 12.04

Published: 31-01-2013 | Author: Remy van Elst | Text only version of this article

Table of Contents

This little tutorial will show you how to set up the Munin plugin to monitor NGINX (nginx request and nginx status) and graph it. You need to change some URLs in the config because by default this is wrong.

If you like this article, consider sponsoring me by trying out a Digital Ocean VPS. With this link you'll get $100 credit for 60 days). (referral link)

For this tutorial you need to have a munin server and a NGINX server. All commands need to be run as root or a superuser.

First enable the nginx status page:

## Edit your nginx configuration (vhost) and add this in a server {} block
location /nginx_status {
    stub_status on;
    access_log off;
    deny all;

The above config will enable the status module only for the localhost, without access logging. This means that nobody other than munin can access the status page.

Now execute this command to change the munin configuration to have the correct URL for the plugin:

if [[ $(cat /etc/munin/plugin-conf.d/munin-node | grep "nginx") = "" ]]; then echo -e "\n[nginx*]\nenv.url http://localhost/nginx_status" >> /etc/munin/plugin-conf.d/munin-node; fi

Then configure the munin plugins:

munin-node-configure --suggest --shell | sh

This creates the symlinks in the /etc/munin/plugins/ folder. If they are note there, ln -s them yourself.

Finally restart munin:

/etc/init.d/munin-node restart

Done. You will now have nice nginx ghraps like below:


Tags: debian , monitoring , munin , nginx , snippets , ubuntu