-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TLVHostgroupNode: Set downtime_handled based on service_in_notificati…
…on_period refs #2
- Loading branch information
1 parent
9b6c26b
commit efd24df
Showing
4 changed files
with
123 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
/* Copyright (C) 2017 Icinga Development Team <info@icinga.com> */ | ||
|
||
namespace Icinga\Module\Toplevelview\Monitoring; | ||
|
||
use Icinga\Data\ConnectionInterface; | ||
use Icinga\Module\Monitoring\Backend\MonitoringBackend; | ||
use Icinga\Module\Monitoring\DataView\ServiceStatus as IcingaServiceStatus; | ||
|
||
class ServiceStatus extends IcingaServiceStatus | ||
{ | ||
/** @noinspection PhpMissingParentConstructorInspection */ | ||
/** | ||
* @param ConnectionInterface $connection | ||
* @param array|null $columns | ||
* @noinspection PhpMissingParentConstructorInspection | ||
*/ | ||
public function __construct(ConnectionInterface $connection, array $columns = null) | ||
{ | ||
/** @var MonitoringBackend $connection */ | ||
$this->connection = $connection; | ||
$this->query = new ServicestatusQuery($connection->getResource(), $columns); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getColumns() | ||
{ | ||
return array_merge( | ||
parent::getColumns(), | ||
array( | ||
//'service_in_notification_period', | ||
'servicenotificationperiod_name', | ||
) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
/* Copyright (C) 2017 Icinga Development Team <info@icinga.com> */ | ||
|
||
namespace Icinga\Module\Toplevelview\Monitoring; | ||
|
||
use Icinga\Module\Monitoring\Backend\Ido\Query\HostgroupQuery as IcingaHostgroupQuery; | ||
|
||
/** | ||
* Patched version of HostgroupQuery | ||
* | ||
* Changes: | ||
* - add service_notifications_enabled to servicestatus join | ||
*/ | ||
class HostgroupQuery extends IcingaHostgroupQuery | ||
{ | ||
public function init() | ||
{ | ||
$patchedColumnMap = array( | ||
'servicestatus' => array( | ||
'service_notifications_enabled' => 'ss.notifications_enabled', | ||
'service_is_flapping' => 'ss.is_flapping', | ||
'service_state' => 'CASE WHEN ss.has_been_checked = 0 OR ss.has_been_checked IS NULL THEN 99 ELSE CASE WHEN ss.state_type = 1 THEN ss.current_state ELSE ss.last_hard_state END END', | ||
'service_handled' => 'CASE WHEN (ss.problem_has_been_acknowledged + COALESCE(hs.current_state, 0)) > 0 THEN 1 ELSE 0 END', | ||
'service_in_downtime' => 'CASE WHEN (ss.scheduled_downtime_depth = 0) THEN 0 ELSE 1 END', | ||
), | ||
'hoststatus' => array( | ||
'host_notifications_enabled' => 'hs.notifications_enabled', | ||
'host_is_flapping' => 'hs.is_flapping', | ||
'host_state' => 'CASE WHEN hs.has_been_checked = 0 OR hs.has_been_checked IS NULL THEN 99 ELSE CASE WHEN hs.state_type = 1 THEN hs.current_state ELSE hs.last_hard_state END END', | ||
'host_handled' => 'CASE WHEN hs.problem_has_been_acknowledged > 0 THEN 1 ELSE 0 END', | ||
'host_in_downtime' => 'CASE WHEN (hs.scheduled_downtime_depth = 0) THEN 0 ELSE 1 END', | ||
) | ||
); | ||
|
||
foreach ($patchedColumnMap as $table => $columns) { | ||
foreach ($columns as $k => $v) { | ||
$this->columnMap[$table][$k] = $v; | ||
} | ||
} | ||
|
||
parent::init(); | ||
} | ||
} |