function ultimate_cron_longrunning_check in Ultimate Cron 6
Same name and namespace in other branches
- 8.2 ultimate_cron.nagios.inc \ultimate_cron_longrunning_check()
- 8 ultimate_cron.nagios.inc \ultimate_cron_longrunning_check()
- 7 ultimate_cron.nagios.inc \ultimate_cron_longrunning_check()
Check number of jobs running longer than usual.
@todo Implement the logic
Return value
array
File
- ./
ultimate_cron.nagios.inc, line 222
Code
function ultimate_cron_longrunning_check() {
$longrunning = 0;
// Get running jobs
// Find out how long they have been running
// Calculate average run time per job (over a threshold? E.g. queues run very fast if there is nothing to process)
// If
$threshold = variable_get('ultimate_cron_nagios_longrunning_threshold', 0);
if ($longrunning > $threshold) {
$data = array(
'status' => NAGIOS_STATUS_CRITICAL,
'type' => 'state',
'text' => t('@jobs jobs are running longer than usual - it is more than @threshold', array(
'@jobs' => $longrunning,
'@threshold' => $threshold,
)),
);
}
else {
$data = array(
'status' => NAGIOS_STATUS_OK,
'type' => 'state',
'text' => t('@jobs jobs are running longer than usual', array(
'@jobs' => $longrunning,
)),
);
}
return array(
'key' => 'ULTIMATE_CRON_LONGRUNNING',
'data' => $data,
);
}