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.

## sbelastic service monitoring using monit
check host sbelastic with address localhost
stop program "/usr/bin/systemctl stop sbelastic"
start program "/usr/bin/systemctl start sbelastic"
## if failed port 9200 and protocol HTTP for 20 cycles then alert
if failed port 9200 then alert
## if failed port 9200 and protocol HTTP for 40 cycles then start
if failed port 9200 then start

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.

## Searchblox service monitoring using Monit
Check host searchblox with address localhost
stop program "/usr/bin/systemctl stop searchblox"
start program "/usr/bin/systemctl start searchblox"
## if failed port 8443 and protocol HTTPS for 20 cycles then alert
if failed port 8443 then alert
## if failed port 8443 and protocol HTTPS  for 40 cycles then start
if failed port 8443 then start

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.

## sbanalytics service monitoring using Monit
Check host sbanalytics with address localhost
stop program "/usr/bin/systemctl stop sbanalytics "
start program "/usr/bin/systemctl start sbanalytics "
## if failed port 8444 and protocol HTTPS for 20 cycles then alert
if failed port 8444 then alert
## if failed port 8444 and protocol HTTPS  for 40 cycles then start
if failed port 8444 then start
  • 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