function ultimate_cron_nagios_get_job_info in Ultimate Cron 7
Same name and namespace in other branches
- 8.2 ultimate_cron.nagios.inc \ultimate_cron_nagios_get_job_info()
- 8 ultimate_cron.nagios.inc \ultimate_cron_nagios_get_job_info()
- 6 ultimate_cron.nagios.inc \ultimate_cron_nagios_get_job_info()
Get information about running jobs - currently running or failed.
@staticvar array $overview
Parameters
string $mode Which mode to get info about; 'running' or 'errors':
Return value
int
2 calls to ultimate_cron_nagios_get_job_info()
- ultimate_cron_failed_check in ./
ultimate_cron.nagios.inc - Check number of jobs that failed last run.
- ultimate_cron_running_check in ./
ultimate_cron.nagios.inc - Check number of running jobs.
File
- ./
ultimate_cron.nagios.inc, line 117
Code
function ultimate_cron_nagios_get_job_info($mode = 'running') {
// Ensure valid mode
if (!in_array($mode, array(
'running',
'errors',
))) {
$mode = 'running';
}
static $overview = array();
if (!isset($overview[$mode])) {
$overview[$mode] = 0;
// Get hooks and their data
$data = _ultimate_cron_preload_cron_data();
$hooks = ultimate_cron_get_hooks();
$modules = array();
foreach ($hooks as $function => $hook) {
if (!$module || $module == $hook['module']) {
$hook['settings'] = $data[$function]['settings'] + $hook['settings'];
$hook['background_process'] = $data[$function]['background_process'];
$hook['log'] = ultimate_cron_get_log($function);
// Setup process
if ($hook['background_process']) {
$overview['running']++;
}
$log = $hook['log'];
if (isset($log['status']) && !$log['status']) {
$overview['errors']++;
}
}
}
}
return $overview[$mode];
}