php version upgrade
This commit is contained in:
parent
9492d11cc8
commit
b736746e1c
|
@ -2410,31 +2410,48 @@ function progress_bubble($progress, $width, $height, $title = '', $mode = 1, $va
|
|||
"&colorRGB=". $colorRGB . "' />";
|
||||
}
|
||||
|
||||
function graph_sla_slicebar ($id, $period, $sla_min, $sla_max, $date, $daysWeek = null, $time_from = null, $time_to = null, $width, $height, $home_url, $ttl = 1, $data = false, $round_corner = null) {
|
||||
function graph_sla_slicebar (
|
||||
$id, $period, $sla_min, $sla_max,
|
||||
$date, $daysWeek = null, $time_from = null,
|
||||
$time_to = null, $width, $height, $home_url,
|
||||
$ttl = 1, $data = false, $round_corner = null) {
|
||||
|
||||
global $config;
|
||||
|
||||
|
||||
if ($round_corner === null) {
|
||||
$round_corner = $config['round_corner'];
|
||||
}
|
||||
|
||||
// If the data is not provided, we got it
|
||||
if ($data === false) {
|
||||
$data = reporting_get_agentmodule_sla_array ($id, $period,
|
||||
$sla_min, $sla_max, $date, $daysWeek, null, null);
|
||||
}
|
||||
|
||||
|
||||
$col_planned_downtime = '#20973F';
|
||||
|
||||
$colors = array(1 => COL_NORMAL,
|
||||
|
||||
$colors = array(
|
||||
1 => COL_NORMAL,
|
||||
2 => COL_WARNING,
|
||||
3 => COL_CRITICAL,
|
||||
4 => COL_UNKNOWN,
|
||||
5 => COL_DOWNTIME,
|
||||
6 => COL_NOTINIT,
|
||||
7 => COL_IGNORED);
|
||||
|
||||
return slicesbar_graph($data, $period, $width, $height, $colors,
|
||||
$config['fontpath'], $round_corner, $home_url, $ttl);
|
||||
7 => COL_IGNORED
|
||||
);
|
||||
|
||||
return $return['chart'] = flot_slicesbar_graph (
|
||||
$data,
|
||||
$period,
|
||||
$width,
|
||||
$height,
|
||||
'',
|
||||
$colors,
|
||||
$config['fontpath'],
|
||||
$round_corner,
|
||||
$home_url,
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
0,
|
||||
array(),
|
||||
true,
|
||||
$ttl
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3263,21 +3280,8 @@ function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $ho
|
|||
$colors = array(1 => COL_NORMAL, 2 => COL_WARNING, 3 => COL_CRITICAL, 4 => COL_UNKNOWN);
|
||||
|
||||
// Draw slicebar graph
|
||||
if ($config['flash_charts']) {
|
||||
$out = flot_slicesbar_graph($data, $period, $width, $height, $full_legend, $colors, $config['fontpath'], $config['round_corner'], $homeurl, '', '', false, $id_agent, $full_legend_date);
|
||||
}
|
||||
else {
|
||||
$out = slicesbar_graph($data, $period, $width, $height, $colors, $config['fontpath'], $config['round_corner'], $homeurl);
|
||||
|
||||
// Draw legend
|
||||
$out .= "<br>";
|
||||
$out .= " ";
|
||||
foreach ($legend as $hour) {
|
||||
$out .= "<span style='font-size: 6pt'>" . $hour . "</span>";
|
||||
$out .= " ";
|
||||
}
|
||||
}
|
||||
|
||||
$out = flot_slicesbar_graph($data, $period, 100, 40, $full_legend, $colors, $config['fontpath'], $config['round_corner'], $homeurl, '', '', false, $id_agent, $full_legend_date);
|
||||
|
||||
if ($return) {
|
||||
return $out;
|
||||
}
|
||||
|
@ -3317,12 +3321,7 @@ function graph_graphic_moduleevents ($id_agent, $id_module, $width, $height, $pe
|
|||
for ($i = 0; $i < $interval; $i++) {
|
||||
$bottom = $datelimit + ($periodtime * $i);
|
||||
if (! $graphic_type) {
|
||||
if ($config['flash_charts']) {
|
||||
$name = date('H:i:s', $bottom);
|
||||
}
|
||||
else {
|
||||
$name = date('H\h', $bottom);
|
||||
}
|
||||
$name = date('H\h', $bottom);
|
||||
}
|
||||
else {
|
||||
$name = $bottom;
|
||||
|
@ -3365,23 +3364,31 @@ function graph_graphic_moduleevents ($id_agent, $id_module, $width, $height, $pe
|
|||
$cont++;
|
||||
}
|
||||
|
||||
$colors = array(1 => COL_NORMAL, 2 => COL_WARNING, 3 => COL_CRITICAL, 4 => COL_UNKNOWN);
|
||||
$colors = array(
|
||||
1 => COL_NORMAL,
|
||||
2 => COL_WARNING,
|
||||
3 => COL_CRITICAL,
|
||||
4 => COL_UNKNOWN
|
||||
);
|
||||
|
||||
// Draw slicebar graph
|
||||
if ($config['flash_charts']) {
|
||||
$out = flot_slicesbar_graph($data, $period, $width, $height, $full_legend, $colors, $config['fontpath'], $config['round_corner'], $homeurl, '', '', false, $id_agent);
|
||||
}
|
||||
else {
|
||||
$out = slicesbar_graph($data, $period, $width, $height, $colors, $config['fontpath'], $config['round_corner'], $homeurl);
|
||||
|
||||
// Draw legend
|
||||
$out .= "<br>";
|
||||
$out .= " ";
|
||||
foreach ($legend as $hour) {
|
||||
$out .= "<span style='font-size: 6pt'>" . $hour . "</span>";
|
||||
$out .= " ";
|
||||
}
|
||||
}
|
||||
$out = flot_slicesbar_graph(
|
||||
$data,
|
||||
$period,
|
||||
100,
|
||||
$height,
|
||||
$full_legend,
|
||||
$colors,
|
||||
$config['fontpath'],
|
||||
$config['round_corner'],
|
||||
$homeurl,
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
$id_agent,
|
||||
array(),
|
||||
true,
|
||||
1
|
||||
);
|
||||
|
||||
if ($return) {
|
||||
return $out;
|
||||
|
@ -4068,12 +4075,20 @@ function graphic_module_events ($id_module, $width, $height, $period = 0, $homeu
|
|||
$colors = array(1 => '#38B800', 2 => '#FFFF00', 3 => '#FF0000', 4 => '#C3C3C3');
|
||||
|
||||
// Draw slicebar graph
|
||||
if ($config['flash_charts']) {
|
||||
echo flot_slicesbar_graph($data, $period, $width, 50, $legend, $colors, $config['fontpath'], $config['round_corner'], $homeurl, '', $adapt_key, $stat_win);
|
||||
}
|
||||
else {
|
||||
echo slicesbar_graph($data, $period, $width, 15, $colors, $config['fontpath'], $config['round_corner'], $homeurl);
|
||||
}
|
||||
echo flot_slicesbar_graph(
|
||||
$data,
|
||||
$period,
|
||||
$width,
|
||||
50,
|
||||
$legend,
|
||||
$colors,
|
||||
$config['fontpath'],
|
||||
$config['round_corner'],
|
||||
$homeurl,
|
||||
'',
|
||||
$adapt_key,
|
||||
$stat_win
|
||||
);
|
||||
}
|
||||
|
||||
function graph_nodata_image($width = 300, $height = 110, $type = 'area', $text = '') {
|
||||
|
|
|
@ -634,35 +634,35 @@ function reporting_make_reporting_data($report = null, $id_report,
|
|||
|
||||
function reporting_SLA($report, $content, $type = 'dinamic',
|
||||
$force_width_chart = null, $force_height_chart = null) {
|
||||
|
||||
|
||||
global $config;
|
||||
$return = array();
|
||||
$return = array();
|
||||
$return['type'] = 'SLA';
|
||||
|
||||
|
||||
if (empty($content['name'])) {
|
||||
$content['name'] = __('S.L.A.');
|
||||
}
|
||||
|
||||
|
||||
$return['title'] = $content['name'];
|
||||
$return["description"] = $content["description"];
|
||||
$return["date"] = reporting_get_date_text($report, $content);
|
||||
|
||||
|
||||
// Get chart
|
||||
reporting_set_conf_charts($width, $height, $only_image, $type,
|
||||
$content, $ttl);
|
||||
|
||||
|
||||
if (!empty($force_width_chart)) {
|
||||
$width = $force_width_chart;
|
||||
}
|
||||
|
||||
|
||||
if (!empty($force_height_chart)) {
|
||||
$height = $force_height_chart;
|
||||
}
|
||||
|
||||
|
||||
$return["id_rc"] = $content['id_rc'];
|
||||
|
||||
|
||||
$edge_interval = 10;
|
||||
|
||||
|
||||
if (empty($content['subitems'])) {
|
||||
$slas = db_get_all_rows_field_filter (
|
||||
'treport_content_sla_combined',
|
||||
|
@ -671,7 +671,7 @@ function reporting_SLA($report, $content, $type = 'dinamic',
|
|||
else {
|
||||
$slas = $content['subitems'];
|
||||
}
|
||||
|
||||
|
||||
if (empty($slas)) {
|
||||
$return['failed'] = __('There are no SLAs defined');
|
||||
}
|
||||
|
@ -684,9 +684,9 @@ function reporting_SLA($report, $content, $type = 'dinamic',
|
|||
$show_table = 1;
|
||||
}
|
||||
else{
|
||||
$show_table = 0;
|
||||
$show_table = 0;
|
||||
}
|
||||
|
||||
|
||||
if($content['show_graph'] == 1 || $content['show_graph'] == 2){
|
||||
$show_graphs = 1;
|
||||
}
|
||||
|
@ -695,14 +695,13 @@ function reporting_SLA($report, $content, $type = 'dinamic',
|
|||
}
|
||||
|
||||
$urlImage = ui_get_full_url(false, true, false, false);
|
||||
|
||||
|
||||
$sla_failed = false;
|
||||
$total_SLA = 0;
|
||||
$total_result_SLA = 'ok';
|
||||
$sla_showed = array();
|
||||
$sla_showed_values = array();
|
||||
|
||||
|
||||
foreach ($slas as $sla) {
|
||||
$server_name = $sla ['server_name'];
|
||||
//Metaconsole connection
|
||||
|
@ -713,18 +712,18 @@ function reporting_SLA($report, $content, $type = 'dinamic',
|
|||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (modules_is_disable_agent($sla['id_agent_module'])
|
||||
|| modules_is_not_init($sla['id_agent_module'])) {
|
||||
if ($metaconsole_on) {
|
||||
//Restore db connection
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
//controller min and max == 0 then dinamic min and max critical
|
||||
|
||||
//controller min and max == 0 then dinamic min and max critical
|
||||
$dinamic_text = 0;
|
||||
if($sla['sla_min'] == 0 && $sla['sla_max'] == 0){
|
||||
$sla['sla_min'] = null;
|
||||
|
@ -744,7 +743,7 @@ function reporting_SLA($report, $content, $type = 'dinamic',
|
|||
}
|
||||
}
|
||||
|
||||
//for graph slice for module-interval, if not slice=0;
|
||||
//for graph slice for module-interval, if not slice=0;
|
||||
if($show_graphs){
|
||||
$module_interval = modules_get_interval ($sla['id_agent_module']);
|
||||
$slice = $content["period"] / $module_interval;
|
||||
|
@ -752,35 +751,34 @@ function reporting_SLA($report, $content, $type = 'dinamic',
|
|||
else{
|
||||
$slice = 1;
|
||||
}
|
||||
|
||||
|
||||
//call functions sla
|
||||
$sla_array = array();
|
||||
$sla_array = reporting_advanced_sla(
|
||||
$sla['id_agent_module'],
|
||||
$report["datetime"] - $content['period'],
|
||||
$report["datetime"],
|
||||
$sla['sla_min'], // min_value -> dynamic
|
||||
$sla['sla_max'], // max_value -> dynamic
|
||||
$inverse_interval, // inverse_interval -> dynamic
|
||||
array ( "1" => $content["sunday"],
|
||||
"2" => $content["monday"],
|
||||
"3" => $content["tuesday"],
|
||||
"4" => $content["wednesday"],
|
||||
"5" => $content["thursday"],
|
||||
"6" => $content["friday"],
|
||||
"7" => $content["saturday"]
|
||||
),
|
||||
$content['time_from'],
|
||||
$content['time_to'],
|
||||
$slice
|
||||
);
|
||||
$sla['id_agent_module'],
|
||||
$report["datetime"] - $content['period'],
|
||||
$report["datetime"],
|
||||
$sla['sla_min'], // min_value -> dynamic
|
||||
$sla['sla_max'], // max_value -> dynamic
|
||||
$inverse_interval, // inverse_interval -> dynamic
|
||||
array ( "1" => $content["sunday"],
|
||||
"2" => $content["monday"],
|
||||
"3" => $content["tuesday"],
|
||||
"4" => $content["wednesday"],
|
||||
"5" => $content["thursday"],
|
||||
"6" => $content["friday"],
|
||||
"7" => $content["saturday"]
|
||||
),
|
||||
$content['time_from'],
|
||||
$content['time_to'],
|
||||
$slice
|
||||
);
|
||||
|
||||
|
||||
if ($metaconsole_on) {
|
||||
//Restore db connection
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
|
||||
$server_name = $sla ['server_name'];
|
||||
//Metaconsole connection
|
||||
if ($metaconsole_on && $server_name != '') {
|
||||
|
@ -803,7 +801,7 @@ function reporting_SLA($report, $content, $type = 'dinamic',
|
|||
}
|
||||
return ($a<$b)?-1:1;
|
||||
});
|
||||
|
||||
|
||||
// Compress (overlapped) planned downtimes
|
||||
$npd = count($planned_downtimes);
|
||||
for ($i=0; $i<$npd; $i++) {
|
||||
|
@ -908,7 +906,7 @@ function reporting_SLA($report, $content, $type = 'dinamic',
|
|||
$data['sla_value'] = $sla_array['SLA'];
|
||||
$data['sla_fixed'] = $sla_array['sla_fixed'];
|
||||
}
|
||||
|
||||
|
||||
//checks whether or not it meets the SLA
|
||||
if ($data['sla_value'] >= $sla['sla_limit']) {
|
||||
$data['sla_status'] = 1;
|
||||
|
@ -918,7 +916,7 @@ function reporting_SLA($report, $content, $type = 'dinamic',
|
|||
$sla_failed = true;
|
||||
$data['sla_status'] = 0;
|
||||
}
|
||||
|
||||
|
||||
//Do not show right modules if 'only_display_wrong' is active
|
||||
if($content['only_display_wrong'] && $sla_failed == false){
|
||||
continue;
|
||||
|
@ -927,12 +925,44 @@ function reporting_SLA($report, $content, $type = 'dinamic',
|
|||
//find order
|
||||
$data['order'] = $data['sla_value'];
|
||||
|
||||
if($show_table) {
|
||||
if($show_table) {
|
||||
$return['data'][] = $data;
|
||||
}
|
||||
|
||||
|
||||
// Slice graphs calculation
|
||||
if ($show_graphs) {
|
||||
$data_init = -1;
|
||||
$acum = 0;
|
||||
$sum = 0;
|
||||
$array_result = array();
|
||||
$i=0;
|
||||
foreach ($raw_graph as $key => $value) {
|
||||
if($data_init == -1){
|
||||
$data_init = $value['data'];
|
||||
$acum = $value['utimestamp'];
|
||||
$sum = $value['data'];
|
||||
}
|
||||
else{
|
||||
if($data_init == $value['data']){
|
||||
$acum = $acum + $value['utimestamp'];
|
||||
$sum = $sum + $value['real_data'];
|
||||
}
|
||||
else{
|
||||
$array_result[$i]['data'] = $data_init;
|
||||
$array_result[$i]['utimestamp'] = $acum;
|
||||
$array_result[$i]['real_data'] = $sum;
|
||||
$i++;
|
||||
$data_init = $value['data'];
|
||||
$acum = $value['utimestamp'];
|
||||
$sum = $value['real_data'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$array_result[$i]['data'] = $data_init;
|
||||
$array_result[$i]['utimestamp'] = $acum;
|
||||
$array_result[$i]['real_data'] = $sum;
|
||||
|
||||
$dataslice = array();
|
||||
$dataslice['agent'] = io_safe_output(modules_get_agentmodule_agent_alias ($sla['id_agent_module']));
|
||||
$dataslice['module'] = io_safe_output(modules_get_agentmodule_name ($sla['id_agent_module']));
|
||||
|
@ -948,13 +978,14 @@ function reporting_SLA($report, $content, $type = 'dinamic',
|
|||
$content,
|
||||
$content['time_from'],
|
||||
$content['time_to'],
|
||||
1920,
|
||||
50,
|
||||
100,
|
||||
70,
|
||||
$urlImage,
|
||||
$ttl,
|
||||
$raw_graph,
|
||||
false);
|
||||
|
||||
$array_result,
|
||||
false
|
||||
);
|
||||
|
||||
$return['charts'][] = $dataslice;
|
||||
}
|
||||
|
||||
|
@ -964,7 +995,7 @@ function reporting_SLA($report, $content, $type = 'dinamic',
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// SLA items sorted descending ()
|
||||
if ($content['top_n'] == 2) {
|
||||
arsort($return['data']['']);
|
||||
|
@ -5480,30 +5511,29 @@ function reporting_availability($report, $content, $date=false, $time=false) {
|
|||
*/
|
||||
function reporting_availability_graph($report, $content, $pdf=false) {
|
||||
global $config;
|
||||
$return = array();
|
||||
$return = array();
|
||||
$return['type'] = 'availability_graph';
|
||||
$ttl = 1;
|
||||
if ($pdf){
|
||||
$ttl = 2;
|
||||
}
|
||||
|
||||
|
||||
if (empty($content['name'])) {
|
||||
$content['name'] = __('Availability');
|
||||
}
|
||||
|
||||
|
||||
$return['title'] = $content['name'];
|
||||
$return["description"] = $content["description"];
|
||||
$return["date"] = reporting_get_date_text($report, $content);
|
||||
|
||||
|
||||
// Get chart
|
||||
reporting_set_conf_charts($width, $height, $only_image, $type,
|
||||
$content, $ttl);
|
||||
|
||||
|
||||
$return["id_rc"] = $content['id_rc'];
|
||||
|
||||
|
||||
$edge_interval = 10;
|
||||
|
||||
|
||||
if (empty($content['subitems'])) {
|
||||
$slas = db_get_all_rows_field_filter (
|
||||
'treport_content_sla_combined',
|
||||
|
@ -5512,7 +5542,7 @@ function reporting_availability_graph($report, $content, $pdf=false) {
|
|||
else {
|
||||
$slas = $content['subitems'];
|
||||
}
|
||||
|
||||
|
||||
if (empty($slas)) {
|
||||
$return['failed'] = __('There are no SLAs defined');
|
||||
}
|
||||
|
@ -5521,7 +5551,7 @@ function reporting_availability_graph($report, $content, $pdf=false) {
|
|||
$metaconsole_on = is_metaconsole();
|
||||
|
||||
$urlImage = ui_get_full_url(false, true, false, false);
|
||||
|
||||
|
||||
$sla_failed = false;
|
||||
$total_SLA = 0;
|
||||
$total_result_SLA = 'ok';
|
||||
|
@ -5529,7 +5559,7 @@ function reporting_availability_graph($report, $content, $pdf=false) {
|
|||
$sla_showed_values = array();
|
||||
|
||||
$priority_mode = $content['style']['priority_mode'];
|
||||
|
||||
|
||||
foreach ($slas as $sla) {
|
||||
$server_name = $sla ['server_name'];
|
||||
//Metaconsole connection
|
||||
|
@ -5540,18 +5570,17 @@ function reporting_availability_graph($report, $content, $pdf=false) {
|
|||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (modules_is_disable_agent($sla['id_agent_module'])
|
||||
|| modules_is_not_init($sla['id_agent_module'])) {
|
||||
if ($metaconsole_on) {
|
||||
//Restore db connection
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
//controller min and max == 0 then dinamic min and max critical
|
||||
|
||||
//controller min and max == 0 then dinamic min and max critical
|
||||
$dinamic_text = 0;
|
||||
if($sla['sla_min'] == 0 && $sla['sla_max'] == 0){
|
||||
$sla['sla_min'] = null;
|
||||
|
@ -5571,38 +5600,37 @@ function reporting_availability_graph($report, $content, $pdf=false) {
|
|||
}
|
||||
}
|
||||
|
||||
//for graph slice for module-interval, if not slice=0;
|
||||
//for graph slice for module-interval, if not slice=0;
|
||||
$module_interval = modules_get_interval ($sla['id_agent_module']);
|
||||
$slice = $content["period"] / $module_interval;
|
||||
|
||||
|
||||
//call functions sla
|
||||
$sla_array = array();
|
||||
$sla_array = reporting_advanced_sla(
|
||||
$sla['id_agent_module'],
|
||||
$report["datetime"] - $content['period'],
|
||||
$report["datetime"],
|
||||
$sla['sla_min'], // min_value -> dynamic
|
||||
$sla['sla_max'], // max_value -> dynamic
|
||||
$inverse_interval, // inverse_interval -> dynamic
|
||||
array ( "1" => $content["sunday"],
|
||||
"2" => $content["monday"],
|
||||
"3" => $content["tuesday"],
|
||||
"4" => $content["wednesday"],
|
||||
"5" => $content["thursday"],
|
||||
"6" => $content["friday"],
|
||||
"7" => $content["saturday"]
|
||||
),
|
||||
$content['time_from'],
|
||||
$content['time_to'],
|
||||
$slice
|
||||
);
|
||||
$sla['id_agent_module'],
|
||||
$report["datetime"] - $content['period'],
|
||||
$report["datetime"],
|
||||
$sla['sla_min'], // min_value -> dynamic
|
||||
$sla['sla_max'], // max_value -> dynamic
|
||||
$inverse_interval, // inverse_interval -> dynamic
|
||||
array ( "1" => $content["sunday"],
|
||||
"2" => $content["monday"],
|
||||
"3" => $content["tuesday"],
|
||||
"4" => $content["wednesday"],
|
||||
"5" => $content["thursday"],
|
||||
"6" => $content["friday"],
|
||||
"7" => $content["saturday"]
|
||||
),
|
||||
$content['time_from'],
|
||||
$content['time_to'],
|
||||
$slice
|
||||
);
|
||||
|
||||
|
||||
if ($metaconsole_on) {
|
||||
//Restore db connection
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
|
||||
$server_name = $sla ['server_name'];
|
||||
//Metaconsole connection
|
||||
if ($metaconsole_on && $server_name != '') {
|
||||
|
@ -5624,7 +5652,7 @@ function reporting_availability_graph($report, $content, $pdf=false) {
|
|||
}
|
||||
return ($a<$b)?-1:1;
|
||||
});
|
||||
|
||||
|
||||
// Compress (overlapped) planned downtimes
|
||||
$npd = count($planned_downtimes);
|
||||
for ($i=0; $i<$npd; $i++) {
|
||||
|
@ -5649,9 +5677,9 @@ function reporting_availability_graph($report, $content, $pdf=false) {
|
|||
$data['min'] = $sla['sla_min'];
|
||||
$data['sla_limit'] = $sla['sla_limit'];
|
||||
$data['dinamic_text'] = $dinamic_text;
|
||||
|
||||
|
||||
if(isset($sla_array[0])){
|
||||
$data['time_total'] = 0;
|
||||
$data['time_total'] = 0;
|
||||
$data['time_ok'] = 0;
|
||||
$data['time_error'] = 0;
|
||||
$data['time_unknown'] = 0;
|
||||
|
@ -5702,7 +5730,7 @@ function reporting_availability_graph($report, $content, $pdf=false) {
|
|||
$data['checks_not_init'] = $sla_array['checks_not_init'];
|
||||
$data['sla_value'] = $sla_array['SLA'];
|
||||
}
|
||||
|
||||
|
||||
//checks whether or not it meets the SLA
|
||||
if ($data['sla_value'] >= $sla['sla_limit']) {
|
||||
$data['sla_status'] = 1;
|
||||
|
@ -5721,7 +5749,39 @@ function reporting_availability_graph($report, $content, $pdf=false) {
|
|||
//find order
|
||||
$data['order'] = $data['sla_value'];
|
||||
$return['data'][] = $data;
|
||||
|
||||
|
||||
$data_init = -1;
|
||||
$acum = 0;
|
||||
$sum = 0;
|
||||
$array_result = array();
|
||||
$i=0;
|
||||
foreach ($raw_graph as $key => $value) {
|
||||
if($data_init == -1){
|
||||
$data_init = $value['data'];
|
||||
$acum = $value['utimestamp'];
|
||||
$sum = $value['data'];
|
||||
}
|
||||
else{
|
||||
if($data_init == $value['data']){
|
||||
$acum = $acum + $value['utimestamp'];
|
||||
$sum = $sum + $value['real_data'];
|
||||
}
|
||||
else{
|
||||
$array_result[$i]['data'] = $data_init;
|
||||
$array_result[$i]['utimestamp'] = $acum;
|
||||
$array_result[$i]['real_data'] = $sum;
|
||||
$i++;
|
||||
$data_init = $value['data'];
|
||||
$acum = $value['utimestamp'];
|
||||
$sum = $value['real_data'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$array_result[$i]['data'] = $data_init;
|
||||
$array_result[$i]['utimestamp'] = $acum;
|
||||
$array_result[$i]['real_data'] = $sum;
|
||||
|
||||
// Slice graphs calculation
|
||||
$dataslice = array();
|
||||
$dataslice['agent'] = modules_get_agentmodule_agent_alias ($sla['id_agent_module']);
|
||||
|
@ -5743,22 +5803,22 @@ function reporting_availability_graph($report, $content, $pdf=false) {
|
|||
$content,
|
||||
$content['time_from'],
|
||||
$content['time_to'],
|
||||
1920,
|
||||
50,
|
||||
100,
|
||||
70,
|
||||
$urlImage,
|
||||
$ttl,
|
||||
$raw_graph,
|
||||
false);
|
||||
|
||||
$array_result,
|
||||
false
|
||||
);
|
||||
|
||||
$return['charts'][] = $dataslice;
|
||||
|
||||
if ($metaconsole_on) {
|
||||
//Restore db connection
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// SLA items sorted descending ()
|
||||
if ($content['top_n'] == 2) {
|
||||
arsort($return['data']['']);
|
||||
|
@ -9743,331 +9803,6 @@ function reporting_get_agentmodule_sla_day ($id_agent_module, $period = 0, $min_
|
|||
return (float) (100 - ($bad_period / $period_reduced) * 100);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get several SLA data for an agentmodule within a period divided on subperiods
|
||||
*
|
||||
* @param int Agent module to calculate SLA
|
||||
* @param int Period to check the SLA compliance.
|
||||
* @param int Minimum data value the module in the right interval
|
||||
* @param int Maximum data value the module in the right interval. False will
|
||||
* ignore max value
|
||||
* @param array $days Array of days week to extract as array('monday' => false, 'tuesday' => true....), and by default is null.
|
||||
* @param string $timeFrom Time in the day to start to extract in mysql format, by default null.
|
||||
* @param string $timeTo Time in the day to end to extract in mysql format, by default null.
|
||||
*
|
||||
* @return Array with values either 1, 2, 3 or 4 depending if the SLA percentage for this subperiod
|
||||
* is within the sla limits, on the edge, outside or with an unknown value.
|
||||
*/
|
||||
function reporting_get_agentmodule_sla_array ($id_agent_module, $period = 0, $min_value = 1, $max_value = false, $date = 0, $daysWeek = null, $timeFrom = null, $timeTo = null) {
|
||||
global $config;
|
||||
|
||||
if (empty($id_agent_module))
|
||||
return false;
|
||||
|
||||
// Initialize variables
|
||||
if (empty ($date)) {
|
||||
$date = get_system_time ();
|
||||
}
|
||||
if ($daysWeek === null) {
|
||||
$daysWeek = array();
|
||||
}
|
||||
|
||||
// Hotfix: The edge values are confuse to the users
|
||||
$percent = 0;
|
||||
|
||||
// Limit date to start searching data
|
||||
$datelimit = $date - $period;
|
||||
|
||||
$search_in_history_db = db_search_in_history_db($datelimit);
|
||||
|
||||
// Get interval data
|
||||
$sql = sprintf ('SELECT * FROM tagente_datos
|
||||
WHERE id_agente_modulo = %d
|
||||
AND utimestamp > %d AND utimestamp <= %d',
|
||||
$id_agent_module, $datelimit, $date);
|
||||
|
||||
//Add the working times (mon - tue - wed ...) and from time to time
|
||||
$days = array();
|
||||
//Translate to mysql week days
|
||||
|
||||
if ($daysWeek) {
|
||||
foreach ($daysWeek as $key => $value) {
|
||||
if (!$value) {
|
||||
if ($key == 'monday') {
|
||||
$days[] = 2;
|
||||
}
|
||||
if ($key == 'tuesday') {
|
||||
$days[] = 3;
|
||||
}
|
||||
if ($key == 'wednesday') {
|
||||
$days[] = 4;
|
||||
}
|
||||
if ($key == 'thursday') {
|
||||
$days[] = 5;
|
||||
}
|
||||
if ($key == 'friday') {
|
||||
$days[] = 6;
|
||||
}
|
||||
if ($key == 'saturday') {
|
||||
$days[] = 7;
|
||||
}
|
||||
if ($key == 'sunday') {
|
||||
$days[] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count($days) > 0) {
|
||||
$sql .= ' AND DAYOFWEEK(FROM_UNIXTIME(utimestamp)) NOT IN (' . implode(',', $days) . ')';
|
||||
}
|
||||
|
||||
if ($timeFrom != $timeTo) {
|
||||
if ($timeFrom < $timeTo) {
|
||||
$sql .= ' AND (TIME(FROM_UNIXTIME(utimestamp)) >= \'' .
|
||||
$timeFrom . '\'
|
||||
AND TIME(FROM_UNIXTIME(utimestamp)) <= \'' .
|
||||
$timeTo . '\')';
|
||||
}
|
||||
elseif ($timeFrom > $timeTo) {
|
||||
$sql .= ' AND (TIME(FROM_UNIXTIME(utimestamp)) >= \'' .
|
||||
$timeFrom . '\'
|
||||
OR TIME(FROM_UNIXTIME(utimestamp)) <= \''.
|
||||
$timeTo . '\')';
|
||||
}
|
||||
}
|
||||
|
||||
$sql .= ' ORDER BY utimestamp ASC';
|
||||
$interval_data = db_get_all_rows_sql ($sql, $search_in_history_db);
|
||||
|
||||
if ($interval_data === false) {
|
||||
$interval_data = array ();
|
||||
}
|
||||
|
||||
|
||||
// Indexing data
|
||||
$interval_data_indexed = array();
|
||||
foreach($interval_data as $idata) {
|
||||
$interval_data_indexed[$idata['utimestamp']]['data'] = $idata['datos'];
|
||||
}
|
||||
|
||||
//-----------Calculate unknown status events------------------------
|
||||
$events_unknown = db_get_all_rows_filter ('tevento',
|
||||
array ('id_agentmodule' => $id_agent_module,
|
||||
"utimestamp > $datelimit",
|
||||
"utimestamp < $date",
|
||||
'order' => 'utimestamp ASC'),
|
||||
array ('id_evento', 'evento', 'timestamp', 'utimestamp', 'event_type'));
|
||||
|
||||
if ($events_unknown === false) {
|
||||
$events_unknown = array ();
|
||||
}
|
||||
|
||||
// Add unknown periods to data
|
||||
for ($i = 0; isset($events_unknown[$i]); $i++) {
|
||||
$eu = $events_unknown[$i];
|
||||
|
||||
if ($eu['event_type'] == 'going_unknown') {
|
||||
$interval_data_indexed[$eu['utimestamp']]['data'] = 0;
|
||||
$interval_data_indexed[$eu['utimestamp']]['status'] = 4;
|
||||
|
||||
// Search the corresponding recovery event.
|
||||
for ($j = $i+1; isset($events_unknown[$j]); $j++) {
|
||||
$eu = $events_unknown[$j];
|
||||
|
||||
if ($eu['event_type'] != 'going_unknown' && substr ($eu['event_type'], 0, 5) == 'going') {
|
||||
$interval_data_indexed[$eu['utimestamp']]['data'] = 0;
|
||||
$interval_data_indexed[$eu['utimestamp']]['status'] = 6;
|
||||
|
||||
// Do not process read events again.
|
||||
$i = $j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get the last event before inverval to know if graph start on unknown
|
||||
$prev_event = db_get_row_filter ('tevento',
|
||||
array ('id_agentmodule' => $id_agent_module,
|
||||
"utimestamp <= $datelimit",
|
||||
'order' => 'utimestamp DESC'));
|
||||
if (isset($prev_event['event_type']) && $prev_event['event_type'] == 'going_unknown') {
|
||||
$start_unknown = true;
|
||||
}
|
||||
else {
|
||||
$start_unknown = false;
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
|
||||
//-----------------Set limits of the interval-----------------------
|
||||
// Get previous data (This adds the first data if the begin of module data is after the begin time interval)
|
||||
$previous_data = modules_get_previous_data ($id_agent_module, $datelimit);
|
||||
if ($previous_data !== false ) {
|
||||
$previous_value = $previous_data['datos'];
|
||||
// if ((($previous_value > ($min_value - $percent)) && ($previous_value < ($min_value + $percent))) ||
|
||||
// (($previous_value > ($max_value - $percent)) && ($previous_value < ($max_value + $percent)))) {//2 when value is within the edges
|
||||
// $previous_known_status = 2;
|
||||
// }
|
||||
// else
|
||||
if (($previous_value >= ($min_value + $percent)) && ($previous_value <= ($max_value - $percent))) { //1 when value is OK
|
||||
$previous_known_status = 1;
|
||||
}
|
||||
elseif (($previous_value <= ($min_value - $percent)) || ($previous_value >= ($max_value + $percent))) { //3 when value is Wrong
|
||||
$previous_known_status = 3;
|
||||
}
|
||||
}
|
||||
|
||||
// If the starting of the graph is unknown we set it
|
||||
if ($start_unknown) {
|
||||
$interval_data_indexed[$datelimit]['data'] = 0;
|
||||
$interval_data_indexed[$datelimit]['status'] = 4;
|
||||
}
|
||||
else {
|
||||
if ($previous_data !== false ) {
|
||||
$interval_data_indexed[$datelimit]['data'] = $previous_data['datos'];
|
||||
}
|
||||
else { // If there are not data befor interval set unknown
|
||||
$interval_data_indexed[$datelimit]['data'] = 0;
|
||||
$interval_data_indexed[$datelimit]['status'] = 4;
|
||||
$previous_known_status = 1; // Assume the module was in normal status if there is no previous data.
|
||||
}
|
||||
}
|
||||
|
||||
// Get next data (This adds data before the interval of the report)
|
||||
$next_data = modules_get_next_data ($id_agent_module, $date);
|
||||
|
||||
if ($next_data !== false) {
|
||||
$interval_data_indexed[$date]['data'] = $previous_data['datos'];
|
||||
}
|
||||
else if (count ($interval_data_indexed) > 0) {
|
||||
// Propagate the last known data to the end of the interval (if there is no module data at the end point)
|
||||
ksort($interval_data_indexed);
|
||||
$last_data = end($interval_data_indexed);
|
||||
$interval_data_indexed[$date] = $last_data;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
|
||||
//--------Calculate planned downtime dates--------------------------
|
||||
$downtime_dates = reporting_get_planned_downtimes_intervals($id_agent_module, $datelimit, $date);
|
||||
|
||||
foreach ($downtime_dates as $downtime_date) {
|
||||
// Delete data of the planned downtime and put the last data on the upper limit
|
||||
$interval_data_indexed[$downtime_date['date_from']]['data'] = 0;
|
||||
$interval_data_indexed[$downtime_date['date_from']]['status'] = 5;
|
||||
$interval_data_indexed[$downtime_date['date_to']]['data'] = 0;
|
||||
$interval_data_indexed[$downtime_date['date_to']]['status'] = 4;
|
||||
|
||||
$last_downtime_data = false;
|
||||
foreach ($interval_data_indexed as $idi_timestamp => $idi) {
|
||||
if ($idi_timestamp != $downtime_date['date_from'] && $idi_timestamp != $downtime_date['date_to'] &&
|
||||
$idi_timestamp >= $downtime_date['date_from'] && $idi_timestamp <= $downtime_date['date_to']) {
|
||||
$last_downtime_data = $idi['data'];
|
||||
unset($interval_data_indexed[$idi_timestamp]);
|
||||
}
|
||||
}
|
||||
|
||||
// Set the last data of the interval as limit
|
||||
if ($last_downtime_data !== false) {
|
||||
$interval_data_indexed[$downtime_date['date_to']]['data'] = $last_downtime_data;
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
|
||||
// Sort the array
|
||||
ksort($interval_data_indexed);
|
||||
|
||||
// We need more or equal two points
|
||||
if (count ($interval_data_indexed) < 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//Get the percentage for the limits
|
||||
$diff = $max_value - $min_value;
|
||||
|
||||
// Get module type
|
||||
$id_module_type = db_get_value('id_tipo_modulo', 'tagente_modulo', 'id_agente_modulo', $id_agent_module);
|
||||
// If module is boolean don't create translation intervals (on the edge intervals)
|
||||
// if ($id_module_type == 2 or $id_module_type == 6 or $id_module_type == 9 or $id_module_type == 18) {
|
||||
// $percent = 0;
|
||||
// }
|
||||
// else {
|
||||
// // Getting 10% of $diff --> $percent = ($diff/100)*10, so...
|
||||
// $percent = $diff / 10;
|
||||
// }
|
||||
|
||||
//Set initial conditions
|
||||
$first_data = array_shift ($interval_data);
|
||||
$previous_utimestamp = $date - $period;
|
||||
|
||||
$previous_value = $first_data ['datos'];
|
||||
$previous_status = 0;
|
||||
|
||||
if (isset($first_data['status'])) {
|
||||
// 4 for the Unknown value and 5 for planned downtime
|
||||
$previous_status = $first_data['status'];
|
||||
}
|
||||
// elseif ((($previous_value > ($min_value - $percent)) && ($previous_value < ($min_value + $percent))) ||
|
||||
// (($previous_value > ($max_value - $percent)) && ($previous_value < ($max_value + $percent)))) {//2 when value is within the edges
|
||||
// $previous_status = 2;
|
||||
// }
|
||||
elseif (($previous_value >= ($min_value + $percent)) && ($previous_value <= ($max_value - $percent))) { //1 when value is OK
|
||||
$previous_status = 1;
|
||||
}
|
||||
elseif (($previous_value <= ($min_value - $percent)) || ($previous_value >= ($max_value + $percent))) { //3 when value is Wrong
|
||||
$previous_status = 3;
|
||||
}
|
||||
|
||||
$data_colors = array();
|
||||
$i = 0;
|
||||
|
||||
foreach ($interval_data_indexed as $utimestamp => $data) {
|
||||
$change = false;
|
||||
$value = $data['data'];
|
||||
if (isset($data['status'])) {
|
||||
// Leaving unkown status.
|
||||
if ($data['status'] == 6) {
|
||||
$status = $previous_known_status;
|
||||
}
|
||||
// 4 unknown, 5 planned downtime.
|
||||
else {
|
||||
$status = $data['status'];
|
||||
}
|
||||
}
|
||||
// elseif ((($value > ($min_value - $percent)) && ($value < ($min_value + $percent))) ||
|
||||
// (($value > ($max_value - $percent)) && ($value < ($max_value + $percent)))) { //2 when value is within the edges
|
||||
// $status = 2;
|
||||
// }
|
||||
elseif (($value >= ($min_value + $percent)) && ($value <= ($max_value - $percent))) { //1 when value is OK
|
||||
$status = 1;
|
||||
}
|
||||
elseif (($value <= ($min_value - $percent)) || ($value >= ($max_value + $percent))) { //3 when value is Wrong
|
||||
$status = 3;
|
||||
}
|
||||
|
||||
if ($status != $previous_status) {
|
||||
$change = true;
|
||||
$data_colors[$i]['data'] = $previous_status;
|
||||
$data_colors[$i]['utimestamp'] = $utimestamp - $previous_utimestamp;
|
||||
$i++;
|
||||
$previous_status = $status;
|
||||
$previous_utimestamp = $utimestamp;
|
||||
}
|
||||
|
||||
// Save the last known status.
|
||||
if ($status <= 3) {
|
||||
$previous_known_status = $status;
|
||||
}
|
||||
}
|
||||
if ($change == false) {
|
||||
$data_colors[$i]['data'] = $previous_status;
|
||||
$data_colors[$i]['utimestamp'] = $date - $previous_utimestamp;
|
||||
}
|
||||
|
||||
return $data_colors;
|
||||
}
|
||||
|
||||
function reporting_get_stats_servers($tiny = true) {
|
||||
global $config;
|
||||
|
||||
|
|
|
@ -351,16 +351,16 @@ function reporting_html_SLA($table, $item, $mini) {
|
|||
$style = json_decode(io_safe_output($style), true);
|
||||
$hide_notinit_agent = $style['hide_notinit_agents'];
|
||||
$same_agent_in_resume = "";
|
||||
|
||||
|
||||
global $config;
|
||||
|
||||
|
||||
if ($mini) {
|
||||
$font_size = '1.5';
|
||||
}
|
||||
else {
|
||||
$font_size = '3';
|
||||
}
|
||||
|
||||
|
||||
$metaconsole_on = is_metaconsole();
|
||||
if($metaconsole_on){
|
||||
$src= '../../';
|
||||
|
@ -374,10 +374,9 @@ function reporting_html_SLA($table, $item, $mini) {
|
|||
$table->data['sla']['cell'] = $item['failed'];
|
||||
}
|
||||
else {
|
||||
|
||||
if (!empty($item['planned_downtimes'])) {
|
||||
$downtimes_table = reporting_html_planned_downtimes_table($item['planned_downtimes']);
|
||||
|
||||
|
||||
if (!empty($downtimes_table)) {
|
||||
$table->colspan['planned_downtime']['cell'] = 3;
|
||||
$table->data['planned_downtime']['cell'] = $downtimes_table;
|
||||
|
@ -387,7 +386,7 @@ function reporting_html_SLA($table, $item, $mini) {
|
|||
if(isset($item['data'])){
|
||||
$table1 = new stdClass();
|
||||
$table1->width = '99%';
|
||||
|
||||
|
||||
$table1->align = array();
|
||||
$table1->align[0] = 'left';
|
||||
$table1->align[1] = 'left';
|
||||
|
@ -395,9 +394,9 @@ function reporting_html_SLA($table, $item, $mini) {
|
|||
$table1->align[3] = 'right';
|
||||
$table1->align[4] = 'right';
|
||||
$table1->align[5] = 'right';
|
||||
|
||||
|
||||
$table1->data = array ();
|
||||
|
||||
|
||||
$table1->head = array ();
|
||||
$table1->head[0] = __('Agent');
|
||||
$table1->head[1] = __('Module');
|
||||
|
@ -405,7 +404,7 @@ function reporting_html_SLA($table, $item, $mini) {
|
|||
$table1->head[3] = __('SLA Limit');
|
||||
$table1->head[4] = __('SLA Compliance');
|
||||
$table1->head[5] = __('Status');
|
||||
|
||||
|
||||
$table1->headstyle = array();
|
||||
$table1->headstyle[2] = 'text-align: right';
|
||||
$table1->headstyle[3] = 'text-align: right';
|
||||
|
@ -415,7 +414,7 @@ function reporting_html_SLA($table, $item, $mini) {
|
|||
//second_table for time globals
|
||||
$table2 = new stdClass();
|
||||
$table2->width = '99%';
|
||||
|
||||
|
||||
$table2->align = array();
|
||||
$table2->align[0] = 'left';
|
||||
$table2->align[1] = 'left';
|
||||
|
@ -424,9 +423,9 @@ function reporting_html_SLA($table, $item, $mini) {
|
|||
$table2->align[4] = 'right';
|
||||
$table2->align[5] = 'right';
|
||||
$table2->align[6] = 'right';
|
||||
|
||||
|
||||
$table2->data = array ();
|
||||
|
||||
|
||||
$table2->head = array ();
|
||||
$table2->head[0] = __('Global Time');
|
||||
$table2->head[1] = __('Time Total');
|
||||
|
@ -435,7 +434,7 @@ function reporting_html_SLA($table, $item, $mini) {
|
|||
$table2->head[4] = __('Time Unknown');
|
||||
$table2->head[5] = __('Time Not Init');
|
||||
$table2->head[6] = __('Downtime');
|
||||
|
||||
|
||||
$table2->headstyle = array();
|
||||
$table2->headstyle[2] = 'text-align: right';
|
||||
$table2->headstyle[3] = 'text-align: right';
|
||||
|
@ -446,7 +445,7 @@ function reporting_html_SLA($table, $item, $mini) {
|
|||
//third_table for time globals
|
||||
$table3 = new stdClass();
|
||||
$table3->width = '99%';
|
||||
|
||||
|
||||
$table3->align = array();
|
||||
$table3->align[0] = 'left';
|
||||
$table3->align[1] = 'left';
|
||||
|
@ -455,16 +454,16 @@ function reporting_html_SLA($table, $item, $mini) {
|
|||
$table3->align[4] = 'right';
|
||||
$table3->align[5] = 'right';
|
||||
$table3->align[6] = 'right';
|
||||
|
||||
|
||||
$table3->data = array ();
|
||||
|
||||
|
||||
$table3->head = array ();
|
||||
$table3->head[0] = __('Checks Time');
|
||||
$table3->head[1] = __('Checks Total');
|
||||
$table3->head[2] = __('Checks Failed');
|
||||
$table3->head[3] = __('Checks OK');
|
||||
$table3->head[4] = __('Checks Unknown');
|
||||
|
||||
|
||||
$table3->headstyle = array();
|
||||
$table3->headstyle[2] = 'text-align: right';
|
||||
$table3->headstyle[3] = 'text-align: right';
|
||||
|
@ -481,8 +480,8 @@ function reporting_html_SLA($table, $item, $mini) {
|
|||
$row[] = $sla['module'];
|
||||
|
||||
if(is_numeric($sla['dinamic_text'])){
|
||||
$row[] = sla_truncate($sla['max'], $config['graph_precision']) . " / " .
|
||||
sla_truncate($sla['min'], $config['graph_precision']);
|
||||
$row[] = sla_truncate($sla['max'], $config['graph_precision']) . " / " .
|
||||
sla_truncate($sla['min'], $config['graph_precision']);
|
||||
}
|
||||
else{
|
||||
$row[] = $sla['dinamic_text'];
|
||||
|
@ -526,7 +525,7 @@ function reporting_html_SLA($table, $item, $mini) {
|
|||
$row2[] = '<span style="color: '.COL_CRITICAL.';">' . human_time_description_raw($sla['time_error'], true) . '</span>';
|
||||
else
|
||||
$row2[] = '--';
|
||||
|
||||
|
||||
if($sla['time_ok'] != 0)
|
||||
$row2[] = '<span style="color: '.COL_NORMAL.';">' . human_time_description_raw($sla['time_ok'], true) . '</span>';
|
||||
else
|
||||
|
@ -564,15 +563,15 @@ function reporting_html_SLA($table, $item, $mini) {
|
|||
$row[] = $sla['module'];
|
||||
|
||||
if(is_numeric($sla['dinamic_text'])){
|
||||
$row[] = sla_truncate($sla['max'], $config['graph_precision']) . " / " .
|
||||
sla_truncate($sla['min'], $config['graph_precision']);
|
||||
$row[] = sla_truncate($sla['max'], $config['graph_precision']) . " / " .
|
||||
sla_truncate($sla['min'], $config['graph_precision']);
|
||||
}
|
||||
else{
|
||||
$row[] = $sla['dinamic_text'];
|
||||
}
|
||||
|
||||
|
||||
$row[] = round($sla['sla_limit'], 2) . "%";
|
||||
|
||||
|
||||
if ($sla['sla_value_unknown']) {
|
||||
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_UNKNOWN.';">' .
|
||||
__('N/A') . '</span>';
|
||||
|
@ -605,7 +604,7 @@ function reporting_html_SLA($table, $item, $mini) {
|
|||
$row2[] = '<span style="color: '.COL_CRITICAL.';">' . human_time_description_raw($sla['time_error'], true) . '</span>';
|
||||
else
|
||||
$row2[] = '--';
|
||||
|
||||
|
||||
if($sla['time_ok'] != 0)
|
||||
$row2[] = '<span style="color: '.COL_NORMAL.';">' . human_time_description_raw($sla['time_ok'], true) . '</span>';
|
||||
else
|
||||
|
@ -641,7 +640,6 @@ function reporting_html_SLA($table, $item, $mini) {
|
|||
$table3->data[] = $row3;
|
||||
}
|
||||
}
|
||||
|
||||
$table->colspan['sla']['cell'] = 2;
|
||||
$table->data['sla']['cell'] = html_print_table($table1, true);
|
||||
$table->colspan['time_global']['cell'] = 2;
|
||||
|
@ -649,11 +647,12 @@ function reporting_html_SLA($table, $item, $mini) {
|
|||
$table->colspan['checks_global']['cell'] = 2;
|
||||
$table->data['checks_global']['cell'] = html_print_table($table3, true);
|
||||
}
|
||||
|
||||
if (!empty($item['charts'])) {
|
||||
$table1 = new stdClass();
|
||||
$table1->width = '99%';
|
||||
|
||||
$table1->size = array ();
|
||||
$table1->size[0] = '10%';
|
||||
|
||||
$table1->data = array ();
|
||||
if (!$hide_notinit_agent) {
|
||||
foreach ($item['charts'] as $chart) {
|
||||
|
@ -684,32 +683,32 @@ function reporting_html_SLA($table, $item, $mini) {
|
|||
$table1->data[0][0] = '<img src ="'. $src .'images/square_green.png">';
|
||||
$table1->size[1] = '14%';
|
||||
$table1->data[0][1] = '<span>'.__('OK') . '</span>';
|
||||
|
||||
|
||||
$table1->size[2] = '2%';
|
||||
$table1->data[0][2] = '<img src ="'. $src .'images/square_red.png">';
|
||||
$table1->size[3] = '14%';
|
||||
$table1->data[0][3] = '<span>'.__('Critical'). '</span>';
|
||||
|
||||
|
||||
$table1->size[4] = '2%';
|
||||
$table1->data[0][4] = '<img src ="'. $src .'images/square_gray.png">';
|
||||
$table1->size[5] = '14%';
|
||||
$table1->data[0][5] = '<span>'.__('Unknow'). '</span>';
|
||||
|
||||
|
||||
$table1->size[6] = '2%';
|
||||
$table1->data[0][6] = '<img src ="'. $src .'images/square_blue.png">';
|
||||
$table1->size[7] = '14%';
|
||||
$table1->data[0][7] = '<span>'.__('Not Init'). '</span>';
|
||||
|
||||
|
||||
$table1->size[8] = '2%';
|
||||
$table1->data[0][8] = '<img src ="'. $src .'images/square_violet.png">';
|
||||
$table1->size[9] = '14%';
|
||||
$table1->data[0][9] = '<span>'.__('Downtimes'). '</span>';
|
||||
|
||||
|
||||
$table1->size[10] = '2%';
|
||||
$table1->data[0][10] = '<img src ="'. $src .'images/square_light_gray.png">';
|
||||
$table1->size[11] = '15%';
|
||||
$table1->data[0][11] = '<span>'.__('Ignore time'). '</span>';
|
||||
|
||||
|
||||
$table->colspan['legend']['cell'] = 2;
|
||||
$table->data['legend']['cell'] = html_print_table($table1, true);
|
||||
}
|
||||
|
@ -2319,14 +2318,14 @@ function reporting_html_availability(&$table, $item) {
|
|||
$style = json_decode(io_safe_output($style), true);
|
||||
$hide_notinit_agent = $style['hide_notinit_agents'];
|
||||
$same_agent_in_resume = "";
|
||||
|
||||
|
||||
global $config;
|
||||
|
||||
|
||||
if (!empty($item["data"])) {
|
||||
$table1 = new stdClass();
|
||||
$table1->width = '99%';
|
||||
$table1->data = array ();
|
||||
|
||||
|
||||
$table1->head = array ();
|
||||
$table1->head[0] = __('Agent');
|
||||
// HACK it is saved in show_graph field.
|
||||
|
@ -2344,7 +2343,7 @@ function reporting_html_availability(&$table, $item) {
|
|||
$table1->head[6] = __('Time Not Init Module');
|
||||
$table1->head[7] = __('Time Downtime');
|
||||
$table1->head[8] = __('% Ok');
|
||||
|
||||
|
||||
$table1->headstyle = array();
|
||||
$table1->headstyle[0] = 'text-align: left';
|
||||
$table1->headstyle[1] = 'text-align: left';
|
||||
|
@ -2355,7 +2354,7 @@ function reporting_html_availability(&$table, $item) {
|
|||
$table1->headstyle[6] = 'text-align: right';
|
||||
$table1->headstyle[7] = 'text-align: right';
|
||||
$table1->headstyle[8] = 'text-align: right';
|
||||
|
||||
|
||||
$table1->style[0] = 'text-align: left';
|
||||
$table1->style[1] = 'text-align: left';
|
||||
$table1->style[2] = 'text-align: right';
|
||||
|
@ -2394,7 +2393,7 @@ function reporting_html_availability(&$table, $item) {
|
|||
$table2->headstyle[4] = 'text-align: right';
|
||||
$table2->headstyle[5] = 'text-align: right';
|
||||
//$table2->headstyle[6] = 'text-align: right';
|
||||
|
||||
|
||||
$table2->style[0] = 'text-align: left';
|
||||
$table2->style[1] = 'text-align: left';
|
||||
$table2->style[2] = 'text-align: right';
|
||||
|
@ -2405,22 +2404,22 @@ function reporting_html_availability(&$table, $item) {
|
|||
|
||||
foreach ($item['data'] as $row) {
|
||||
$the_first_men_time = get_agent_first_time(io_safe_output($row['agent']));
|
||||
|
||||
|
||||
if (!$hide_notinit_agent) {
|
||||
$table_row = array();
|
||||
$table_row[] = $row['agent'];
|
||||
$table_row[] = $row['availability_item'];
|
||||
|
||||
|
||||
if($row['time_total'] != 0)
|
||||
$table_row[] = human_time_description_raw($row['time_total'], true);
|
||||
else
|
||||
$table_row[] = '--';
|
||||
|
||||
|
||||
if($row['time_error'] != 0)
|
||||
$table_row[] = human_time_description_raw($row['time_error'], true);
|
||||
else
|
||||
$table_row[] = '--';
|
||||
|
||||
|
||||
if($row['time_ok'] != 0)
|
||||
$table_row[] = human_time_description_raw($row['time_ok'], true);
|
||||
else
|
||||
|
@ -2430,7 +2429,7 @@ function reporting_html_availability(&$table, $item) {
|
|||
$table_row[] = human_time_description_raw($row['time_unknown'], true);
|
||||
else
|
||||
$table_row[] = '--';
|
||||
|
||||
|
||||
if($row['time_not_init'] != 0)
|
||||
$table_row[] = human_time_description_raw($row['time_not_init'], true);
|
||||
else
|
||||
|
@ -2440,8 +2439,8 @@ function reporting_html_availability(&$table, $item) {
|
|||
$table_row[] = human_time_description_raw($row['time_downtime'], true);
|
||||
else
|
||||
$table_row[] = '--';
|
||||
|
||||
$table_row[] = '<span style="font-size: 1.2em; font-weight:bold;">' . sla_truncate($row['SLA'], $config['graph_precision']). '%</span>';
|
||||
|
||||
$table_row[] = '<span style="font-size: 1.2em; font-weight:bold;">' . sla_truncate($row['SLA'], $config['graph_precision']). '%</span>';
|
||||
|
||||
$table_row2 = array();
|
||||
$table_row2[] = $row['agent'];
|
||||
|
@ -2449,24 +2448,24 @@ function reporting_html_availability(&$table, $item) {
|
|||
$table_row2[] = $row['checks_total'];
|
||||
$table_row2[] = $row['checks_error'];
|
||||
$table_row2[] = $row['checks_ok'];
|
||||
$table_row2[] = $row['checks_unknown'];
|
||||
$table_row2[] = $row['checks_unknown'];
|
||||
}
|
||||
else {
|
||||
if ($item['date']['to'] > $the_first_men_time) {
|
||||
$table_row = array();
|
||||
$table_row[] = $row['agent'];
|
||||
$table_row[] = $row['availability_item'];
|
||||
|
||||
|
||||
if($row['time_total'] != 0)
|
||||
$table_row[] = human_time_description_raw($row['time_total'], true);
|
||||
else
|
||||
$table_row[] = '--';
|
||||
|
||||
|
||||
if($row['time_error'] != 0)
|
||||
$table_row[] = human_time_description_raw($row['time_error'], true);
|
||||
else
|
||||
$table_row[] = '--';
|
||||
|
||||
|
||||
if($row['time_ok'] != 0)
|
||||
$table_row[] = human_time_description_raw($row['time_ok'], true);
|
||||
else
|
||||
|
@ -2476,7 +2475,7 @@ function reporting_html_availability(&$table, $item) {
|
|||
$table_row[] = human_time_description_raw($row['time_unknown'], true);
|
||||
else
|
||||
$table_row[] = '--';
|
||||
|
||||
|
||||
if($row['time_not_init'] != 0)
|
||||
$table_row[] = human_time_description_raw($row['time_not_init'], true);
|
||||
else
|
||||
|
@ -2486,8 +2485,8 @@ function reporting_html_availability(&$table, $item) {
|
|||
$table_row[] = human_time_description_raw($row['time_downtime'], true);
|
||||
else
|
||||
$table_row[] = '--';
|
||||
|
||||
$table_row[] = '<span style="font-size: 1.2em; font-weight:bold;">' . sla_truncate($row['SLA'], $config['graph_precision']). '%</span>';
|
||||
|
||||
$table_row[] = '<span style="font-size: 1.2em; font-weight:bold;">' . sla_truncate($row['SLA'], $config['graph_precision']). '%</span>';
|
||||
|
||||
$table_row2 = array();
|
||||
$table_row2[] = $row['agent'];
|
||||
|
@ -2501,7 +2500,6 @@ function reporting_html_availability(&$table, $item) {
|
|||
$same_agent_in_resume = $item['data']['agent'];
|
||||
}
|
||||
}
|
||||
|
||||
$table1->data[] = $table_row;
|
||||
$table2->data[] = $table_row2;
|
||||
}
|
||||
|
@ -2511,19 +2509,19 @@ function reporting_html_availability(&$table, $item) {
|
|||
$table->data['error']['cell'] =
|
||||
__('There are no Agent/Modules defined');
|
||||
}
|
||||
|
||||
|
||||
$table->colspan[1][0] = 2;
|
||||
$table->colspan[2][0] = 2;
|
||||
$data = array();
|
||||
$data[0] = html_print_table($table1, true);
|
||||
array_push ($table->data, $data);
|
||||
|
||||
|
||||
if ($item['resume']['resume']){
|
||||
$data2 = array();
|
||||
$data2[0] = html_print_table($table2, true);
|
||||
array_push ($table->data, $data2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($item['resume']['resume'] && !empty($item["data"])) {
|
||||
$table1->width = '99%';
|
||||
$table1->data = array ();
|
||||
|
@ -2534,29 +2532,29 @@ function reporting_html_availability(&$table, $item) {
|
|||
$table1->head['min_text'] = __('Agent min value');
|
||||
$table1->head['min'] = __('Min Value');
|
||||
$table1->head['avg'] = __('Average Value');
|
||||
|
||||
|
||||
$table1->headstyle = array();
|
||||
$table1->headstyle['min_text'] = 'text-align: left';
|
||||
$table1->headstyle['min'] = 'text-align: right';
|
||||
$table1->headstyle['max_text'] = 'text-align: left';
|
||||
$table1->headstyle['max'] = 'text-align: right';
|
||||
$table1->headstyle['avg'] = 'text-align: right';
|
||||
|
||||
|
||||
$table1->style = array();
|
||||
$table1->style['min_text'] = 'text-align: left';
|
||||
$table1->style['min'] = 'text-align: right';
|
||||
$table1->style['max_text'] = 'text-align: left';
|
||||
$table1->style['max'] = 'text-align: right';
|
||||
$table1->style['avg'] = 'text-align: right';
|
||||
|
||||
|
||||
$table1->data[] = array(
|
||||
'max_text' => $item['resume']['max_text'],
|
||||
'max' => sla_truncate($item['resume']['max'], $config['graph_precision']) . "%",
|
||||
'min_text' => $item['resume']['min_text'],
|
||||
'min' => sla_truncate($item['resume']['min'], $config['graph_precision']) . "%",
|
||||
'avg' => '<span style="font-size: 1.2em; font-weight:bold;">' . sla_truncate($item['resume']['avg'], $config['graph_precision']) . "%</span>"
|
||||
);
|
||||
|
||||
);
|
||||
|
||||
$table->colspan[3][0] = 3;
|
||||
$data = array();
|
||||
$data[0] = html_print_table($table1, true);
|
||||
|
@ -2577,6 +2575,11 @@ function reporting_html_availability_graph(&$table, $item, $pdf=0) {
|
|||
$table1 = new stdClass();
|
||||
$table1->width = '99%';
|
||||
$table1->data = array ();
|
||||
$table1->size = array();
|
||||
$table1->size[0] = '10%';
|
||||
$table1->size[1] = '80%';
|
||||
$table1->size[2] = '5%';
|
||||
$table1->size[3] = '5%';
|
||||
foreach ($item['charts'] as $chart) {
|
||||
$checks_resume = '';
|
||||
$sla_value = '';
|
||||
|
@ -2607,7 +2610,7 @@ function reporting_html_availability_graph(&$table, $item, $pdf=0) {
|
|||
"<span style = 'font: bold 2em Arial, Sans-serif; color: ".$color."'>" .
|
||||
$sla_value .
|
||||
'</span>',
|
||||
$checks_resume
|
||||
$checks_resume
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -2622,12 +2625,12 @@ function reporting_html_availability_graph(&$table, $item, $pdf=0) {
|
|||
$table2->data[0][0] = '<img src ="'. $src .'images/square_green.png">';
|
||||
$table2->size[1] = '14%';
|
||||
$table2->data[0][1] = '<span>'.__('OK') . '</span>';
|
||||
|
||||
|
||||
$table2->size[2] = '2%';
|
||||
$table2->data[0][2] = '<img src ="'. $src .'images/square_red.png">';
|
||||
$table2->size[3] = '14%';
|
||||
$table2->data[0][3] = '<span>'.__('Critical'). '</span>';
|
||||
|
||||
|
||||
$table2->size[4] = '2%';
|
||||
$table2->data[0][4] = '<img src ="'. $src .'images/square_gray.png">';
|
||||
$table2->size[5] = '14%';
|
||||
|
@ -2637,7 +2640,7 @@ function reporting_html_availability_graph(&$table, $item, $pdf=0) {
|
|||
$table2->data[0][6] = '<img src ="'. $src .'images/square_blue.png">';
|
||||
$table2->size[7] = '14%';
|
||||
$table2->data[0][7] = '<span>'.__('Not Init'). '</span>';
|
||||
|
||||
|
||||
$table2->size[8] = '2%';
|
||||
$table2->data[0][8] = '<img src ="'. $src .'images/square_violet.png">';
|
||||
$table2->size[9] = '14%';
|
||||
|
@ -2647,9 +2650,9 @@ function reporting_html_availability_graph(&$table, $item, $pdf=0) {
|
|||
$table2->data[0][10] = '<img src ="'. $src .'images/square_light_gray.png">';
|
||||
$table2->size[11] = '15%';
|
||||
$table2->data[0][11] = '<span>'.__('Ignore time'). '</span>';
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
$table->colspan['charts']['cell'] = 2;
|
||||
$table->data['charts']['cell'] = html_print_table($table1, true);
|
||||
$table->colspan['legend']['cell'] = 2;
|
||||
|
@ -3745,37 +3748,38 @@ function reporting_get_event_histogram ($events, $text_header_event = false) {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$table = new stdClass();
|
||||
if (!$text_header_event) {
|
||||
$table->width = '100%';
|
||||
}
|
||||
else {
|
||||
if (defined("METACONSOLE")) {
|
||||
$table->width = '100%';
|
||||
}
|
||||
else {
|
||||
$table->width = '70%';
|
||||
}
|
||||
}
|
||||
$table->width = '100%';
|
||||
$table->data = array ();
|
||||
$table->size = array ();
|
||||
$table->head = array ();
|
||||
$table->title = '<span>' . $text_header_event . '</span>';
|
||||
$table->data[0][0] = "" ;
|
||||
|
||||
if (!empty($graph_data)) {
|
||||
if (defined("METACONSOLE"))
|
||||
$slicebar = flot_slicesbar_graph($graph_data, $max_value, "100%", 35, $full_legend, $colors, $config['fontpath'], $config['round_corner'], $url);
|
||||
else {
|
||||
if (!$text_header_event) {
|
||||
$slicebar = slicesbar_graph($graph_data, $max_value, 700, 25, $colors, $config['fontpath'], $config['round_corner'], $urlImage, $ttl);
|
||||
}
|
||||
else {
|
||||
$slicebar = slicesbar_graph($graph_data, $max_value, 350, 18, $colors, $config['fontpath'], $config['round_corner'], $urlImage, $ttl);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($graph_data)) {
|
||||
$url_slice = defined("METACONSOLE")
|
||||
? $url
|
||||
: $urlImage;
|
||||
|
||||
$slicebar = flot_slicesbar_graph (
|
||||
$graph_data,
|
||||
$max_value,
|
||||
100,
|
||||
35,
|
||||
$full_legend,
|
||||
$colors,
|
||||
$config['fontpath'],
|
||||
$config['round_corner'],
|
||||
$url,
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
0,
|
||||
array(),
|
||||
true,
|
||||
$ttl
|
||||
);
|
||||
|
||||
$table->data[0][0] = $slicebar;
|
||||
}
|
||||
|
@ -3941,7 +3945,25 @@ function reporting_get_event_histogram_meta ($width) {
|
|||
$table->data[0][0] = "" ;
|
||||
|
||||
if (!empty($data)) {
|
||||
$slicebar = flot_slicesbar_graph($data, $period, "100%", 30, $full_legend, $colors, $config['fontpath'], $config['round_corner'], $url, '', '', false, 0, $full_legend_date);
|
||||
$slicebar = flot_slicesbar_graph(
|
||||
$data,
|
||||
$period,
|
||||
100,
|
||||
30,
|
||||
$full_legend,
|
||||
$colors,
|
||||
$config['fontpath'],
|
||||
$config['round_corner'],
|
||||
$url,
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
0,
|
||||
$full_legend_date,
|
||||
true,
|
||||
1
|
||||
);
|
||||
|
||||
$table->data[0][0] = $slicebar;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -1479,7 +1479,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
$img = '<img src="../../images/console/signes/module-events.png">';
|
||||
}
|
||||
else{
|
||||
$img = '<img src="images/console/signes/module-events.png">';
|
||||
$img = '<img src="images/console/signes/module-events.png">';
|
||||
}
|
||||
}
|
||||
else{
|
||||
|
@ -1494,28 +1494,28 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
else {
|
||||
if ($width == 0 || $height == 0) {
|
||||
if ($layoutData['label_position']=='left') {
|
||||
$img = '<div style="z-index:'.$show_on_top_index.';float:left;height:'.$himg.'px;">' .graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], 500, 50, $layoutData['period'], '', true).'</div>';
|
||||
$img = '<div style="z-index:'.$show_on_top_index.';float:left;height:'.$himg.'px;width:500px;">' .graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], 500, 50, $layoutData['period'], '', true).'</div>';
|
||||
}
|
||||
elseif ($layoutData['label_position']=='right') {
|
||||
$img = '<div style="z-index:'.$show_on_top_index.';float:right;height:'.$himg.'px;">' . graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], 500, 50, $layoutData['period'], '', true).'</div>';
|
||||
$img = '<div style="z-index:'.$show_on_top_index.';float:right;height:'.$himg.'px;width:500px;">' . graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], 500, 50, $layoutData['period'], '', true).'</div>';
|
||||
}
|
||||
else {
|
||||
$img = graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], 500, 50, $layoutData['period'], '', true);
|
||||
$img = '<div style="width:500px;">' . graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], 500, 50, $layoutData['period'], '', true).'</div>';
|
||||
}
|
||||
}
|
||||
else{
|
||||
if ($layoutData['label_position']=='left') {
|
||||
$img = '<div style="z-index:'.$show_on_top_index.';float:left;height:'.$himg.'px;">' . graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], $width, $height, $layoutData['period'], '', true).'</div>';
|
||||
$img = '<div style="z-index:'.$show_on_top_index.';float:left;height:'.$himg.'px;width:500px;">' . graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], $width, $height, $layoutData['period'], '', true).'</div>';
|
||||
}
|
||||
elseif ($layoutData['label_position']=='right') {
|
||||
$img = '<div style="z-index:'.$show_on_top_index.';float:right;height:'.$himg.'px;">' .graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], $width, $height, $layoutData['period'], '', true).'</div>';
|
||||
$img = '<div style="z-index:'.$show_on_top_index.';float:right;height:'.$himg.'px;width:500px;">' .graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], $width, $height, $layoutData['period'], '', true).'</div>';
|
||||
}
|
||||
else {
|
||||
$img = graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], $width, $height, $layoutData['period'], '', true);
|
||||
$img = '<div style="width:500px;">' . graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], $width, $height, $layoutData['period'], '', true).'</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Restore db connection
|
||||
if ($layoutData['id_metaconsole'] != 0) {
|
||||
metaconsole_restore_db();
|
||||
|
@ -1524,7 +1524,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
$z_index = 2 + 1;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
$class = "item ";
|
||||
switch ($type) {
|
||||
case STATIC_GRAPH:
|
||||
|
|
|
@ -33,23 +33,6 @@ function progressbar($progress, $width, $height, $title, $font,
|
|||
}
|
||||
}
|
||||
|
||||
function slicesbar_graph($chart_data, $period, $width, $height, $colors,
|
||||
$font, $round_corner, $home_url = '', $ttl = 1) {
|
||||
|
||||
$graph = array();
|
||||
$graph['data'] = $chart_data;
|
||||
$graph['period'] = $period;
|
||||
$graph['width'] = $width;
|
||||
$graph['height'] = $height;
|
||||
$graph['font'] = $font;
|
||||
$graph['round_corner'] = $round_corner;
|
||||
$graph['color'] = $colors;
|
||||
|
||||
$id_graph = serialize_in_temp($graph, null, $ttl);
|
||||
|
||||
return "<img src='".$home_url."include/graphs/functions_pchart.php?static_graph=1&graph_type=slicebar&ttl=".$ttl."&id_graph=".$id_graph."' style='width:100%;'>";
|
||||
}
|
||||
|
||||
function vbar_graph(
|
||||
$chart_data,
|
||||
$width,
|
||||
|
|
|
@ -684,7 +684,14 @@ function flot_vcolumn_chart ($graph_data, $width, $height, $color, $legend, $lon
|
|||
return $return;
|
||||
}
|
||||
|
||||
function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $colors, $fontpath, $round_corner, $homeurl, $watermark = '', $adapt_key = '', $stat_win = false, $id_agent = 0, $full_legend_date = array(), $not_interactive = 0) {
|
||||
function flot_slicesbar_graph (
|
||||
$graph_data, $period, $width,
|
||||
$height, $legend, $colors, $fontpath,
|
||||
$round_corner, $homeurl, $watermark = '',
|
||||
$adapt_key = '', $stat_win = false,
|
||||
$id_agent = 0, $full_legend_date = array(),
|
||||
$not_interactive = 0, $ttl = 1) {
|
||||
|
||||
global $config;
|
||||
|
||||
// Get a unique identifier to graph
|
||||
|
@ -748,7 +755,7 @@ function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $
|
|||
foreach ($graph_data as $label => $values) {
|
||||
$labels[] = $label;
|
||||
$i--;
|
||||
|
||||
|
||||
foreach ($values as $key => $value) {
|
||||
$jsvar = "d_".$graph_id."_".$i;
|
||||
if ($key == 'data') {
|
||||
|
@ -756,11 +763,11 @@ function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $
|
|||
continue;
|
||||
}
|
||||
$data[$jsvar][] = $value;
|
||||
|
||||
|
||||
$acumulate_data[$c] = $acumulate;
|
||||
$acumulate += $value;
|
||||
$c++;
|
||||
|
||||
|
||||
if ($value > $max) {
|
||||
$max = $value;
|
||||
}
|
||||
|
@ -781,32 +788,32 @@ function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $
|
|||
$full_legend_date = false;
|
||||
}
|
||||
$acumulate_data = io_safe_output(implode($separator,$acumulate_data));
|
||||
|
||||
|
||||
// Store data series in javascript format
|
||||
$jsvars = '';
|
||||
$jsseries = array();
|
||||
|
||||
|
||||
$date = get_system_time ();
|
||||
$datelimit = ($date - $period) * 1000;
|
||||
|
||||
|
||||
$i = 0;
|
||||
|
||||
|
||||
$values2 = array();
|
||||
|
||||
|
||||
foreach ($data as $jsvar => $values) {
|
||||
$values2[] = implode($separator,$values);
|
||||
$i ++;
|
||||
}
|
||||
|
||||
|
||||
$values = implode($separator2, $values2);
|
||||
|
||||
|
||||
// Javascript code
|
||||
$return .= "<script type='text/javascript'>";
|
||||
$return .= "//<![CDATA[\n";
|
||||
$return .= "pandoraFlotSlicebar('$graph_id', '$values', '$datacolor', '$labels', '$legend', '$acumulate_data', $intervaltick, '$fontpath', $fontsize, '$separator', '$separator2', '', $id_agent, '$full_legend_date', $not_interactive)";
|
||||
$return .= "\n//]]>";
|
||||
$return .= "</script>";
|
||||
|
||||
|
||||
return $return;
|
||||
}
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue