diff --git a/html/css/styles.css b/html/css/styles.css index cf05479f1d..a51e22a4cf 100644 --- a/html/css/styles.css +++ b/html/css/styles.css @@ -315,6 +315,7 @@ A.purple:visited, a.purple, .purple { color: #740074; } .bluebg { background-color: #aaaaff; } .greenbg { background-color: #aaffaa; } .greybg { background-color: #DEEFEF; } +.blackbg { background-color: #000000; } .selector { width:275px; @@ -1926,6 +1927,14 @@ label { border:1px solid #FFB733; } +.device-availability.ignored, .service-availability.ignored { + border:1px solid #36393D; +} + +.device-availability.disabled, .service-availability.disabled { + border:1px solid #000000; +} + .availability-label { float:right; margin:-8px; diff --git a/html/includes/common/availability-map.inc.php b/html/includes/common/availability-map.inc.php index cc00b3dcae..423cfa18e6 100644 --- a/html/includes/common/availability-map.inc.php +++ b/html/includes/common/availability-map.inc.php @@ -35,10 +35,10 @@ if (defined('SHOW_SETTINGS')) { $common_output[] = '
-
+
-
+
'; @@ -46,17 +46,51 @@ if (defined('SHOW_SETTINGS')) { if ($config['webui']['availability_map_compact'] == 1) { $common_output[] = '
-
+
-
+
'; } + $showDisabledAndIgnored = isset($widget_settings['show_disabled_and_ignored']) && $widget_settings['show_disabled_and_ignored']; + $common_output[] = '
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+
@@ -64,12 +98,27 @@ if (defined('SHOW_SETTINGS')) { '; } else { require_once 'includes/object-cache.inc.php'; + + $sql = dbFetchRow('SELECT `settings` FROM `users_widgets` WHERE `user_id` = ? AND `widget_id` = ?', array($_SESSION["user_id"], '1')); + $widget_mode = json_decode($sql['settings']); + + if (isset($_SESSION["map_view"])) { + $mode = $_SESSION["map_view"]; + } else { + $mode = $widget_mode->{'mode'}; + } + + $showDisabledAndIgnored = $widget_mode->{'show_disabled_and_ignored'}; $host_up_count = 0; $host_warn_count = 0; $host_down_count = 0; + $host_ignored_count = 0; + $host_disabled_count = 0; $service_up_count = 0; $service_warn_count = 0; $service_down_count = 0; + $service_ignored_count = 0; + $service_disabled_count = 0; if ($config['webui']['availability_map_sort_status'] == 1) { $deviceOrderBy = 'status'; @@ -91,7 +140,7 @@ if (defined('SHOW_SETTINGS')) { $in_devices = implode(',', $in_devices); } - $sql = 'SELECT `D`.`hostname`, `D`.`sysName`, `D`.`device_id`, `D`.`status`, `D`.`uptime`, `D`.`os`, `D`.`icon` FROM `devices` AS `D`'; + $sql = 'SELECT `D`.`hostname`, `D`.`sysName`, `D`.`device_id`, `D`.`status`, `D`.`uptime`, `D`.`os`, `D`.`icon`, `D`.`ignore`, `D`.`disabled` FROM `devices` AS `D`'; if (is_normal_user() === true) { $sql .= ' , `devices_perms` AS P WHERE D.`device_id` = P.`device_id` AND P.`user_id` = ? AND'; @@ -102,17 +151,30 @@ if (defined('SHOW_SETTINGS')) { $sql .= ' WHERE'; } + if ($showDisabledAndIgnored != 1) { + $sql .= " `D`.`ignore` = '0' AND `D`.`disabled` = '0' AND"; + } if ($config['webui']['availability_map_use_device_groups'] != 0 && isset($in_devices)) { - $sql .= " `D`.`ignore` = '0' AND `D`.`disabled` = '0' AND `D`.`device_id` IN (" . $in_devices . ") ORDER BY `" . $deviceOrderBy . "`"; + $sql .= " `D`.`device_id` IN (".$in_devices.")"; } else { - $sql .= " `D`.`ignore` = '0' AND `D`.`disabled` = '0' ORDER BY `" . $deviceOrderBy . "`"; + $sql .= " TRUE"; } + $sql .= " ORDER BY `".$deviceOrderBy."`"; + $temp_output = array(); foreach (dbFetchRows($sql, $param) as $device) { - if ($device['status'] == '1') { + if ($device['disabled'] == '1') { + $deviceState = "disabled"; + $deviceLabel = "blackbg"; + $host_disabled_count++; + } else if ($device['ignore'] == '1') { + $deviceState = "ignored"; + $deviceLabel = "label-default"; + $host_ignored_count++; + } else if ($device['status'] == '1') { if (($device['uptime'] < $config['uptime_warning']) && ($device['uptime'] != '0')) { $deviceState = 'warn'; $deviceLabel = 'label-warning'; @@ -155,11 +217,19 @@ if (defined('SHOW_SETTINGS')) { } if (($mode == 1 || $mode == 2) && ($config['show_services'] != 0)) { - $service_query = 'select `S`.`service_type`, `S`.`service_id`, `S`.`service_desc`, `S`.`service_status`, `D`.`hostname`, `D`.`sysName`, `D`.`device_id`, `D`.`os`, `D`.`icon` from services S, devices D where `S`.`device_id` = `D`.`device_id` ORDER BY ' . $serviceOrderBy . ';'; + $service_query = 'select `S`.`service_type`, `S`.`service_id`, `S`.`service_desc`, `S`.`service_status`, `S`.`service_ignore`, `S`.`service.disabled`, `D`.`hostname`, `D`.`sysName`, `D`.`device_id`, `D`.`os`, `D`.`icon` from services S, devices D where `S`.`device_id` = `D`.`device_id` ORDER BY '.$serviceOrderBy.';'; $services = dbFetchRows($service_query); if (count($services) > 0) { foreach ($services as $service) { - if ($service['service_status'] == '0') { + if ($service['service_disabled'] == '1') { + $serviceState = "disabled"; + $serviceLabel = "blackbg"; + $serviceDisabledCount++; + } else if ($service['service_ignore'] == '1') { + $serviceState = "ignored"; + $deviceLabel = "label-default"; + $serviceIgnoredCount++; + } else if ($service['service_status'] == '0') { $serviceLabel = "label-success"; $serviceLabelOld = 'availability-map-oldview-box-up'; $serviceState = "up"; @@ -262,13 +332,26 @@ if (defined('SHOW_SETTINGS')) { $serviceClass = 'widget-availability-service'; } + $disabledAndIgnoredDeviceHeaders = ''; + $disabledAndIgnoredServiceHeaders = ''; + + if ($showDisabledAndIgnored == 1) { + $disabledAndIgnoredDeviceHeaders = ' + ignored: '.$host_ignored_count.' + disabled: '.$host_disabled_count.''; + $disabledAndIgnoredServiceHeaders = ' + ignored: '.$service_ignored_count.' + disabled: '.$service_disabled_count.''; + } + if ($mode == 0 || $mode == 2) { $temp_header[] = '
Total hosts - up: ' . $host_up_count . ' - warn: ' . $host_warn_count . ' - down: ' . $host_down_count . ' + up: '.$host_up_count.' + warn: '.$host_warn_count.' + down: '.$host_down_count.' + '.$disabledAndIgnoredDeviceHeaders.'
'; } @@ -276,9 +359,10 @@ if (defined('SHOW_SETTINGS')) { $temp_header[] = '
Total services - up: ' . $service_up_count . ' - warn: ' . $service_warn_count . ' - down: ' . $service_down_count . ' + up: '.$service_up_count.' + warn: '.$service_warn_count.' + down: '.$service_down_count.' + '.$disabledAndIgnoredServiceHeader.'
'; }