In this guide, we are going to learn how to install Monitorix on Ubuntu 20.04. Monitorix is an open source, system monitoring tool that is used to monitor variou services and system resources as outlined below;
- System load average and usage
- Disk drive temperatures and health
- Filesystem usage and I/O activity
- Directory usage
- Netstat statistics
- Users using the system
- Network port traffic
Read more about the features on the Monitorix features page.
Table of Contents
Installing Monitorix on Ubuntu 20.04
Install IzzySoft Apt Repositories on Ubuntu
As much as you can install it using the DEB binary, it is easier to install if from the Apt repositories since APT automatically takes care of the dependencies and also offers updates when available. The repos also provides latest versions of Monitorix package.
IzzySoft Apt repositories provides Monitorix package on Ubuntu systems. You can install it as follows;
echo "deb https://apt.izzysoft.de/ubuntu generic universe" > /etc/apt/sources.list.d/monitorix.list
Install IzzySoft Apt repositories signing key;
wget -qO- https://apt.izzysoft.de/izzysoft.asc | apt-key add -
Run system update;
apt update
Install Monitorix
Then install Monitorix by executing the command below;
apt install monitorix
If you encounter the error below;
Starting monitorix (via systemctl): monitorix.service.
chown: cannot access '/var/lib/monitorix/www/imgs': No such file or directory
dpkg: error processing package monitorix (--configure):
installed monitorix package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
monitorix
E: Sub-process /usr/bin/dpkg returned an error code (1)
Just create the directory and rerun the installation command;
mkdir /var/lib/monitorix/www/imgs
apt install monitorix
Monitorix consists mainly of two programs: a collector, called monitorix, which is a Perl daemon that is started automatically like any other system service, and a CGI script called monitorix.cgi. Monitorix includes its own HTTP server built in, so you aren’t forced to install a third-party web server to use it.
This installs the latest Monitorix on Ubuntu 20.04.
You can verify installed version of Monitorix by running;
monitorix -v
Monitorix version 3.13.1 (27-Jan-2021)
by Jordi Sanfeliu <[email protected]>
https://www.monitorix.org/
Running Monitorix
Once Monitorix is installed, it is started and enabled to run on system boot;
Check the status;
systemctl status monitorix
● monitorix.service - LSB: Start Monitorix daemon
Loaded: loaded (/etc/init.d/monitorix; generated)
Active: active (running) since Thu 2021-03-18 19:15:44 UTC; 10min ago
Docs: man:systemd-sysv-generator(8)
Tasks: 2 (limit: 2282)
Memory: 81.2M
CGroup: /system.slice/monitorix.service
├─16634 /usr/bin/monitorix -c /etc/monitorix/monitorix.conf -p /var/run/monitorix.pid
└─16806 monitorix-httpd listening on 8080
Mar 18 19:15:43 ubuntu20 systemd[1]: Starting LSB: Start Monitorix daemon...
Mar 18 19:15:44 ubuntu20 monitorix[16613]: ...done.
Mar 18 19:15:44 ubuntu20 systemd[1]: Started LSB: Start Monitorix daemon.
Configure Monitorix on Ubuntu 20.04
To run system monitoring with Monitorix, you need to do some configuration tuning according to your system details.
/etc/monitorix/monitorix.conf
is default Monitorix configuration file.
Open the Monitorix configuration file for editing;
vim /etc/monitorix/monitorix.conf
Below are some of the configuration options of Monitorix that we are changing in this demo. Be sure to replace the settings according to your environment.
- Set a description of the server, the location, the Company name, etc.
title = Kifarunix-demo.com
- Set the hostname of the host
hostname = monitorix.kifarunix-demo.com
...
title = Kifarunix-demo.com
hostname = monitorix.kifarunix-demo.com
theme_color = black
refresh_rate = 150
iface_mode = graph
...
Ensure that the hostname of your system is set and resolvable.
Adjust the rest of the options to suit your needs.
You can find out more about Monitorix configuration options on man monitorix.conf
.
Configure Monitorix Web Server
Monitorix is bundled with its own HTTP server. Thus, configure web server access permissions under the <httpd_builtin>
section of the default configuration file, /etc/monitorix/monitorix.conf
.
See the highlighted lines that shows which networks are allowed to access our Monitorix.
...
<httpd_builtin>
enabled = y
host = monitorix.kifarunix-demo.com
port = 8080
user = nobody
group = nobody
log_file = /var/log/monitorix-httpd
hosts_deny = all
hosts_allow = 192.168.57.0/24
autocheck_responsiveness = y
...
You can as well enable htaccess basic authentication.
..
<auth>
enabled = y
msg = Kifarunix-Demo Monitorix: Restricted access
htpasswd = /var/lib/monitorix/htpasswd
>/auth>
</httpd_builtin>
Enable or disable the Monitorix graphs to be displayed.
...
# Graphs (de)activation
# -----------------------------------------------------------------------------
<graph_enable>
system = y
kern = n
proc = y
hptemp = n
lmsens = n
gensens = n
ipmi = n
ambsens = n
nvidia = n
disk = n
fs = y
...
int = y
verlihub = n
</graph_enable>
Save and quit the configuration file once done making changes.
If you enabled htaccess basic authentications, you need to create users to be allowed to login. Hence, install Apache Utilities.
apt install apache-utils
Next, create users and store them on the specified file, /var/lib/monitorix/htpasswd
. For example to create a user called, monitadmin, run the command below. You will be prompted to set the password for the user.
htpasswd -d -c /var/lib/monitorix/htpasswd monitadmin
You can add more users to the same file above by just omitting option -c. For example, to add a user;
htpasswd -d /var/lib/monitorix/htpasswd monituser
If you want, you can further tweak your Monitorix configurations, consult man pages, man monitorix.conf
.
Restart Monitorix
Once you are satisfied by the configurations, restart Monitorix service.
systemctl restart monitorix
By default, Monitorix listens on TCP port 8080. You can verify this by running;
ss -altnp | grep 8080
LISTEN 0 4096 192.168.57.6:8080 0.0.0.0:* users:(("monitorix-httpd",pid=20482,fd=3))
If firewalld is running, open the port 8080/tcp on it.
ufw allow from 192.168.57.0/24 to any port 8080 proto tcp
Accessing Monitorix Web Interface
Monitorix can be accessed from a web browser using the address http://server-IP-or-hostname:8080/monitorix.
If you enabled basic authentication, authenticate and proceed to the dashboard.
Upon successful authentication, such interface welcomes you.
Select the specific graphs you would like to view from drop down on Graphs options.
You can as well view all Graphs for the specified times, daily, weekly, monthly.
To view all daily graphs, select Daily and click Ok.
System load average ans usage
Network Port Traffic
And many other dashboards for various statistics.
That is it on how to install Monitorix on CentOS 8.
Further Reading
https://www.monitorix.org/documentation.html
Related Tutorials
Install Monitorix on Debian 10