Halaman

Jumat, 21 Maret 2014

How to set up Munin Server Monitoring

Munin is an excellent tool for monitoring the status of your server. Munin highlighted it's usefulness to us when trying to diagnose a recent problem with one of our servers.

There are two components to Munin, Munin Server and Munin Node. The Munin Server stores all of the data and presents it for viewing as a web page as well as keeping a track of which nodes are being monitored. The Munin Node runs as a service on the server that is being monitored, collects all of the required data and sends it back to the server.

In this article I am going to assume that we are running 2 servers, both Ubuntu 12.04.

Munin Server - munin-server.example.com
Munin Node - munin-node.example.com
Setting up Munin Server (munin-server.example.com)

First of all you will need to be running Apache so that the results pages can be viewed. All commands in the article should be run as the root user.

apt-get install apache2

Now we can install the munin server:

apt-get install munin

Now we need to configure apache to serve up the reports. You can add these directives to your global apache config file found at /etc/apache2/apache2.conf or if you only want munin to be accessible on a single virtual host you can add these directives to that single virtual host config. We will also configure the reports to be protected from public reading using basic HTTP Authentication.

Alias /munin /var/cache/munin/www
<Directory /var/cache/munin/www>
       Order allow,deny
       Allow from all
       Options None
       AllowOverride None

       AuthUserFile /etc/munin/munin-htpasswd
       AuthName "Munin"
       AuthType Basic
       require valid-user

       <ifmodule mod_expires.c="">
               ExpiresActive On
               ExpiresDefault M310
      </ifmodule>
</Directory>

The Expires rules are set to make sure that your browser doesn't cache any of the images that are generated so that you are always viewing up to date data.

Finally we need to create a user (munin) to view the Munin reports pages with:

htpasswd -c /etc/munin/munin-htpasswd munin

After you are prompted to enter your password then restart apache and the server is configured.

service apache2 restart

You can access the stats by going to http://munin-server.example.com/munin but first we need to set up a node so that we actually have some statistics to view.

Setting up Munin Node

First we need to make the Munin Server aware of the node so add the following to /etc/munin/munin.conf on the Munin Server

[munin-node.example.com]
    address munin-node.example.com
    use_node_name yes

You can add as many of these entries as you like for each server you wish to monitor.

No we need to install Munin Node on the server we wish to monitor. The following configuration is all done on the Munin Node server.

apt-get install munin-node

Then we must allow the server to connect and get results so add the following line to /etc/munin/munin-node.conf

allow ^123\.123\.123\.123$

Where the IP address of the Munin Server is 123.123.123.123. You will also need to make sure that your firewall is also permitting connections from the server on port 4949.

Now restart the node and after a few minutes you should start to see your stats appearing on the server report pages.

service munin-node restart

Reference : http://superrb.com/blog/2013/08/01/how-to-set-up-munin-server-monitoring-on-ubuntu

Tidak ada komentar:

Posting Komentar