Monitorix System Monitor

I’ve been managing a CentOS 7 server on a VPS since July. There’s an overwhelming amount of information and recommendation for how to configure a server out there. My build is based around Vesta CP and I’m pretty happy with it.

I have been running into issues with PHP7 and PHP5 processes maxing out the 8GB available memory. To solve this problem, my first mission was to explore network monitoring solutions. There are a plethora of things on offer but most were just overkill for my needs. They were also very complex to set up. Fortunately I came across Monitorix which was a simple install and configuration. It gives me all the visuals I need to make sure my VPS is running smoothly. Here’s a graph of my current memory usage over 24 hours.

It may look a bit odd because I run a cron that kills all PHP7 and PHP5 processes every hour as you can see in peaks and valleys above.

[pastacode lang=”bash” manual=”%23!%2Fbin%2Fsh%0Akillall%20php70-cgi%0Akillall%20php-cgi%0Asystemctl%20restart%20mariadb%0A” message=”mowDownHungryProcesses” highlight=”” provider=”manual”/]

This is clearly more of a workaround than a solution. To purge the PHP processes, I’d have to investigate all the memory leaks which are created by content management systems such as this WordPress install you’re looking at now. An old version of Drupal was the worst memory hog out of all of them.

Because this is a low traffic server I can get away with cludges such as the one above. It’s not a long term solution; more of a band-aid, but it keeps my system from maxing out memory and using swap.

To install Monitorix on CentOS 7 & you can use the yum package manager:

[pastacode lang=”bash” manual=”sudo%20yum%20install%20epel-release%0Asudo%20yum%20install%20monitorix” message=”” highlight=”” provider=”manual”/]

It will install a lot of Perl dependencies. When it’s finished you can start the service:

[pastacode lang=”bash” manual=”service%20monitorix%20start” message=”” highlight=”” provider=”manual”/]

It runs, by default, on port 8080 but it can easily be changed in the config file to whatever port you’re happy with.

[pastacode lang=”bash” manual=”vim%20%2Fetc%2Fmonitorix%2Fmonitorix.conf” message=”” highlight=”” provider=”manual”/]

Line 30: port = __________

To see the graphs visit: http://yourdomain.com:8080/monitorix   (or whatever port you’ve set it to).