monitoring/servicestatus: Add columns service_next_update and service_next_update_is_late

refs #8378
This commit is contained in:
Eric Lippmann 2015-09-04 16:18:41 +02:00
parent a7cf3d0eb2
commit 562fec68cf
1 changed files with 33 additions and 0 deletions

View File

@ -194,6 +194,39 @@ class ServicestatusQuery extends IdoQuery
'service_modified_service_attributes' => 'ss.modified_service_attributes',
'service_next_check' => 'UNIX_TIMESTAMP(ss.next_check)',
'service_next_notification' => 'UNIX_TIMESTAMP(ss.next_notification)',
'service_next_update' => 'CASE WHEN ss.has_been_checked = 0 OR ss.has_been_checked IS NULL
THEN
NULL
ELSE
UNIX_TIMESTAMP(ss.last_check)
+ CASE WHEN
COALESCE(ss.current_state, 0) = 0
THEN
ss.normal_check_interval
ELSE
ss.retry_check_interval
END * 60
+ FLOOR(ss.execution_time) * 2
END',
// TODO(el): Remove column once we support service_expected_update>now
'service_next_update_is_late' => 'CASE WHEN ss.has_been_checked = 0 OR ss.has_been_checked IS NULL
THEN
0
ELSE
CASE WHEN (UNIX_TIMESTAMP(ss.last_check)
+ CASE WHEN COALESCE(ss.current_state, 0) = 0
THEN
ss.normal_check_interval
ELSE
ss.retry_check_interval
END * 60
+ FLOOR(ss.execution_time) * 2) > CURRENT_TIMESTAMP()
THEN
1
ELSE
0
END
END',
'service_no_more_notifications' => 'ss.no_more_notifications',
'service_normal_check_interval' => 'ss.normal_check_interval',
'service_notifications_enabled' => 'ss.notifications_enabled',