You are here

function nagios_check_elysia_cron in Nagios Monitoring 7

Same name and namespace in other branches
  1. 8 nagios.module \nagios_check_elysia_cron()

Check when the Drupal cron system was last invoked.

Return value

array

File

./nagios.module, line 1008

Code

function nagios_check_elysia_cron() {
  $result = db_query('select * from elysia_cron where last_aborted <> 0');
  $err_crons = [];
  foreach ($result as $blocked_cron) {
    $err_crons[] = $blocked_cron;
  }
  $text = '';
  foreach ($err_crons as $cron) {
    $text .= t('Elysia cron ":cron" last aborted on ":abort"' . PHP_EOL, [
      ':cron' => $cron->name,
      ':abort' => $cron->last_abort_function,
    ]);
  }
  if (!empty($err_crons)) {
    $data = [
      'status' => NAGIOS_STATUS_CRITICAL,
      'type' => 'state',
      'text' => $text,
    ];
  }
  else {
    $data = [
      'status' => NAGIOS_STATUS_OK,
      'type' => 'state',
      'text' => '',
    ];
  }
  return [
    'key' => 'ELYSIA_CRON',
    'data' => $data,
  ];
}