Monitor your server using Monitorix
Monitorix is a free, open source, lightweight system monitoring tool designed to monitor as many services and system resources as possible. It has been created to be used under production Linux/UNIX servers, but due to its simplicity and small size can be used on embedded devices as well.
First of all, you should have LAMP installed on your server.
Add the repository file to /etc/apt/sources.list
deb http://apt.izzysoft.de/ubuntu generic universe
sudo apt-get update
And install it:
sudo apt-get install monitorix
Your monitoring tool is installed, you can go and see the dashboard at:
http://[Your IP address/hostname ]:8080/monitorix
Enable authentication to access Monitorix
Go to :
and enable the authentication:
enabled = y host = port = 8080 user = nobody group = nobody log_file = /var/log/monitorix-httpd hosts_deny = hosts_allow = enabled = y msg = Monitorix: Restricted access htpasswd = /var/lib/monitorix/.htpasswd
I am using Webmin, so I will be using it to add a protected directory:
Go to “Add a protected directory” and configure Webmin to protect Monitorix directory:
Click on create protected directory and add /var/lib/monitorix as a directory to protect, you can let Webmin choose automatically the htpasswd file. Click create and in the next screen add a new user with a login/password and click create.
Restart Monitorix and reload apache:
sudo service monitorix restart sudo service apache2 reload
(De)Activation of graphs
As you can see in the configuration file:
you have a list of module that you can activate in function of what you would like to see on your Monitorix dashboard.
# Graphs (de)activation # ----------------------------------------------------------------------------- <graph_enable> system = y kern = y proc = y hptemp = n lmsens = n nvidia = n disk = n fs = y net = y netstat = y libvirt = n process = n serv = y mail = n port = y user = y ftp = n apache = n nginx = n lighttpd = n mysql = n varnish = n squid = n nfss = n nfsc = n bind = n ntp = n fail2ban = n icecast = n raspberrypi = n phpapc = n memcached = n apcupsd = n wowza = n int = y verlihub = n </graph_enable>
Configure Mysql monitoring
For mysql, first you should have :
mysql = y
in the configuration file.
Then proceed by creating a Mysql user to be used with Monitorix:
mysql --host=localhost --user=root --password CREATE USER 'monitorix'@'localhost' IDENTIFIED BY 'password'; FLUSH PRIVILEGES;
Go back to Monitorix configuration file and modify Mysql section to add the host, the port, the added user with the configured password.
If you need more details, you can find a good documentation about the different configurations in the official website.
Happy hacking !