Installing Monit
Monit is a free open source supervision utility for managing and monitoring Unix and Linux. Monit lets you view system status directly from the command line or from a native HTTP web server. Monit can be used to conduct automatic maintenance and repair, such as executing meaningful causal actions in error situations.
SQreamDB uses Monit as a watchdog utility, but you can use any other utility that provides the same or similar functionality.
The Installing Monit procedures describes how to install, configure, and start Monit.
You can install Monit in one of the following ways:
Getting Started
Before installing SQreamDB with Monit, verify that you have followed the required Pre-Installation Configuration section.
The procedures in the Installing Monit guide must be performed on each SQreamDB cluster node.
Installing Monit on RHEL:
Install Monit as a superuser:
$ sudo yum install monit
Building Monit
Building Monit from Source Code
To build Monit from source code:
Copy the Monit package for the current version:
$ tar zxvf monit-<x.y.z>.tar.gz
The value
x.y.z
denotes the version numbers.
Navigate to the directory where you want to store the package:
$ cd monit-x.y.z
Configure the files in the package:
$ ./configure (use ./configure --help to view available options)
Build and install the package:
$ make && make install
The following are the default storage directories:
The Monit package: /usr/local/bin/
The monit.1 man-file: /usr/local/man/man1/
Optional - To change the above default location(s), use the –prefix option to ./configure.
Optional - Create an RPM package for RHEL directly from the source code:
$ rpmbuild -tb monit-x.y.z.tar.gz
Building Monit from Pre-Built Binaries
To build Monit from pre-built binaries:
Copy the Monit package for the current version:
$ tar zxvf monit-x.y.z-linux-x64.tar.gz
The value
x.y.z
denotes the version numbers.Navigate to the directory where you want to store the package:
Copy the bin/monit and /usr/local/bin/ directories:
$ cp bin/monit /usr/local/bin/
Copy the conf/monitrc and /etc/ directories:
$ cp conf/monitrc /etc/
For examples of pre-built Monit binarties, see Download Precompiled Binaries.
Configuring Monit
When the installation is complete, you can configure Monit. You configure Monit by modifying the Monit configuration file, called monitrc. This file contains blocks for each service that you want to monitor.
The following is an example of a service block:
$ #SQREAM1-START $ check process sqream1 with pidfile /var/run/sqream1.pid $ start program = "/usr/bin/systemctl start sqream1" $ stop program = "/usr/bin/systemctl stop sqream1" $ #SQREAM1-END
For example, if you have 16 services, you can configure this block by copying the entire block 15 times and modifying all service names as required, as shown below:
$ #SQREAM2-START $ check process sqream2 with pidfile /var/run/sqream2.pid $ start program = "/usr/bin/systemctl start sqream2" $ stop program = "/usr/bin/systemctl stop sqream2" $ #SQREAM2-END
For servers that don’t run the metadataserver and serverpicker commands, you can use the block example above, but comment out the related commands, as shown below:
$ #METADATASERVER-START $ #check process metadataserver with pidfile /var/run/metadataserver.pid $ #start program = "/usr/bin/systemctl start metadataserver" $ #stop program = "/usr/bin/systemctl stop metadataserver" $ #METADATASERVER-END
To configure Monit:
Copy the required block for each required service.
Modify all service names in the block.
Copy the configured monitrc file to the /etc/monit.d/ directory:
$ cp monitrc /etc/monit.d/
Set file permissions to 600 (full read and write access):
$ sudo chmod 600 /etc/monit.d/monitrc
Reload the system to activate the current configurations:
$ sudo systemctl daemon-reload
Optional - Navigate to the /etc/sqream directory and create a symbolic link to the monitrc file:
$ cd /etc/sqream $ sudo ln -s /etc/monit.d/monitrc monitrc
Starting Monit
After configuring Monit, you can start it.
To start Monit:
Start Monit as a super user:
$ sudo systemctl start monit
View Monit’s service status:
$ sudo systemctl status monit
If Monit is functioning correctly, enable the Monit service to start on boot:
$ sudo systemctl enable monit