Add drupal check, Icinga

How to add an Drupal check to Icinga2
Command will be run on localhost machine, in order to run remotely do not forget to download a plugin and create a commands.conf record both on main and remote node.

Download plugin to Icinga2 plugins directory
cd /usr/lib/nagios/plugins
git clone

Test whether plugin works
/usr/lib/nagios/plugins/check_drupal/bin/check_drupal -d /var/www/drupal -s e


[OK] Drupal is healthy | 'Security Updates'=0;;;; 'Updates'=0;;;; 'Core Errors'=0;;;; 'Core Warnings'=0;;;; 'Database Migrations'=0;;;; 'OK'=1;;;0;1 'Errors'=0;1;1;0;1 'Warnings'=0;1;;0;1 'Unknown'=0;;;0;1
[OK] No Security updates required

Add cron to create a log file, cron will run's everyday at 10 AM
crontab -e
* 10 * * * /usr/lib/nagios/plugins/check_drupal/bin/check_drupal -d /var/www/drupal -s e -e w -w w -l /var/log/drupal.log

Add commands.conf record
object CheckCommand "check-drupal" {
command = [PluginDir + "/check_drupal/bin/check_drupal_log"]
arguments = {
"-f" = "$drupal_log_file$"

Add service.conf record
apply Service "check-drupal" {
import "generic-service"

display_name = "Drupal check "
check_command = "check-drupal"
vars.drupal_log_file = "/var/log/drupal.log"

# command_endpoint = host.vars.client_endpoint #comment out when running remotely
assign where == "NodeName" #update to apply on local condition


As usual at the end
icinga2 daemon -C
systemctl restart icinga2