Lampros - Weird Bricks

Monitorix installation on CentOS

30 October, 2015 | Monitorix

These are the steps I took to install Monitorix on a brand new VPS.

1. Make sure you have the EPEL repo set up as Monitorix has some dependencies there

yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm 

2. Then install the latest version of Monitorix - you can get the latest RPM from here: http://www.monitorix.org/downloads.html

yum -y install http://www.monitorix.org/monitorix-3.8.0-1.noarch.rpm

3. To start monitorix by using the defaults just run:

service monitorix start

You should get:

Starting monitorix:                                        [  OK  ]

4. Check which port monitorix is listening on:

netstat -ntlp | grep monitorix
tcp        0      0 0.0.0.0:8080                0.0.0.0:*                   LISTEN      1347/monitorix-http

5. As you can see it's listening on port 8080 and it's bound to 0.0.0.0, which means it's accessible by anyone - let's change that.

Edit the file /etc/monitorix/monitorix.conf - find the section <httpd_builtin> - in it, you'll see this line:

host =

change it to:

host = localhost

This way this will only bind to the localhost and we can then access this over an SSH tunnel.

6. Also in /etc/monitorix/monitorix.conf change the title and hostname:

title = Place a title here
hostname =

to:

title = Monitorix 
hostname = monitorixoncentos

7. Restart monitorix and confirm it's listening on localhost only:

service monitorix restart
Stopping monitorix:                                        [  OK  ]
Starting monitorix:                                        [  OK  ]
netstat -ntlp | grep monitorix
tcp        0      0 127.0.0.1:8080              0.0.0.0:*                   LISTEN      2202/monitorix-http

8. Also don't forget to set Monitorix to start on boot:

chkconfig monitorix on

9. Nice, now that all that's set, here's an example command to forward monitorix to my desktop:

ssh -i /home/lampros/.ssh/weirdbricks -nNT -L 8080:localhost:8080 root@184.105.XXX.YYY -p 2507 > /dev/null 2>&1 &

Let's break down the parts of the above command:

-i /home/lampros/.ssh/weirdbricks = the path to your SSH key

-n = from the manual: "Redirects stdin from /dev/null (actually, prevents reading from stdin). This must be used when ssh is run in the background."

-N = from the manual: "Do not execute a remote command. This is useful for just forwarding ports (protocol version 2 only)."

-L = the socket to listen to, the first 8080 is the LOCAL port you want it forwarded to, the "localhost" is where this is listening on the REMOTE host, and finally the second 8080 is the remote port root@184.105.XXX.YYY = your username and IP

-p = OPTIONAL - specify the SSH port to connect to the server > /dev/null

2>&1 = redirect both normal and error output to /dev/null

& = run this in the background

10. If this worked successfully you should now be able to see the local port on your side:

netstat -ntlp | grep 8080
tcp        0      0 127.0.0.1:8080          0.0.0.0:*               LISTEN      4061/ssh        
tcp6       0      0 ::1:8080                :::*                    LISTEN      4061/ssh 

11. If you can see it listening, simply fire up your browser and point it to 127.0.0.1:8080/monitorix

Done!