You are here

function nagios_check_cron in Nagios Monitoring 7

Same name and namespace in other branches
  1. 8 nagios.module \nagios_check_cron()
  2. 5 nagios.module \nagios_check_cron()
  3. 6 nagios.module \nagios_check_cron()

Check when the Drupal cron system was last invoked.

Return value

array

File

./nagios.module, line 978

Code

function nagios_check_cron() {
  $cron_last = variable_get('cron_last', 0);
  $minutes = variable_get('nagios_cron_duration', 60);
  if (REQUEST_TIME > $cron_last + $minutes * 60) {
    $data = [
      'status' => NAGIOS_STATUS_CRITICAL,
      'type' => 'state',
      'text' => t('cron did not run within last @minutes minutes', [
        '@minutes' => $minutes,
      ]),
    ];
  }
  else {
    $data = [
      'status' => NAGIOS_STATUS_OK,
      'type' => 'state',
      'text' => '',
    ];
  }
  return [
    'key' => 'CRON',
    'data' => $data,
  ];
}