You are here

function ultimate_cron_running_check in Ultimate Cron 7

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

Check number of running jobs.

Return value

array

File

./ultimate_cron.nagios.inc, line 158

Code

function ultimate_cron_running_check() {
  $running = ultimate_cron_nagios_get_job_info('running');
  $threshold = variable_get('ultimate_cron_nagios_running_threshold', 50);
  if (count($running) > $threshold) {
    $data = array(
      'status' => NAGIOS_STATUS_CRITICAL,
      'type' => 'state',
      'text' => t('@jobs currently running - it is more than @threshold', array(
        '@jobs' => $running,
        '@threshold' => $threshold,
      )),
    );
  }
  else {
    $data = array(
      'status' => NAGIOS_STATUS_OK,
      'type' => 'state',
      'text' => t('@jobs currently running', array(
        '@jobs' => $running,
      )),
    );
  }
  return array(
    'key' => 'ULTIMATE_CRON_RUNNING',
    'data' => $data,
  );
}