Munin

From LinuxReviews
Jump to navigationJump to search
Munin
Munin v2.0.64
Munin v2.0.64
Original author(s)The Norwegians (Audun Ytterdal, Jimmy Olsen, and Tore Anderson)
Developer(s)The Norwegians and other contributors
Initial release2003
Stable release
2.0.64 / July 8, 2020; 17 months ago (2020-07-08)
Preview release
2.999.15 / July 8, 2020; 17 months ago (2020-07-08)
Repositorygithub.com /munin-monitoring/munin/
Written inPerl
Operating systemLinux
LicenseGNU General Public License Version 2
Documentationguide.munin-monitoring.org /en/latest/
Websitemunin-monitoring.org
Gnome-system-monitor-icon.png

Munin is a pluggable system monitoring suite capable of monitoring system load, network load, applications and much more on servers, routers and other gear. It is written by the Norwegians in Perl. Munin consists of two specialized programs: munin-node collects information from local or remote servers and the munin tool generates a web page with nice graphs of everything monitored by munin-node using RRDtool. A running web server is required to view the graphs.

Munin makes graphs showing daily, weekly, monthly and yearly statistics of all the things that are monitored by munin-node. This makes it easy to see how CPU use, memory use, network bandwidth and other things change over time. The graphics munin generate can be very useful if your servers load increases and you need to ascertain if you need more memory or faster I/O or something else.

Munin 2.x will, with the default configuration, simply dump HTML files and images in /var/www/html/munin/. You will need to have a web server like Apache or Nginx running on the box where you run the munin master monitoring program.

Munin 3.x comes with a basic web server (munin-httpd) you can access directly (or through a reverse proxy). You won't have it unless you installed the git version (or much time passed since this was written).

The munin-node data collector will run on any box capable of running Perl programs. It does not require much, you can run it on simple routers running openwrt firmware.

It Is All About Them Plugins[edit]

Munin in very pluggable. The munin-node core package comes with monitoring plugins for all the basics like CPU utilization, memory use, disk I/O, interrupts, IRQ statistics, CPU frequencies, fan and temperature sensors, running processes, open files, open inodes and much more. There are also quite a few application specific plugins for applications Apache, Postfix, Sendmail, MySQL (or MariaDB) and Squid in the base distributions.

A rather huge amount of "3rd-party plugins" are available from github.com /munin-monitoring/contrib. Most of these plugins are briefly described, with basic documentation, in the the Munin Plugin Gallery at gallery.munin-monitoring.org/contrib/.

Installation And Configuration[edit]

Munin-2.0.64-03.jpg
Munin 2.0.64 showing CPU frequencies on two boxes throughout a day.

Installing munin is in theory as easy as installing either just the munin-node package for pure monitoring or both munin-node munin on the box you want to use to create graphs and access the monitoring webpage.

Munin does not come with a SELinux policy. You will have to create a SELinux policy for Munin if you want to run it on a RHEL or Fedora box where SELinux is enabled, neither munin-node or munin will start if you do not make and enable a proper SELinux policy.

Munin-Node[edit]

The munin-node component is configured by the configuration file /etc/munin/munin-node.conf and configuration files for individual plugins in /etc/munin/plugin-conf.d. Plugins are enabled by making symbolic links in /etc/munin/plugins/

Munin-node uses TCP port 4949 to communicate. Nodes must allow the server where munin is running access through this port with a firewall rule that could look something like iptables -A INPUT -s 110.249.164..0/24 -p tcp --dport 4949 -j ACCEPT).

Munin-node should run as a systemd service. You can start and permanently enable it with:

systemctl enable --now munin-node

Munin-node will enable a lot of plugins by creating symbolic links from /etc/munin/plugins/ to plugins in /usr/share/munin/plugins/ when it is installed. You can use munin-node-configure to make it show other possibly useful plugins for your system. What plugins are listed depends on what applications are installed, not what plugins are available to munin-node (it will propose the Apache plugins only if you have Apache installed). Running it with the arguments

munin-node-configure --shell  --remove-also

makes munin-node-configure print out a list of ln -s commands you may or may not want to copy and paste.

The symbolic links should go to pluginname and optionally an argument. As an example, symbolic links to the if_ plugin for monitoring network interfaces should be followed by a network interface (like if_bond0). Thus, adding symbolic link entries for bond0 and br0 would be done by:

ln -s /usr/share/munin/plugins/if_ /etc/munin/plugins/if_br0
ln -s /usr/share/munin/plugins/if_ /etc/munin/plugins/if_bond0
Kemonomimi rabbit.svg
Note: Some of the plugins who require arguments do work work the same way as the network interface if_ plugin but some of them do not!
  • The smartctl plugin smart_ takes arguments like smart_sda and smart_sdb.
  • The sensors_ plugin is differnet. It supports sensors_fan, sensors_temp and sensors_volt to show all fans and all temperatures in one graph. It does not support sensors_fan1, sensors_fan2, sensors_CPUfan or similar!

Many plugins require additional configuration such in /etc/munin/plugin-conf.d/. The default /etc/munin/plugin-conf.d/00-default file in there will show you how plugin-specific configuration is done. Plugin configuration is typically documented in the plugin file. The first few lines in http_loadtime (less /usr/share/munin/plugins/http_loadtime) will tell you how you can configure the HTTP(S) web page load time monitor plugin.

Removing plugins from munin-node is a simple matter of eradicating the symbolic links in /etc/munin/plugins:

rm /etc/munin/plugins/if_br0
rm /etc/munin/plugins/if_bond0
Snubbelrisk.jpg
Warning: munin-node will NOT monitor /etc/munin/plugin-conf.d/ or the configuration files for changes. You will have to run
systemctl restart munin-node

to make new changes take effect.

See Munin/Plugin configuration for additional information about Munin/Plugin configuration.

The Munin Graph Generator[edit]

The munin server can be configured by editing /etc/munin/munin.conf but you should configure it by creating or editing configuration files in /etc/munin/conf.d/. You will likely not need anything beyond a list of boxes where munin-node is running:

File: /etc/munin/conf.d/myboxes.conf
[yoona]
    address 127.0.0.1
    use_node_name yes

[seohyun]
    address 85.25.199.78
    use_node_name yes

munin program should be executed as a systemd timer, not a system service. You can enable that timer with:

systemctl enable --now munin.timer

You can see what timers you have enabled by running systemctl list-timers. The munin.timer will run every 5 minutes once it is enabled.

CGI Woes[edit]

There is one aspect of the required server configuration you may find problematic: You will need to configure a web server and point it at /var/www/html/munin/ where the HTML and image files are dropped. That part is easy if you know how to configure a web server.

The HTML code with the graph images will all link to a munin-cgi-graph CGI (Common Gateway Interface requests) Perl binary from 2010 in /var/www/html/munin/cgi/. That munin-cgi-graph Perl program will want to read and write all over the file system. It wants to write to /var/log/munin/munin-cgi-graph.log and /var/lib/munin/cgi-tmp/ and it wants to read from /var/lib/munin/<nodes>. The CGI script is not required unless you want to be able to zoom in on graphs (which means you need them generated in real-time).

Most web servers are not about to let some random weirdo Perl program read and write all over the place. Getting that CGI script to work may be futile and also foolish. A possible "solution" is to edit the /etc/munin/templates/munin-serviceview.tmpl template file responsible for all the links to the CGI script file. Eradicate:

  • <a href="<TMPL_VAR NAME="ZOOMDAY">">
  • <a href="<TMPL_VAR NAME="ZOOMWEEK">">
  • <a href="<TMPL_VAR NAME="ZOOMMONTH">">
  • <a href="<TMPL_VAR NAME="ZOOMYEAR">">

and the corresponding </a> tags from /etc/munin/templates/munin-serviceview.tmpl and you'll never run into CGI errors when you click around on graphs on your server monitoring page.

MuninLite[edit]

MuninLite, available from github.com /munin-monitoring/muninlite, is a shell script implementing the Munin node protocol. It is not part of your the standard Munin packages, it is an alternative to the core munin-node package.

The MuninLite archive is just 20k. It unpacks to a folder that is 160k. You get a 24k large bash script called muninlite once you run make in the muninlite-VERSION folder.

muninlite lets you monitor CPU use, memory use, load, network traffic and a few more basic things as long as you can run bash scripts on a remote machine. You can do less than you can with munin-node but you do not need to have root access or anything beyond regular user access and the ability to run a bash script to use it. That makes it a nice way to provide munin monitoring to routers, VPS servers and cloud servers where running munin-node isn't possible.

Trivia[edit]

Munin is named after one of the two all-seeing ravens the Norwegian Viking God Odin uses to keep track of people down in Midgard (the landmass between Tronheim and Body).

Alternatives[edit]

Nagios and MRTG, both using the same RRDtool Munin uses, are similar to Munin in nature.

Links[edit]

The website is at munin-monitoring.org. Documentation is at guide.munin-monitoring.org /en/latest/ and the source code repository is at https://github.com /munin-monitoring/munin/.

A not actually gallery "Plugin Gallery" (a list of included and third party plugins without images even though "Gallery" implies that there are preview pictures..) is available at gallery.munin-monitoring.org.


Add your comment
LinuxReviews welcomes all comments. If you do not want to be anonymous, register or log in. It is free.