Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zabbix/zabbix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Chalenko <gregory.chalenko@zabbix.com>2021-01-06 16:02:16 +0300
committerGregory Chalenko <gregory.chalenko@zabbix.com>2021-01-06 16:02:16 +0300
commitbd1c2e4693dcd81afa6a0f29cad4057c527addd8 (patch)
treea9d76c33b2259c142d73e9a51a95dd61495922e9 /ui/app/controllers
parent141a6627039eb9da13a93509a419ac4a984a79e1 (diff)
..F....... [ZBXNEXT-6311,ZBXNEXT-6314] changes in host availability widget
Diffstat (limited to 'ui/app/controllers')
-rw-r--r--ui/app/controllers/CControllerWidgetHostAvailView.php18
1 files changed, 11 insertions, 7 deletions
diff --git a/ui/app/controllers/CControllerWidgetHostAvailView.php b/ui/app/controllers/CControllerWidgetHostAvailView.php
index 3defee59135..a7f05aabb16 100644
--- a/ui/app/controllers/CControllerWidgetHostAvailView.php
+++ b/ui/app/controllers/CControllerWidgetHostAvailView.php
@@ -58,18 +58,22 @@ class CControllerWidgetHostAvailView extends CControllerWidget {
? ['status' => HOST_STATUS_MONITORED, 'maintenance_status' => HOST_MAINTENANCE_STATUS_OFF]
: ['status' => HOST_STATUS_MONITORED]
]);
+ $availability_priority = [INTERFACE_AVAILABLE_FALSE, INTERFACE_AVAILABLE_UNKNOWN, INTERFACE_AVAILABLE_TRUE];
foreach ($db_hosts as $host) {
- $ignore_types = [];
+ $host_interfaces = array_fill_keys($interface_types, []);
foreach ($host['interfaces'] as $interface) {
- if (array_key_exists($interface['type'], $ignore_types)) {
- continue;
- }
+ $host_interfaces[$interface['type']][] = $interface['available'];
+ }
+
+ $host_interfaces = array_filter($host_interfaces);
- $ignore_types[$interface['type']] = 1;
- $hosts_count[$interface['type']][$interface['available']]++;
- $hosts_total[$interface['type']]++;
+ foreach ($host_interfaces as $type => $interfaces) {
+ $interfaces_availability = array_intersect($availability_priority, $interfaces);
+ $available = reset($interfaces_availability);
+ $hosts_count[$type][$available]++;
+ $hosts_total[$type]++;
}
}