diff --git a/library/Icingadb/Model/DependencyNodeSummary.php b/library/Icingadb/Model/RedundancyGroupSummary.php similarity index 98% rename from library/Icingadb/Model/DependencyNodeSummary.php rename to library/Icingadb/Model/RedundancyGroupSummary.php index 6fb4b1f9a..2b3db7ff3 100644 --- a/library/Icingadb/Model/DependencyNodeSummary.php +++ b/library/Icingadb/Model/RedundancyGroupSummary.php @@ -11,23 +11,30 @@ use ipl\Sql\Select; /** - * Redundancy group's parent nodes summary + * Redundancy group's summary (The nodes could only host and service) * + * @property int $nodes_total + * @property int $nodes_ok * @property int $nodes_problem_handled * @property int $nodes_problem_unhandled * @property int $nodes_pending - * @property int $nodes_total - * @property int $nodes_ok * @property int $nodes_unknown_handled * @property int $nodes_unknown_unhandled * @property int $nodes_warning_handled * @property int $nodes_warning_unhandled */ -class DependencyNodeSummary extends RedundancyGroup +class RedundancyGroupSummary extends RedundancyGroup { public function getSummaryColumns(): array { return [ + 'nodes_ok' => new Expression( + 'SUM(CASE WHEN (redundancy_group_from_to_service.id IS NOT NULL' + . ' AND redundancy_group_from_to_service_state.soft_state = 0)' + . ' OR' + . ' (redundancy_group_from_to_host.id IS NOT NULL AND redundancy_group_from_to_service.id IS NULL' + . ' AND redundancy_group_from_to_host_state.soft_state = 0) THEN 1 ELSE 0 END)' + ), 'nodes_problem_handled' => new Expression( 'SUM(CASE WHEN' . ' (redundancy_group_from_to_service.id IS NOT NULL' @@ -65,13 +72,6 @@ public function getSummaryColumns(): array . ' (redundancy_group_from_to_host.id IS NOT NULL AND redundancy_group_from_to_service.id IS NULL)' . ' THEN 1 ELSE 0 END)' ), - 'nodes_ok' => new Expression( - 'SUM(CASE WHEN (redundancy_group_from_to_service.id IS NOT NULL' - . ' AND redundancy_group_from_to_service_state.soft_state = 0)' - . ' OR' - . ' (redundancy_group_from_to_host.id IS NOT NULL AND redundancy_group_from_to_service.id IS NULL' - . ' AND redundancy_group_from_to_host_state.soft_state = 0) THEN 1 ELSE 0 END)' - ), 'nodes_unknown_handled' => new Expression( 'SUM(CASE WHEN redundancy_group_from_to_service_state.soft_state = 3' . ' AND (redundancy_group_from_to_service_state.is_handled = \'y\'' diff --git a/library/Icingadb/Widget/DependencyNodeStatistics.php b/library/Icingadb/Widget/DependencyNodeStatistics.php index ffc4403c2..53e8d5e23 100644 --- a/library/Icingadb/Widget/DependencyNodeStatistics.php +++ b/library/Icingadb/Widget/DependencyNodeStatistics.php @@ -5,7 +5,7 @@ namespace Icinga\Module\Icingadb\Widget; use Icinga\Chart\Donut; -use Icinga\Module\Icingadb\Model\DependencyNodeSummary; +use Icinga\Module\Icingadb\Model\RedundancyGroupSummary; use Icinga\Module\Icingadb\Widget\Detail\ObjectStatistics; use ipl\Html\Text; use ipl\Html\ValidHtml; @@ -16,7 +16,7 @@ */ class DependencyNodeStatistics extends ObjectStatistics { - /** @var DependencyNodeSummary Dependency node summary */ + /** @var RedundancyGroupSummary Dependency node summary */ protected $summary; public function __construct($summary) diff --git a/library/Icingadb/Widget/ItemList/RedundancyGroupListItem.php b/library/Icingadb/Widget/ItemList/RedundancyGroupListItem.php index 302be9df4..ed4f02b4c 100644 --- a/library/Icingadb/Widget/ItemList/RedundancyGroupListItem.php +++ b/library/Icingadb/Widget/ItemList/RedundancyGroupListItem.php @@ -8,7 +8,7 @@ use Icinga\Module\Icingadb\Common\Database; use Icinga\Module\Icingadb\Common\ListItemCommonLayout; use Icinga\Module\Icingadb\Model\RedundancyGroup; -use Icinga\Module\Icingadb\Model\DependencyNodeSummary; +use Icinga\Module\Icingadb\Model\RedundancyGroupSummary; use Icinga\Module\Icingadb\Model\RedundancyGroupState; use Icinga\Module\Icingadb\Util\PluginOutput; use Icinga\Module\Icingadb\Widget\PluginOutputContainer; @@ -35,7 +35,7 @@ class RedundancyGroupListItem extends StateListItem protected $defaultAttributes = ['class' => ['list-item', 'redundancy-group-list-item']]; - /** @var DependencyNodeSummary Objects state summary */ + /** @var RedundancyGroupSummary Objects state summary */ protected $summary; /** @var RedundancyGroupState */ @@ -48,7 +48,7 @@ protected function init(): void { parent::init(); - $this->summary = DependencyNodeSummary::on($this->getDb()) + $this->summary = RedundancyGroupSummary::on($this->getDb()) ->filter(Filter::equal('id', $this->item->id)) ->first();