## Monitoring SearchBlox with Monit

Monit can be configured for monitoring SearchBlox servers on Ubuntu, Debian, CentOS, and RedHat.

Click [here](🔗) to install Monit.

## What can Monit do?

Monit can be configured to

  • Check every 2 minutes.

  • Log into Syslog.

  • Send emails through locally-installed mail servers.

  • Send alerts to specific email addresses.

  • Check load (alert if the 5 min average is above the number of CPUs).

  • Alert if memory usage is more than 85%.

  • Check the SearchBlox process and restart if not running.

  • Alert if SearchBlox uses more than 75% CPU.

  • Alert if SearchBlox's memory usage exceeds 75%.

  • Restart SearchBlox if there is no `Search Results` string as result to query https://localhost:8443/search/index.html.

  • Alert if the disk where SearchBlox is installed `/opt/searchblox` is less than 25% free.

  • Add additional config values you can easily uncomment and enable/adjust.

## Prerequisites

SearchBlox must be installed into `/opt/searchblox`

## Install Monit

  • Install Monit using the YUM command. `yum install epel-release` `yum update` `yum install monit -y`

  • To start the Monit service `systemctl start monit`

  • To stop the Monit service `systemctl stop monit`

  • To check the status of the Monit service `systemctl status monit`

468


## Enable Monit Web Interface

Monit also provides a web interface for monitoring and managing the configured services.

By default, Monit listens on port **2812**. But first, it needs to be set up.

  • Edit the Monit configuration file as shown in the image below. `vi /etc/monitrc`

887

  • Reload Monit. `systemctl restart monit`

  • Auto-start Monit on start-up. `systemctl enable monit`

## Access Monit Web Interface

`http://<IP Address>:2812` Username: `admin` Password: `monit`

866


## Configure services for monitoring with Monit

Once the web interface is up and running, we can set up the services that we want to monitor.

You can place the service monitoring configuration files under `/etc/monit.d/` directory.

### sbelastic service

  • Create the sbelastic service monitor `vi /etc/monit.d/sbelastic`

**Note**: Add the configuration given below into `/etc/monit.d/sbelastic`, and save it.



### searchblox service

  • Create the SearchBlox service monitor `vi /etc/monit.d/searchblox`

**Note**: Add the configuration given below into `/etc/monit.d/searchblox` and save it.



### sbanalytics service

  • Create the SearchBlox Analytics service monitor `vi /etc/monit.d/sbanalytics`

**Note**: Add the configuration given below into `/etc/monit.d/sbanalytics` and save it.


  • Once configured, test the Monit syntax. `monit -t` **Output**: `Control file syntax OK`

  • Reload Monit for the changes to take effect. `monit reload`

  • Access the web interface.

  • You should see the new services that were configured.

1346