Monitor Dreamhost VPS performance, load, etc with munin

Date: Fri Apr 25 2014 Dreamhost »»»» Server Monitoring »»»» Munin

 

Dreamhost has this wonderful virtual-private-server (VPS) offering that's pretty easy to use. They offer excellent hand-holding (administrative support) and the control panel offers a lot of flexibility. In the control panel is a section on VPS resources which graphs memory and load average. The resource graph is useful, almost. In fact, it's nice and pretty, but when push comes to shove, specifically when you're puzzling over what's actually happening on your server, it's not very useful at all. Fortunately the open source world has developed lots of management tools, and one which is trivial to install on a Dreamhost VPS is Munin. Munin offers excellent and detailed graphing of various important server parameters, and is trivial to install on a Dreamhost VPS. But for some reason, Dreamhost doesn't document the installation on their wiki.

The simplicity of installing Munin comes because the Dreamhost servers are a Debian derivative. Hence, the "install Munin on Debian" instructions work perfectly.

What is Munin?

They say: "Munin is a networked resource monitoring tool that can help analyze resource trends and "what just happened to kill our performance?" problems. It is designed to be very plug and play. A default installation provides a lot of graphs with almost no work." Their page goes on to retell a bit of Norse legends and say that "Munin" means "memory".

What Munin does is record various bits of performance data, and graph the data on web pages.

It can retrieve the performance data from a network of hosts, collecting them to a central host on an easily browseable page.

Munin-node and Munin-master

Munin is a networked thingymagig. Munin-node is installed on each node you wish to monitor, the Munin-master is installed on one system. Munin-master reaches out to collect data from each munin-node, and it's the munin-master which presents the data on web pages.

Installing the default munin on Dreamhost VPS (or other Debian/Ubuntu)

 

Munin node: apt-get install munin-node
Munin master: apt-get install munin

 

I have multiple Dreamhost VPS's. I've declared one of them to be the master. On that one I run "apt-get install munin" and on the others I instead install munin-node. The dependencies are set up so that installing munin also installs munin-node.

The Munin Wiki has instructions for other Linux flavors, for Solaris, for Mac OS X, etc.

Configuring munin-node for simple monitoring

The configuration files and plugins available for munin are quite extensive. Out of the box it's set up for a range of useful things to monitor, and the person who packages this for Debian made the default configuration pretty good.

The config files for Munin are in: /etc/munin

If you've only installed munin-node the directory structure looks like this:

 

root@...:/etc/munin# pwd
/etc/munin
root@...:/etc/munin# ls
munin-node.conf plugin-conf.d plugins
root@...:/etc/munin# ls plugins/
cpu df_inode forks if_err_eth1 if_eth1 irqstats memory open_files postfix_mailqueue swap
df entropy if_err_eth0 if_eth0 interrupts load netstat open_inodes processes
root@...:/etc/munin#

 

The file munin-node.conf is the primary configuration file. There is almost nothing to configure. Two lines are: "host_name" and "allow". The "host_name" line lets you change what name it reports, while the "allow" line controls which munin masters can access this munin node.

The munin-node package doesn't do any reporting, there's no web page to visit, etc. That's provided by the "munin" package (munin master).

Configuring munin master to report on one or more munin-node's

Installing the munin package adds a new configuration file, munin.conf.

Out of the box it gathers data and generates reports for the munin-node on the local host. This is the relevant portion of the config file:

 

# a simple host tree
[localhost.localdomain]
address 127.0.0.1
use_node_name yes

 

If you have more munin-node installations add more sections like the above. However, within the square brackets put the host name, and on the address line put the IP address, like so:

 

[ps_____.dreamhostps.com]
address 173.___.___.___
use_node_name yes

 

Getting munin's web pages to be browseable by a web browser

The point to this is to view reports generated by munin. The default munin.conf file has a directive "htmldir /var/www/munin" and out of the box that's where the reports go.

What I've done is create a subdomain of one of my domains. In the Dreamhost control panel, navigate to the "Manage Domains" section, click on "Add new domain or subdomain" button at the top.

Enter something like "munin.example.com" as a subdomain of one of your domains. In the user name dropdown, select a user that's on the VPS where the munin master software is installed. Then enter a string for the web directory. Note that Dreamhosts' control panel forces the website for a domain to be in the home directory of a user on that server. It doesn't allow you to enter /var/www/munin.

Because of this we have to do something to connect that subomain so it displays the munin HTML report files.

What I did was to use a symbolic link:

 

$ rm -rf munin.example.com
$ ln -s /var/www/munin munin.example.com

 

But on re-reading the configuration instructions it should be enough to change munin.conf to read

 

htmldir /home/____/munin.example.com

 

Summary

What you've seen is the simplicity of installing munin on a Dreamhost VPS. It's trivial to get a useful out-of-the-box experience and monitor a network of VPS's with this stuff. Quite excellent.

 

link:http://munin-monitoring.org/
http://munin-monitoring.org/wiki/LinuxInstallation