- page: Installation and overview of Munin server monitor system
- page: Install, uninstall, and set password protection for Munin plugins
The 1. page content
- Installing Munin
- Web interface overview
By making the web and other services running on our server available to the public, there may be a need for an all-encompassing monitoring system that can track information about the utilization of various resources on our server from a single location. Many of these softwares are available nowadays, and in this tutorial we will look at installing and setting up the server monitor program Munin on Debian 9 (Stretch) and Debian 10 (Buster).
Munin is a lightweight program written in Perl that runs in the background (cron) and collects information from all corners of the system from which it builds its database. The other part of the program is making graphs of the data collected and then making it available through the web server. The greatness of the system lies in its simplicity: there is nothing chilly-wild, just png images pasted into simple html pages in the form of statistics. In addition, due to its modular structure, many plugins can be obtained, such as GitHub Munin from their contributors page. Its interface is very simple, so you can easily control every point of your server. The system, which is inseparable from its central part, It consists of nodes that must be installed on the server you want to monitor and run on, which then sends the data to the central part. Thanks to this, Munin can monitor multiple servers from one place at a time, but in this guide we will only try the application installed on one machine.
Munin Server Monitor can be installed on virtually any Debian environment, but due to the differences in functionality between the Debian repositories, we only deal with the versions available on Debian 9 and Debian 10. Previously stored in Debian 8 (Jessie) the difference the package is so old that it had to be brought to life in a different way. Thus, this description can be used to install Munin server statistics on any of the following server configurations:
- Debian 9 (Stretch) minimum server (Installation guide | download virtual machine)
- Debian 10 (Buster) minimum server (Installation guide | download virtual machine)
- Debian 9 (Stretch) LAMP Server v1.0 (Installation guide | download virtual machine)
- Debian 10 (Buster) LAMP Server v1.0 (Installation guide | download virtual machine)
- Perfect server: Debian 9 (stretch) v1.0 (Installation guide | download virtual machine) (installed)
- Perfect server: Debian 10 (Buster) v1.0 (Installation guide | download virtual machine) (installed)
Of course, the more sophisticated our server is, the more services Munin can monitor, so the more justified it is to use. Of the above, I tested the installation of Munin on the two highlighted servers. Accordingly, newer versions of the servers will already include this add-on.
For Debian 9 (Stretch), set up the backports repository
Debian 9 (Stretch) backports repository available at munin package 2.0.49version, which is the same as the Debian 10 (Buster) repository versions. Therefore, if you are installing on Debian 9, you need to configure the backports repository, because 2.0.33version.
To configure the repository, log in as root and open /etc/apt/sources.list in the dwarf-with:
And add the following lines:
deb http://ftp.debian.org/debian stretch-backports main contrib non-free deb-src http://ftp.debian.org/debian stretch-backports main contrib non-free
After changing your luggage list, it is strongly recommended that you update your luggage database and packages in the usual way, and before installing smaller or larger ones:
apt-get update apt-get upgrade
Then, looking at the package, you can see the versions:
apt-cache policy munin
Outputs to Debian 9:
And Debian 10:
Package dependencies and installing the base package
Of the server configurations listed above, the perfect servers may already have these packages installed, but to make sure they work everywhere, run the following command:
apt-get -y install \ apache2 \ libapache2-mod-fcgid \ libcgi-fast-perl \ perl perl-base
Enable the fcgid package (this is already enabled on perfect servers):
Then install the Munin system packages.
For Debian 9, install separately from the backports repository:
apt install -t stretch-backports \ munin \ munin-common \ munin-node \ munin-plugins-core \ munin-plugins-extra
And install it on Debian 10 as usual:
apt-get -y install \ munin \ munin-common \ munin-node \ munin-plugins-core \ munin-plugins-extra
Open your configuration file for editing:
And make the following settings:
#dbdir /var/lib/munin #htmldir /var/cache/munin/www #logdir /var/log/munin #rundir /var/run/munin [...] #tmpldir /etc/munin/templates [...] # a simple host tree [szerverünk_FQDN_neve] address 127.0.0.1 use_node_name yes [...]
- Take out the comments highlighted in red
- Slightly below Replace the green highlighted part (in the original file: localhost.localdomain) on our server FQDN name (full name). If we don't know exactly, then this hostname -f command. Here, make sure the server name is enclosed in square brackets.
Open it for editing in Munin Apache configuration file:
And here are some changes:
[...] <Directory /var/cache/munin/www> #Require local Require all granted Options FollowSymLinks SymLinksIfOwnerMatch Options None </Directory> <Directory /usr/lib/munin/cgi> #Require local Require all granted Options FollowSymLinks SymLinksIfOwnerMatch <IfModule mod_fcgid.c> SetHandler fcgid-script </IfModule> <IfModule !mod_fcgid.c> SetHandler cgi-script </IfModule> </Directory> [...]
Here, too, in both blocks, comment on the Require local lines, and insert the extra 2x2 lines according to the green pattern.
Then restart Apache and munin node:
systemctl restart apache2 systemctl restart munin-node
Control of Munin
Check our Munin system in the browser server IP addresses or your hostname / munin subdirectory:
If we have done everything right, your start page will come in. In the left menu you can look at the graphs. But that's about the end of the description.
So Munin's core system comes to life, which already contains some plugins, but we can still install some as we like.
Web interface overview
This section was originally dedicated to the third page, but since the second page is longer than planned, it will provide a more optimal place to review web graphs. So the pictures in this section were taken after installing and configuring the plugins, so there are many more menus and graphs available. Of course, we do not cover every graph, only the most important ones. In addition, there are parts that do not work on the virtual machine (eg temperature sensors), which I replace with my server as a sample.
The interface itself, as I mentioned at the beginning, is very simple, low-cost, and in return we get an easy-to-read, almost comprehensive server analysis. Let's see Munin in action!
So when you re-enter the homepage, there are more categories of menus:
Going to the apache menu we find some graphs:
Here you can see daily graphs of the various states of Apache. For example, how many hits are sent to the server on average per second, how many Apache workflows are currently running, etc ...
Clicking on any graph image will bring you to a more detailed page showing the daily, weekly, monthly and yearly graphs for that graph:
The graphs appear in the same way in other menus. As I mentioned, the interface is very simple, but with informative graphs you can get a quick overview of the status of our server.
The graph outages occurred during the virtual machine downtime as I have been making this description for several days and the virtual machine is not running continuously.
In this menu you can get detailed information about the hard drives in your machine:
There are a lot of graphs here, scrolling down a bit is worth mentioning also the data transfer and utilization graphs:
This virtual machine is, of course, idle, but with a richer server running multiple web pages, we can get usable data about how our drives are performing.
Mysql and mysql2
In the two mysql menus you can get a plethora of graphs for everything with your database server:
Scrolling down a bit further, this graph just shows the rate at which SQL operations are running on the server. For example, it can be used to assess how web pages you run use databases (read / write) to optimally select, for example, the ASPs and their deployment scheme (eg raid settings) for the next server build.
Monetize through partnering networks
There are many things you can do in the network section too:
For example, the amount of data passing through our firewall or the speed of HTTP page downloads. A little further down the Fail2Ban You can also find out the number of IP addresses blocked by. Interestingly, here's my monthly Fail2Ban image on my server:
Here, for example, the point is that since I banned a lot of robots, since then, the amount of prohibited IP addresses has fluctuated periodically, so they periodically try to come back. (But in return, there is no unnecessary CPU load ...)
Here you can keep track of the temperatures of different hardware and things like that:
Since they don't work in the virtual machine, I borrowed them from my server for illustration.
And finally, we also look at the system menu, which still has many graphs, some of which are:
Of course, there are plenty of graphs in the system too, all of which would be superfluous to list here.
A next page we continue with the installation, management and use of the Munin plugins.