Skip to content

Monit Monitoring Simplified

Posted in Server, and Ubuntu

Monit Monitoring Simplified. You’re going through this tutorial in less than 20 minutes which will explain how to get your server instance monitored using Monit. Start your countdown watch.

This tutorial below assumes you’re running these:

  • PHP 7.0
  • nginx/1.10.0
  • mysql  Ver 14.14 Distrib 5.7.13
  • Ubuntu Server LTS 16.04

Under these assumptions:

  • Your hostname is khophi.co
  • Your domain name is maindomain.ext
  • Subdomain for monitoring monit via web interface is yoursubdomain.maindomain.ext

 

In the beginning:

You will come across this:

Choose "Internet Site"
Choose “Internet Site”

Select Internet Site then

Add hostname: Mine is khophi.co
Add hostname: Mine is khophi.co

Done with the UI settings for now. 2 minutes 30 seconds left

monitrc configurations

Step One

When you open the file below to edit, add this:

Update the newly added aliases as:

At this point, a simple message to the root@localhost will is forwarded to youremailaddress@gmail.com too.

Try this:

Monit Monitoring Configuring

Go:

Then when you open the

Uncomment these on lines 76, 108 to 119 and 162 respectively ( line positions will likely be these, they were for me )

Then add this part at the bottom of your file, just to check when storage is running full and notify you.

Save the file with Ctrl + X.

 

[wp_ad_camp_1]

 

Welcome back from the short commercial break. Now, open again

then comment out the line on 293

Save the file and exit

Monitoring Our Server installation

Create a new file called lemp-instance using

Then add:

 

NOTE: Be sure where your .pid files are located on your instances, especially with php7. I recommend you verify the .pid referenced in there are actually there.

Save the file, then do

If all is okay, then proceed. You should get a message saying: Control file syntax OK if not, track the error and fix. For me, commenting out the /etc/monit/conf-enabled/ solved an inclusion error I had.

Then

Check the health of the monit instance:

If you see greens, and no error messages, you’re on track – your monit is monitoring nicely

Allow the viewing of monitoring via terminal and web. Uncomment these in the file

uncomment these on lines 149 to 152

Save file. Then…

See monitoring status after restarting monit service

See status in Web

You want to see the status from monit when you visit a URL, put this…

… in your file

Save, then attached to enabled sites in Nginx as:

Check Nginx conf for errors:

If all is fine, then proceed.

Domain Name Configuration

Visit your DNS configuration area. I use Digital Ocean and follow the pattern on screen

Creating an A record as follows - monit monitoring
Creating an A record as follows

Then a CNAME

Creating a CNAME record - monit monitoring
Creating a CNAME record

Wait for a couple of minutes for everything to settle with DNS routing.

Try visiting yoursubdomain.maindomain.ext and you should be faced with a login form. After login, you’ll be blessed with this:

Monit LEMP in Action - monit monitoring
Monit LEMP in Action

 

[wp_ad_camp_1]