commit
2d7e56c46e
|
@ -98,9 +98,6 @@ class Monitoring_HostController extends MonitoredObjectController
|
|||
'service_notifications_enabled',
|
||||
'service_action_url',
|
||||
'service_notes_url',
|
||||
'service_last_comment',
|
||||
'service_last_ack',
|
||||
'service_last_downtime',
|
||||
'service_active_checks_enabled',
|
||||
'service_passive_checks_enabled',
|
||||
'current_check_attempt' => 'service_current_check_attempt',
|
||||
|
|
|
@ -57,9 +57,7 @@ class Monitoring_HostsController extends Controller
|
|||
'host_handled',
|
||||
'host_acknowledged',
|
||||
'host_in_downtime',
|
||||
'host_last_ack',
|
||||
'host_is_flapping',
|
||||
'host_last_comment',
|
||||
'host_output',
|
||||
'host_notifications_enabled',
|
||||
'host_active_checks_enabled',
|
||||
|
@ -96,9 +94,7 @@ class Monitoring_HostsController extends Controller
|
|||
'host_handled',
|
||||
'host_acknowledged',
|
||||
'host_in_downtime',
|
||||
'host_last_ack',
|
||||
'host_is_flapping',
|
||||
'host_last_comment',
|
||||
'host_output',
|
||||
'host_notifications_enabled',
|
||||
'host_active_checks_enabled',
|
||||
|
|
|
@ -87,9 +87,6 @@ class Monitoring_ListController extends Controller
|
|||
'host_notifications_enabled',
|
||||
'host_action_url',
|
||||
'host_notes_url',
|
||||
'host_last_comment',
|
||||
'host_last_ack',
|
||||
'host_last_downtime',
|
||||
'host_active_checks_enabled',
|
||||
'host_passive_checks_enabled',
|
||||
'host_current_check_attempt',
|
||||
|
@ -175,9 +172,6 @@ class Monitoring_ListController extends Controller
|
|||
'service_notifications_enabled',
|
||||
'service_action_url',
|
||||
'service_notes_url',
|
||||
'service_last_comment',
|
||||
'service_last_ack',
|
||||
'service_last_downtime',
|
||||
'service_active_checks_enabled',
|
||||
'service_passive_checks_enabled',
|
||||
'current_check_attempt' => 'service_current_check_attempt',
|
||||
|
|
|
@ -68,8 +68,6 @@ class Monitoring_ServicesController extends Controller
|
|||
'service_in_downtime',
|
||||
'service_is_flapping',
|
||||
'service_output',
|
||||
'service_last_ack',
|
||||
'service_last_comment',
|
||||
'service_notifications_enabled',
|
||||
'service_active_checks_enabled',
|
||||
'service_passive_checks_enabled'
|
||||
|
@ -115,8 +113,6 @@ class Monitoring_ServicesController extends Controller
|
|||
'service_acknowledged',
|
||||
'service_in_downtime',
|
||||
'service_is_flapping',
|
||||
'service_last_comment',
|
||||
'service_last_ack',
|
||||
'service_notifications_enabled',
|
||||
'service_active_checks_enabled',
|
||||
'service_passive_checks_enabled'
|
||||
|
|
|
@ -31,9 +31,6 @@ class Zend_View_Helper_HostFlags extends Zend_View_Helper_Abstract
|
|||
$icons[] = $this->view->icon('eye-off', $this->view->translate('Active Checks Disabled'));
|
||||
}
|
||||
}
|
||||
if (isset($host->host_last_comment) && $host->host_last_comment !== null) {
|
||||
$icons[] = $this->view->icon('comment', $this->view->translate('Last Comment: ') . $host->host_last_comment);
|
||||
}
|
||||
return $icons;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,12 +9,10 @@ class Zend_View_Helper_ServiceFlags extends Zend_View_Helper_Abstract
|
|||
$icons[] = $this->view->icon('attention-alt', $this->view->translate('Unhandled'));
|
||||
}
|
||||
if ($service->service_acknowledged && !$service->service_in_downtime) {
|
||||
$icons[] = $this->view->icon('ok', $this->view->translate('Acknowledged') . (
|
||||
$service->service_last_ack ? ': ' . $service->service_last_ack : ''
|
||||
));
|
||||
$icons[] = $this->view->icon('ok', $this->view->translate('Acknowledged'));
|
||||
}
|
||||
if ($service->service_is_flapping) {
|
||||
$icons[] = $this->view->icon('flapping', $this->view->translate('Flapping')) ;
|
||||
$icons[] = $this->view->icon('flapping', $this->view->translate('Flapping'));
|
||||
}
|
||||
if (!$service->service_notifications_enabled) {
|
||||
$icons[] = $this->view->icon('bell-off-empty', $this->view->translate('Notifications Disabled'));
|
||||
|
@ -22,12 +20,6 @@ class Zend_View_Helper_ServiceFlags extends Zend_View_Helper_Abstract
|
|||
if ($service->service_in_downtime) {
|
||||
$icons[] = $this->view->icon('plug', $this->view->translate('In Downtime'));
|
||||
}
|
||||
if (isset($service->service_last_comment) && $service->service_last_comment !== null) {
|
||||
$icons[] = $this->view->icon(
|
||||
'comment',
|
||||
$this->view->translate('Last Comment: ') . $service->service_last_comment
|
||||
);
|
||||
}
|
||||
if (!$service->service_active_checks_enabled) {
|
||||
if (!$service->service_passive_checks_enabled) {
|
||||
$icons[] = $this->view->icon('eye-off', $this->view->translate('Active And Passive Checks Disabled'));
|
||||
|
|
|
@ -131,18 +131,6 @@ class HoststatusQuery extends IdoQuery
|
|||
'host_status_update_time' => 'hs.status_update_time',
|
||||
'host_unhandled' => 'CASE WHEN (hs.problem_has_been_acknowledged + hs.scheduled_downtime_depth) = 0 THEN 1 ELSE 0 END'
|
||||
),
|
||||
'lasthostackcomment' => array(
|
||||
'host_last_ack' => 'hlac.last_ack_data'
|
||||
),
|
||||
'lasthostcomment' => array(
|
||||
'host_last_comment' => 'hlc.last_comment_data'
|
||||
),
|
||||
'lasthostdowntimecomment' => array(
|
||||
'host_last_downtime' => 'hldc.last_downtime_data'
|
||||
),
|
||||
'lasthostflappingcomment' => array(
|
||||
'host_last_flapping' => 'hlfc.last_flapping_data'
|
||||
),
|
||||
'servicegroups' => array(
|
||||
'servicegroup' => 'sgo.name1 COLLATE latin1_general_ci',
|
||||
'servicegroup_name' => 'sgo.name1',
|
||||
|
@ -155,37 +143,6 @@ class HoststatusQuery extends IdoQuery
|
|||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* Create a sub query to join comments into status query
|
||||
*
|
||||
* @param int $entryType
|
||||
* @param string $alias
|
||||
*
|
||||
* @return Zend_Db_Expr
|
||||
*/
|
||||
protected function createLastCommentSubQuery($entryType, $alias)
|
||||
{
|
||||
$sql = <<<SQL
|
||||
SELECT
|
||||
c.object_id,
|
||||
'[' || c.author_name || '] ' || c.comment_data AS $alias
|
||||
FROM
|
||||
icinga_comments c
|
||||
INNER JOIN
|
||||
(
|
||||
SELECT
|
||||
MAX(comment_id) AS comment_id,
|
||||
object_id
|
||||
FROM
|
||||
icinga_comments
|
||||
WHERE
|
||||
entry_type = $entryType
|
||||
GROUP BY object_id
|
||||
) ec ON ec.comment_id = c.comment_id
|
||||
SQL;
|
||||
return new Zend_Db_Expr('(' . $sql . ')');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
@ -242,54 +199,6 @@ SQL;
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Join last host acknowledgement comment
|
||||
*/
|
||||
protected function joinLasthostackcomment()
|
||||
{
|
||||
$this->select->joinLeft(
|
||||
array('hlac' => $this->createLastCommentSubQuery(4, 'last_ack_data')),
|
||||
'hlac.object_id = ho.object_id',
|
||||
array()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Join last host comment
|
||||
*/
|
||||
protected function joinLasthostcomment()
|
||||
{
|
||||
$this->select->joinLeft(
|
||||
array('hlc' => $this->createLastCommentSubQuery(1, 'last_comment_data')),
|
||||
'hlc.object_id = ho.object_id',
|
||||
array()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Join last host downtime comment
|
||||
*/
|
||||
protected function joinLasthostdowntimeComment()
|
||||
{
|
||||
$this->select->joinLeft(
|
||||
array('hldc' => $this->createLastCommentSubQuery(2, 'last_downtime_data')),
|
||||
'hldc.object_id = ho.object_id',
|
||||
array()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Join last host flapping comment
|
||||
*/
|
||||
protected function joinLasthostflappingcomment()
|
||||
{
|
||||
$this->select->joinLeft(
|
||||
array('hlfc' => $this->createLastCommentSubQuery(3, 'last_flapping_data')),
|
||||
'hlfc.object_id = ho.object_id',
|
||||
array()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Join service groups
|
||||
*/
|
||||
|
@ -344,22 +253,6 @@ SQL;
|
|||
$group[] = 'sps.unhandled_services_count';
|
||||
}
|
||||
|
||||
if ($this->hasJoinedVirtualTable('lasthostackcomment')) {
|
||||
$group[] = 'hlac.last_ack_data';
|
||||
}
|
||||
|
||||
if ($this->hasJoinedVirtualTable('lasthostcomment')) {
|
||||
$group[] = 'hlc.last_comment_data';
|
||||
}
|
||||
|
||||
if ($this->hasJoinedVirtualTable('lasthostdowntimecomment')) {
|
||||
$group[] = 'hldc.last_downtime_data';
|
||||
}
|
||||
|
||||
if ($this->hasJoinedVirtualTable('lasthostflappingcomment')) {
|
||||
$group[] = 'hlfc.last_flapping_data';
|
||||
}
|
||||
|
||||
if ($this->hasJoinedVirtualTable('hostgroups')) {
|
||||
$selected = false;
|
||||
foreach ($this->columns as $alias => $column) {
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
namespace Icinga\Module\Monitoring\Backend\Ido\Query;
|
||||
|
||||
use Zend_Db_Expr;
|
||||
|
||||
class StatusQuery extends IdoQuery
|
||||
{
|
||||
/**
|
||||
|
@ -310,42 +308,6 @@ class StatusQuery extends IdoQuery
|
|||
ELSE 0
|
||||
END'
|
||||
),
|
||||
|
||||
'serviceproblemsummary' => array(
|
||||
'host_unhandled_services' => 'sps.unhandled_services_count'
|
||||
),
|
||||
|
||||
'lasthostcommentgeneric' => array(
|
||||
'host_last_comment' => 'hlcg.last_comment_data'
|
||||
),
|
||||
|
||||
'lasthostcommentdowntime' => array(
|
||||
'host_last_downtime' => 'hlcd.last_downtime_data'
|
||||
),
|
||||
|
||||
'lasthostcommentflapping' => array(
|
||||
'host_last_flapping' => 'hlcf.last_flapping_data'
|
||||
),
|
||||
|
||||
'lasthostcommentack' => array(
|
||||
'host_last_ack' => 'hlca.last_ack_data'
|
||||
),
|
||||
|
||||
'lastservicecommentgeneric' => array(
|
||||
'service_last_comment' => 'slcg.last_comment_data'
|
||||
),
|
||||
|
||||
'lastservicecommentdowntime' => array(
|
||||
'service_last_downtime' => 'slcd.last_downtime_data'
|
||||
),
|
||||
|
||||
'lastservicecommentflapping' => array(
|
||||
'service_last_flapping' => 'slcf.last_flapping_data'
|
||||
),
|
||||
|
||||
'lastservicecommentack' => array(
|
||||
'service_last_ack' => 'slca.last_ack_data'
|
||||
)
|
||||
);
|
||||
|
||||
protected function joinBaseTables()
|
||||
|
@ -527,155 +489,4 @@ class StatusQuery extends IdoQuery
|
|||
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function joinServiceproblemsummary()
|
||||
{
|
||||
$select = <<<'SQL'
|
||||
SELECT
|
||||
SUM(
|
||||
CASE WHEN(ss.problem_has_been_acknowledged + ss.scheduled_downtime_depth + COALESCE(hs.current_state, 0)) > 0
|
||||
THEN 0
|
||||
ELSE 1
|
||||
END
|
||||
) AS unhandled_services_count,
|
||||
SUM(
|
||||
CASE WHEN (ss.problem_has_been_acknowledged + ss.scheduled_downtime_depth + COALESCE(hs.current_state, 0) ) > 0
|
||||
THEN 1
|
||||
ELSE 0
|
||||
END
|
||||
) AS handled_services_count,
|
||||
s.host_object_id
|
||||
FROM
|
||||
icinga_servicestatus ss
|
||||
JOIN icinga_objects o ON o.object_id = ss.service_object_id
|
||||
JOIN icinga_services s ON s.service_object_id = o.object_id
|
||||
JOIN icinga_hoststatus hs ON hs.host_object_id = s.host_object_id
|
||||
WHERE
|
||||
o.is_active = 1
|
||||
AND o.objecttype_id = 2
|
||||
AND ss.current_state > 0
|
||||
GROUP BY
|
||||
s.host_object_id
|
||||
SQL;
|
||||
$this->select->joinLeft(
|
||||
array('sps' => new Zend_Db_Expr('(' . $select . ')')),
|
||||
'sps.host_object_id = hs.host_object_id',
|
||||
array()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a subquery to join comments into status query
|
||||
* @param int $entryType
|
||||
* @param string $fieldName
|
||||
* @return Zend_Db_Expr
|
||||
*/
|
||||
protected function getLastCommentSubQuery($entryType, $fieldName)
|
||||
{
|
||||
$sub = '(SELECT'
|
||||
. ' c.object_id,'
|
||||
. " '[' || c.author_name || '] ' || c.comment_data AS $fieldName"
|
||||
. ' FROM icinga_comments c JOIN ('
|
||||
. ' SELECT MAX(comment_id) AS comment_id, object_id FROM icinga_comments'
|
||||
. ' WHERE entry_type = ' . $entryType . ' GROUP BY object_id'
|
||||
. ' ) lc ON c.comment_id = lc.comment_id)';
|
||||
|
||||
return new Zend_Db_Expr($sub);
|
||||
}
|
||||
|
||||
/**
|
||||
* Join last host comment
|
||||
*/
|
||||
protected function joinLasthostcommentgeneric()
|
||||
{
|
||||
$this->select->joinLeft(
|
||||
array('hlcg' => $this->getLastCommentSubQuery(1, 'last_comment_data')),
|
||||
'hlcg.object_id = hs.host_object_id',
|
||||
array()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Join last host downtime comment
|
||||
*/
|
||||
protected function joinLasthostcommentdowntime()
|
||||
{
|
||||
$this->select->joinLeft(
|
||||
array('hlcd' => $this->getLastCommentSubQuery(2, 'last_downtime_data')),
|
||||
'hlcd.object_id = hs.host_object_id',
|
||||
array()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Join last host flapping comment
|
||||
*/
|
||||
protected function joinLastHostcommentflapping()
|
||||
{
|
||||
$this->select->joinLeft(
|
||||
array('hlcf' => $this->getLastCommentSubQuery(3, 'last_flapping_data')),
|
||||
'hlcf.object_id = hs.host_object_id',
|
||||
array()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Join last host acknowledgement comment
|
||||
*/
|
||||
protected function joinLasthostcommentack()
|
||||
{
|
||||
$this->select->joinLeft(
|
||||
array('hlca' => $this->getLastCommentSubQuery(4, 'last_ack_data')),
|
||||
'hlca.object_id = hs.host_object_id',
|
||||
array()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Join last service comment
|
||||
*/
|
||||
protected function joinLastservicecommentgeneric()
|
||||
{
|
||||
$this->select->joinLeft(
|
||||
array('slcg' => $this->getLastCommentSubQuery(1, 'last_comment_data')),
|
||||
'slcg.object_id = ss.service_object_id',
|
||||
array()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Join last service downtime comment
|
||||
*/
|
||||
protected function joinLastservicecommentdowntime()
|
||||
{
|
||||
$this->select->joinLeft(
|
||||
array('slcd' => $this->getLastCommentSubQuery(2, 'last_downtime_data')),
|
||||
'slcd.object_id = ss.service_object_id',
|
||||
array()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Join last service flapping comment
|
||||
*/
|
||||
protected function joinLastservicecommentflapping()
|
||||
{
|
||||
$this->select->joinLeft(
|
||||
array('slcf' => $this->getLastCommentSubQuery(3, 'last_flapping_data')),
|
||||
'slcf.object_id = ss.service_object_id',
|
||||
array()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Join last service acknowledgement comment
|
||||
*/
|
||||
protected function joinLastservicecommentack()
|
||||
{
|
||||
$this->select->joinLeft(
|
||||
array('slca' => $this->getLastCommentSubQuery(4, 'last_ack_data')),
|
||||
'slca.object_id = ss.service_object_id',
|
||||
array()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,6 @@ class HostStatus extends DataView
|
|||
'host_check_command',
|
||||
'host_perfdata',
|
||||
'host_check_source',
|
||||
'host_unhandled_services',
|
||||
'host_passive_checks_enabled',
|
||||
'host_passive_checks_enabled_changed',
|
||||
'host_obsessing',
|
||||
|
@ -52,10 +51,6 @@ class HostStatus extends DataView
|
|||
'host_current_notification_number',
|
||||
'host_percent_state_change',
|
||||
'host_is_flapping',
|
||||
'host_last_comment',
|
||||
'host_last_downtime',
|
||||
'host_last_ack',
|
||||
'host_last_flapping',
|
||||
'host_action_url',
|
||||
'host_notes_url',
|
||||
'host_percent_state_change',
|
||||
|
|
|
@ -49,10 +49,6 @@ class ServiceStatus extends DataView
|
|||
'service_notifications_enabled_changed',
|
||||
'service_action_url',
|
||||
'service_notes_url',
|
||||
'service_last_comment',
|
||||
'service_last_downtime',
|
||||
'service_last_flapping',
|
||||
'service_last_ack',
|
||||
'service_last_check',
|
||||
'service_next_check',
|
||||
'service_attempt',
|
||||
|
@ -69,7 +65,6 @@ class ServiceStatus extends DataView
|
|||
'host_unhandled_service_count',
|
||||
'host_action_url',
|
||||
'host_notes_url',
|
||||
'host_last_comment',
|
||||
'host_display_name',
|
||||
'host_alias',
|
||||
'host_ipv4',
|
||||
|
|
Loading…
Reference in New Issue