2015-07-21 23:01:57 +01:00
< ? php
/*
2016-05-04 22:49:13 +02:00
* LibreNMS
*
* Copyright (c) 2015 Søren Friis Rosiak <sorenrosiak@gmail.com>
* Copyright (c) 2016 Jens Langhammer <jens@beryju.org>
2016-08-12 22:51:29 +03:00
* Copyright (c) 2016 Cercel Valentin <crc@nuamchefazi.ro>
2016-05-04 22:49:13 +02:00
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
2016-08-22 21:12:44 +03:00
2016-10-30 14:20:55 -06:00
if ( isset ( $widget_settings [ 'mode_select' ]) && $widget_settings [ 'mode_select' ] !== '' ) {
$mode = $widget_settings [ 'mode_select' ];
} elseif ( isset ( $_SESSION [ " map_view " ]) && is_numeric ( $_SESSION [ " map_view " ])) {
2016-09-22 00:11:16 +03:00
$mode = $_SESSION [ " map_view " ];
} else {
2016-10-30 14:20:55 -06:00
$mode = 0 ;
2016-09-22 00:11:16 +03:00
}
2016-08-28 23:48:06 +03:00
$select_modes = array (
'0' => 'only devices' ,
'1' => 'only services' ,
'2' => 'devices and services' ,
);
2016-09-22 00:11:16 +03:00
if ( $config [ 'webui' ][ 'availability_map_compact' ] == 1 ) {
2016-11-22 07:47:47 -06:00
$compact_tile = $widget_settings [ 'tile_size' ];
2016-09-22 00:11:16 +03:00
}
2016-10-14 21:04:38 +03:00
$show_disabled_ignored = $widget_settings [ 'show_disabled_and_ignored' ];
2016-09-24 03:28:01 +03:00
2016-09-06 02:44:55 +03:00
if ( defined ( 'SHOW_SETTINGS' )) {
$common_output [] = '
<form class="form" onsubmit="widget_settings(this); return false;">
<div class="form-group">
2016-09-07 15:41:04 -06:00
<div class="col-sm-4">
2016-09-24 17:10:39 +03:00
<label for="title" class="control-label availability-map-widget-header">Widget title</label>
2016-09-06 02:44:55 +03:00
</div>
2016-09-07 15:41:04 -06:00
<div class="col-sm-6">
2016-09-06 02:44:55 +03:00
<input type="text" class="form-control" name="title" placeholder="Custom title for widget" value="' . htmlspecialchars ( $widget_settings [ 'title' ]) . '">
</div>
2016-09-22 00:11:16 +03:00
</div>' ;
2016-10-15 10:58:27 -06:00
if ( $config [ 'webui' ][ 'availability_map_compact' ] === false ) {
$common_output [] = '
<div class="form-group">
<div class="col-sm-4">
<label for="color_only_select" class="control-label availability-map-widget-header">Uniform Tiles</label>
</div>
<div class="col-sm-6">
<select class="form-control" name="color_only_select">
<option value="1"' . ( $widget_settings [ 'color_only_select' ] == 1 ? ' selected' : '' ) . ' >yes</option>
<option value="0"' . ( $widget_settings [ 'color_only_select' ] == 1 ? '' : ' selected' ) . ' >no</option>
</select>
</div>
</div>
' ;
}
2016-09-22 00:11:16 +03:00
if ( $config [ 'webui' ][ 'availability_map_compact' ] == 1 ) {
$common_output [] = '
2016-09-06 02:44:55 +03:00
<div class="form-group">
2016-09-07 15:41:04 -06:00
<div class="col-sm-4">
2016-11-22 07:47:47 -06:00
<label for="tile_size" class="control-label availability-map-widget-header">Tile size</label>
2016-09-22 00:11:16 +03:00
</div>
2016-09-07 15:41:04 -06:00
<div class="col-sm-6">
2016-11-22 07:47:47 -06:00
<input type="text" class="form-control" name="tile_size" value="' . $compact_tile . '">
2016-09-22 00:11:16 +03:00
</div>
</div>' ;
}
2016-09-24 03:28:01 +03:00
if ( $show_disabled_ignored == 1 ) {
$selected_yes = 'selected' ;
$selected_no = '' ;
} else {
$selected_yes = '' ;
$selected_no = 'selected' ;
}
2016-09-07 15:41:04 -06:00
2016-09-22 00:11:16 +03:00
$common_output [] = '
<div class="form-group">
2016-09-24 03:28:01 +03:00
<div class="col-sm-4">
2016-09-24 17:10:39 +03:00
<label for="show_disabled_and_ignored" class="control-label availability-map-widget-header">Disabled/ignored</label>
2016-09-24 03:28:01 +03:00
</div>
2016-09-07 15:41:04 -06:00
<div class="col-sm-6">
2016-09-24 03:28:01 +03:00
<select class="form-control" name="show_disabled_and_ignored">
<option value="1" ' . $selected_yes . '>yes</option>
<option value="0" ' . $selected_no . '>no</option>
</select>
2016-09-07 15:41:04 -06:00
</div>
2016-09-24 03:28:01 +03:00
</div>' ;
2016-09-07 15:41:04 -06:00
2016-10-30 14:20:55 -06:00
$common_output [] = '
<div class ="form-group">
<div class="col-sm-4">
<label for="mode_select" class="control-lable availability-map-widget-header">Mode</label>
</div>
<div class="col-sm-6">
<select name="mode_select" class="form-control">' ;
if ( $config [ 'show_services' ] == 0 ) {
$common_output [] = '<option value="0" selected>only devices</option>' ;
} else {
foreach ( $select_modes as $mode_select => $option ) {
if ( $mode_select == $widget_settings [ " mode_select " ]) {
$selected = 'selected' ;
} else {
$selected = '' ;
}
$common_output [] = '<option value="' . $mode_select . '" ' . $selected . '>' . $option . '</option>' ;
}
}
$common_output [] = '
</select>
</div>
</div>' ;
2016-09-24 03:28:01 +03:00
if ( $config [ 'webui' ][ 'availability_map_compact' ] == 1 ) {
$common_outputp [] = '
<div class="form-group">
<div class="col-sm-4">
2016-11-22 07:47:47 -06:00
<label for="tile_size" class="control-label availability-map-widget-header">Tile width</label>
2016-09-24 03:28:01 +03:00
</div>
<div class="col-sm-6">
2016-11-22 07:47:47 -06:00
<input class="form-control" type="text" onkeypress="return (event.charCode == 8 || event.charCode == 0) ? null : event.charCode >= 48 && event.charCode <= 57" name="tile_size" placeholder="Tile side in px" value="' . $compact_tile . '">
2016-09-24 03:28:01 +03:00
</div>
2016-09-07 15:41:04 -06:00
</div>
2016-09-24 03:28:01 +03:00
' ;
}
2016-09-07 15:41:04 -06:00
2016-09-24 03:28:01 +03:00
$common_output [] = '
<br style="clear:both;">
<div class="form-group">
2016-09-06 02:44:55 +03:00
<div class="col-sm-2">
<button type="submit" class="btn btn-default">Set</button>
</div>
</div>
</form>' ;
2016-09-06 02:01:15 +03:00
} else {
2016-09-06 02:44:55 +03:00
require_once 'includes/object-cache.inc.php' ;
2016-09-07 15:41:04 -06:00
2016-09-06 02:44:55 +03:00
$host_up_count = 0 ;
$host_warn_count = 0 ;
$host_down_count = 0 ;
2016-09-07 15:41:04 -06:00
$host_ignored_count = 0 ;
$host_disabled_count = 0 ;
2016-09-06 02:44:55 +03:00
$service_up_count = 0 ;
$service_warn_count = 0 ;
$service_down_count = 0 ;
2016-09-07 15:41:04 -06:00
$service_ignored_count = 0 ;
$service_disabled_count = 0 ;
2016-08-28 23:48:06 +03:00
2016-09-06 02:44:55 +03:00
if ( $config [ 'webui' ][ 'availability_map_sort_status' ] == 1 ) {
$deviceOrderBy = 'status' ;
$serviceOrderBy = '`S`.`service_status` DESC' ;
2016-08-28 23:48:06 +03:00
} else {
2016-09-06 02:44:55 +03:00
$deviceOrderBy = 'hostname' ;
$serviceOrderBy = '`D`.`hostname`' ;
2016-08-28 23:48:06 +03:00
}
2015-07-21 23:01:57 +01:00
2016-09-06 02:44:55 +03:00
if ( $mode == 0 || $mode == 2 ) {
// Only show devices if mode is 0 or 2 (Only Devices or both)
if ( $config [ 'webui' ][ 'availability_map_use_device_groups' ] != 0 ) {
$device_group = 'SELECT `D`.`device_id` FROM `device_group_device` AS `D` WHERE `device_group_id` = ?' ;
$param = array ( $_SESSION [ 'group_view' ]);
$devices = dbFetchRows ( $device_group , $param );
foreach ( $devices as $in_dev ) {
$in_devices [] = $in_dev [ 'device_id' ];
}
$in_devices = implode ( ',' , $in_devices );
}
2015-07-21 23:01:57 +01:00
2016-09-29 09:37:53 +03:00
$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`' ;
2016-09-06 02:44:55 +03:00
if ( is_normal_user () === true ) {
2016-09-29 09:37:53 +03:00
$sql .= ' , `devices_perms` AS P WHERE D.`device_id` = P.`device_id` AND P.`user_id` = ? AND ' ;
2016-09-06 02:44:55 +03:00
$param = array (
$_SESSION [ 'user_id' ]
);
} else {
2016-09-29 09:37:53 +03:00
$sql .= ' WHERE ' ;
2016-09-06 02:44:55 +03:00
}
2016-08-28 23:48:06 +03:00
2016-09-29 09:37:53 +03:00
if ( $show_disabled_ignored != 1 ) {
$sql .= '`D`.`ignore` = 0 AND `D`.`disabled` = 0 ' ;
2016-09-06 02:01:15 +03:00
} else {
2016-09-29 09:37:53 +03:00
$sql .= '(`D`.`status` IN (0,1,2) OR `D`.`ignore` = 1 OR `D`.`disabled` = 1)' ;
}
if ( $config [ 'webui' ][ 'availability_map_use_device_groups' ] != 0 && isset ( $in_devices )) {
$sql .= " AND `D`.`device_id` IN ( $in_devices ) " ;
2016-09-06 02:01:15 +03:00
}
2016-08-12 22:51:29 +03:00
2016-09-07 15:41:04 -06:00
$sql .= " ORDER BY ` " . $deviceOrderBy . " ` " ;
2016-09-06 02:44:55 +03:00
$temp_output = array ();
foreach ( dbFetchRows ( $sql , $param ) as $device ) {
2016-09-07 15:41:04 -06:00
if ( $device [ 'disabled' ] == '1' ) {
$deviceState = " disabled " ;
$deviceLabel = " blackbg " ;
$host_disabled_count ++ ;
2016-09-24 03:28:01 +03:00
} elseif ( $device [ 'ignore' ] == '1' ) {
2016-09-07 15:41:04 -06:00
$deviceState = " ignored " ;
$deviceLabel = " label-default " ;
$host_ignored_count ++ ;
2016-09-24 03:28:01 +03:00
} elseif ( $device [ 'status' ] == '1' ) {
2017-10-31 14:15:23 +01:00
if (( $device [ 'uptime' ] < $config [ 'uptime_warning' ]) && ( $device [ 'uptime' ] != 0 )) {
2016-09-06 02:44:55 +03:00
$deviceState = 'warn' ;
$deviceLabel = 'label-warning' ;
$deviceLabelOld = 'availability-map-oldview-box-warn' ;
$host_warn_count ++ ;
} else {
$deviceState = 'up' ;
$deviceLabel = 'label-success' ;
$deviceLabelOld = 'availability-map-oldview-box-up' ;
$host_up_count ++ ;
}
} else {
$deviceState = 'down' ;
$deviceLabel = 'label-danger' ;
$deviceLabelOld = 'availability-map-oldview-box-down' ;
$host_down_count ++ ;
}
2017-05-05 12:25:58 +01:00
$device_system_name = format_hostname ( $device );
2016-09-06 02:44:55 +03:00
2016-09-22 00:11:16 +03:00
if ( $config [ 'webui' ][ 'availability_map_compact' ] == 0 ) {
2016-09-06 02:44:55 +03:00
if ( $directpage == " yes " ) {
2017-01-24 16:16:01 -06:00
$deviceIcon = getIconTag ( $device );
2016-09-06 02:44:55 +03:00
$temp_output [] = '
2017-03-03 16:48:53 -03:00
<a href="' . generate_device_url ( $device ) . '" title="' . $device_system_name . " - " . formatUptime ( $device [ 'uptime' ]) . '">
2016-09-24 03:28:01 +03:00
<div class="device-availability ' . $deviceState . '" style="width:' . $config [ 'webui' ][ 'availability_map_box_size' ] . 'px;">
2016-09-06 02:01:15 +03:00
<span class="availability-label label ' . $deviceLabel . ' label-font-border">' . $deviceState . '</span>
<span class="device-icon">' . $deviceIcon . '</span><br>
2017-03-03 16:48:53 -03:00
<span class="small">' . shorthost ( $device_system_name ) . '</span>
2016-08-15 01:42:02 +03:00
</div>
2016-08-22 21:12:44 +03:00
</a>' ;
2016-09-06 02:44:55 +03:00
} else {
2016-10-15 10:58:27 -06:00
if ( $widget_settings [ 'color_only_select' ] == 1 ) {
$deviceState = ' ' ;
$deviceLabel .= ' widget-availability-fixed' ;
}
2016-09-06 02:44:55 +03:00
$temp_output [] = '
2017-03-03 16:48:53 -03:00
<a href="' . generate_device_url ( $device ) . '" title="' . $device_system_name . " - " . formatUptime ( $device [ 'uptime' ]) . '">
2016-09-06 02:01:15 +03:00
<span class="label ' . $deviceLabel . ' widget-availability label-font-border">' . $deviceState . '</span>
</a>' ;
2016-09-06 02:44:55 +03:00
}
} else {
2017-03-03 16:48:53 -03:00
$temp_output [] = " <a href=' " . generate_device_url ( $device ) . " ' title=' " . $device_system_name . ' - ' . formatUptime ( $device [ 'uptime' ]) . " '><div class=' " . $deviceLabelOld . " ' style='width: ${ compact_tile}px;height:${compact_tile } px;'></div></a> " ;
2016-05-04 22:49:13 +02:00
}
}
2015-07-21 23:01:57 +01:00
}
2015-07-24 08:55:13 +01:00
2016-09-06 02:44:55 +03:00
if (( $mode == 1 || $mode == 2 ) && ( $config [ 'show_services' ] != 0 )) {
2017-10-19 08:49:07 +02:00
if ( is_normal_user () === false ) {
$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_par = array ();
} else {
$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, devices_perms P where `S`.`device_id` = `D`.`device_id` AND D.device_id = P.device_id AND P.user_id = ? ORDER BY ' . $serviceOrderBy . ';' ;
$service_par = array ( $_SESSION [ 'user_id' ]);
}
$services = dbFetchRows ( $service_query , $service_par );
2016-09-06 02:44:55 +03:00
if ( count ( $services ) > 0 ) {
foreach ( $services as $service ) {
2016-09-24 03:28:01 +03:00
if ( $service [ 'service_status' ] == '0' ) {
2016-09-06 02:44:55 +03:00
$serviceLabel = " label-success " ;
$serviceLabelOld = 'availability-map-oldview-box-up' ;
$serviceState = " up " ;
$service_up_count ++ ;
} elseif ( $service [ 'service_status' ] == '1' ) {
$serviceLabel = " label-warning " ;
$serviceLabelOld = 'availability-map-oldview-box-warn' ;
$serviceState = " warn " ;
$service_warn_count ++ ;
} else {
$serviceLabel = " label-danger " ;
$serviceLabelOld = 'availability-map-oldview-box-down' ;
$serviceState = " down " ;
$service_down_count ++ ;
}
2017-05-05 12:25:58 +01:00
$service_system_name = format_hostname ( $service );
2016-08-12 22:51:29 +03:00
2016-09-22 00:11:16 +03:00
if ( $config [ 'webui' ][ 'availability_map_compact' ] == 0 ) {
2016-09-06 02:44:55 +03:00
if ( $directpage == " yes " ) {
2017-01-24 16:16:01 -06:00
$deviceIcon = getIconTag ( $service );
2016-09-06 02:44:55 +03:00
$temp_output [] = '
2017-03-03 16:48:53 -03:00
<a href="' . generate_url ( array ( 'page' => 'device' , 'tab' => 'services' , 'device' => $service [ 'device_id' ])) . '" title="' . $service_system_name . " - " . $service [ 'service_type' ] . " - " . $service [ 'service_desc' ] . '">
2016-09-24 03:28:01 +03:00
<div class="service-availability ' . $serviceState . '" style="width:' . $config [ 'webui' ][ 'availability_map_box_size' ] . 'px;">
2016-09-06 02:01:15 +03:00
<span class="service-name-label label ' . $serviceLabel . ' label-font-border">' . $service [ " service_type " ] . '</span>
<span class="availability-label label ' . $serviceLabel . ' label-font-border">' . $serviceState . '</span>
<span class="device-icon">' . $deviceIcon . '</span><br>
2017-03-03 16:48:53 -03:00
<span class="small">' . shorthost ( $service_system_name ) . '</span>
2016-08-22 21:12:44 +03:00
</div>
</a>' ;
2016-09-06 02:44:55 +03:00
} else {
2016-11-10 14:25:41 -07:00
$serviceText = $service [ 'service_type' ] . ' - ' . $serviceState ;
2016-10-15 10:58:27 -06:00
if ( $widget_settings [ 'color_only_select' ] == 1 ) {
2016-11-10 14:25:41 -07:00
$serviceText = ' ' ;
2016-10-15 10:58:27 -06:00
$serviceLabel .= ' widget-availability-fixed' ;
}
2016-09-06 02:44:55 +03:00
$temp_output [] = '
2017-03-03 16:48:53 -03:00
<a href="' . generate_url ( array ( 'page' => 'device' , 'tab' => 'services' , 'device' => $service [ 'device_id' ])) . '" title="' . shorthost ( $service_system_name ) . " - " . $service [ 'service_type' ] . " - " . $service [ 'service_desc' ] . '">
2016-11-10 14:25:41 -07:00
<span class="label ' . $serviceLabel . ' widget-availability label-font-border">' . $serviceText . '</span>
2016-09-06 02:01:15 +03:00
</a>' ;
2016-09-06 02:44:55 +03:00
}
} else {
2017-03-03 16:48:53 -03:00
$temp_output [] = " <a href=' " . generate_url ( array ( 'page' => 'device' , 'tab' => 'services' , 'device' => $service [ 'device_id' ])) . " ' title=' ${ service_system_name } - ${ service['service_type'] } - ${ service['service_desc'] } '><div class=' " . $serviceLabelOld . " ' style='width: ${ compact_tile}px;height:${compact_tile } px;'></div></a> " ;
2016-08-22 21:12:44 +03:00
}
2015-09-22 12:20:55 +00:00
}
2016-09-06 02:44:55 +03:00
} else {
$temp_output [] = '' ;
2016-08-12 22:51:29 +03:00
}
}
2015-09-22 12:20:55 +00:00
2016-09-06 02:44:55 +03:00
if ( $directpage == " yes " ) {
$temp_header [] = '
2016-08-15 01:42:02 +03:00
<div class="page-availability-title-left">
<span class="page-availability-title">Availability map for</span>
2016-08-22 21:12:44 +03:00
<select id="mode" class="page-availability-report-select" name="mode">' ;
2016-09-24 04:15:08 +03:00
if ( $config [ 'show_services' ] == 0 ) {
$temp_header [] = '<option value="0" selected>only devices</option>' ;
} else {
foreach ( $select_modes as $mode_select => $option ) {
if ( $mode_select == $mode ) {
$selected = 'selected' ;
} else {
$selected = '' ;
2016-09-06 02:44:55 +03:00
}
2016-09-24 04:15:08 +03:00
$temp_header [] = '<option value="' . $mode_select . '" ' . $selected . '>' . $option . '</option>' ;
2016-08-28 23:48:06 +03:00
}
2016-09-24 04:15:08 +03:00
}
2016-08-22 21:12:44 +03:00
2016-09-06 02:44:55 +03:00
$temp_header [] =
'</select>
2016-08-15 01:42:02 +03:00
</div>
<div class="page-availability-title-right">' ;
2016-09-02 20:42:45 +03:00
2016-09-06 02:44:55 +03:00
if (( $config [ 'webui' ][ 'availability_map_use_device_groups' ] != 0 ) && ( $mode == 0 || $mode == 2 )) {
$sql = 'SELECT `G`.`id`, `G`.`name` FROM `device_groups` AS `G`' ;
$dev_groups = dbFetchRows ( $sql );
2016-09-02 20:42:45 +03:00
2016-09-06 02:44:55 +03:00
if ( $_SESSION [ 'group_view' ] == 0 ) {
$selected = 'selected' ;
} else {
$selected = '' ;
}
2016-09-02 20:42:45 +03:00
2016-09-06 02:44:55 +03:00
$temp_header [] = '
2016-09-02 20:42:45 +03:00
<span class="page-availability-title">Device group</span>
<select id="group" class="page-availability-report-select" name="group">
2016-09-06 02:01:15 +03:00
<option value="0" ' . $selected . '>show all devices</option>' ;
2016-09-02 20:42:45 +03:00
2016-09-06 02:44:55 +03:00
foreach ( $dev_groups as $dev_group ) {
if ( $_SESSION [ 'group_view' ] == $dev_group [ 'id' ]) {
$selected = 'selected' ;
} else {
$selected = '' ;
}
$temp_header [] = '<option value="' . $dev_group [ 'id' ] . '" ' . $selected . '>' . $dev_group [ 'name' ] . '</option>' ;
2016-09-02 20:42:45 +03:00
}
2016-09-06 02:44:55 +03:00
$temp_header [] = '</select>' ;
2016-09-02 20:42:45 +03:00
}
2016-08-12 22:51:29 +03:00
}
2016-09-06 02:44:55 +03:00
if ( $directpage == " yes " ) {
$deviceClass = 'page-availability-report-host' ;
2016-09-20 13:21:59 -06:00
$serviceClass = 'page-availability-report-host' ;
2016-09-06 02:44:55 +03:00
} else {
$deviceClass = 'widget-availability-host' ;
$serviceClass = 'widget-availability-service' ;
}
2016-08-28 23:48:06 +03:00
2016-09-24 03:28:01 +03:00
if ( $show_disabled_ignored == 1 ) {
$disabled_ignored_header = '
2016-09-07 15:41:04 -06:00
<span class="label label-default label-font-border label-border">ignored: ' . $host_ignored_count . '</span>
<span class="label blackbg label-font-border label-border">disabled: ' . $host_disabled_count . '</span>' ;
}
2016-09-06 02:44:55 +03:00
if ( $mode == 0 || $mode == 2 ) {
$temp_header [] = '
2016-09-06 02:01:15 +03:00
<div class="' . $deviceClass . '">
2016-08-15 01:42:02 +03:00
<span>Total hosts</span>
2016-09-07 15:41:04 -06:00
<span class="label label-success label-font-border label-border">up: ' . $host_up_count . '</span>
<span class="label label-warning label-font-border label-border">warn: ' . $host_warn_count . '</span>
<span class="label label-danger label-font-border label-border">down: ' . $host_down_count . '</span>
2016-09-24 03:28:01 +03:00
' . $disabled_ignored_header . '
2016-08-15 01:42:02 +03:00
</div>' ;
2016-09-06 02:44:55 +03:00
}
2016-08-12 22:51:29 +03:00
2016-09-06 02:44:55 +03:00
if (( $mode == 1 || $mode == 2 ) && ( $config [ 'show_services' ] != 0 )) {
$temp_header [] = '
2016-09-06 02:01:15 +03:00
<div class="' . $serviceClass . '">
2016-08-15 01:42:02 +03:00
<span>Total services</span>
2016-09-07 15:41:04 -06:00
<span class="label label-success label-font-border label-border">up: ' . $service_up_count . '</span>
<span class="label label-warning label-font-border label-border">warn: ' . $service_warn_count . '</span>
<span class="label label-danger label-font-border label-border">down: ' . $service_down_count . '</span>
2016-08-15 01:42:02 +03:00
</div>' ;
2016-09-06 02:44:55 +03:00
}
2015-09-22 12:20:55 +00:00
2016-09-06 02:44:55 +03:00
$temp_header [] = '</div>' ;
$temp_header [] = '<br style="clear:both;">' ;
2016-08-12 22:51:29 +03:00
2016-09-06 02:44:55 +03:00
$common_output = array_merge ( $temp_header , $temp_output );
}