You are here

function ultimate_cron_failed_check in Ultimate Cron 7

Same name and namespace in other branches
  1. 8.2 ultimate_cron.nagios.inc \ultimate_cron_failed_check()
  2. 8 ultimate_cron.nagios.inc \ultimate_cron_failed_check()
  3. 6 ultimate_cron.nagios.inc \ultimate_cron_failed_check()

Check number of jobs that failed last run.

Return value

array

File

./ultimate_cron.nagios.inc, line 187

Code

function ultimate_cron_failed_check() {
  $failed = ultimate_cron_nagios_get_job_info('errors');
  $threshold = variable_get('ultimate_cron_nagios_failed_threshold', 10);
  if (count($failed) > $threshold) {
    $data = array(
      'status' => NAGIOS_STATUS_CRITICAL,
      'type' => 'state',
      'text' => t('@jobs failed their last run - it is more than @threshold', array(
        '@jobs' => $failed,
        '@threshold' => $threshold,
      )),
    );
  }
  else {
    $data = array(
      'status' => NAGIOS_STATUS_OK,
      'type' => 'state',
      'text' => t('@jobs failed their last run', array(
        '@jobs' => $failed,
      )),
    );
  }
  return array(
    'key' => 'ULTIMATE_CRON_FAILED',
    'data' => $data,
  );
}