You are here

function nagios_check_maintenance in Nagios Monitoring 8

Check when the site is in maintenance mode.

Return value

array Array containing state data

File

./nagios.module, line 739
Main file for Nagios service monitoring.

Code

function nagios_check_maintenance() {
  if (Drupal::state()
    ->get('system.maintenance_mode')) {
    $data = [
      'status' => NAGIOS_STATUS_CRITICAL,
      'type' => 'state',
      'text' => t('Site is offline (maintenance mode on)'),
    ];
  }
  else {
    $data = [
      'status' => NAGIOS_STATUS_OK,
      'type' => 'state',
      'text' => t('Site is online (maintenance mode off)'),
    ];
  }
  return [
    'key' => 'MAINT',
    'data' => $data,
  ];
}