php version upgrade

This commit is contained in:
daniel 2018-10-19 10:04:26 +02:00
parent 9492d11cc8
commit b736746e1c
6 changed files with 378 additions and 616 deletions

View File

@ -2410,31 +2410,48 @@ function progress_bubble($progress, $width, $height, $title = '', $mode = 1, $va
"&colorRGB=". $colorRGB . "' />"; "&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; global $config;
if ($round_corner === null) { if ($round_corner === null) {
$round_corner = $config['round_corner']; $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'; $col_planned_downtime = '#20973F';
$colors = array(1 => COL_NORMAL, $colors = array(
1 => COL_NORMAL,
2 => COL_WARNING, 2 => COL_WARNING,
3 => COL_CRITICAL, 3 => COL_CRITICAL,
4 => COL_UNKNOWN, 4 => COL_UNKNOWN,
5 => COL_DOWNTIME, 5 => COL_DOWNTIME,
6 => COL_NOTINIT, 6 => COL_NOTINIT,
7 => COL_IGNORED); 7 => COL_IGNORED
);
return slicesbar_graph($data, $period, $width, $height, $colors, return $return['chart'] = flot_slicesbar_graph (
$config['fontpath'], $round_corner, $home_url, $ttl); $data,
$period,
$width,
$height,
'',
$colors,
$config['fontpath'],
$round_corner,
$home_url,
'',
'',
false,
0,
array(),
true,
$ttl
);
} }
/** /**
@ -3263,20 +3280,7 @@ 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); $colors = array(1 => COL_NORMAL, 2 => COL_WARNING, 3 => COL_CRITICAL, 4 => COL_UNKNOWN);
// Draw slicebar graph // Draw slicebar graph
if ($config['flash_charts']) { $out = flot_slicesbar_graph($data, $period, 100, 40, $full_legend, $colors, $config['fontpath'], $config['round_corner'], $homeurl, '', '', false, $id_agent, $full_legend_date);
$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 .= "&nbsp;";
foreach ($legend as $hour) {
$out .= "<span style='font-size: 6pt'>" . $hour . "</span>";
$out .= "&nbsp;";
}
}
if ($return) { if ($return) {
return $out; return $out;
@ -3317,13 +3321,8 @@ function graph_graphic_moduleevents ($id_agent, $id_module, $width, $height, $pe
for ($i = 0; $i < $interval; $i++) { for ($i = 0; $i < $interval; $i++) {
$bottom = $datelimit + ($periodtime * $i); $bottom = $datelimit + ($periodtime * $i);
if (! $graphic_type) { 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 { else {
$name = $bottom; $name = $bottom;
} }
@ -3365,23 +3364,31 @@ function graph_graphic_moduleevents ($id_agent, $id_module, $width, $height, $pe
$cont++; $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 $out = flot_slicesbar_graph(
if ($config['flash_charts']) { $data,
$out = flot_slicesbar_graph($data, $period, $width, $height, $full_legend, $colors, $config['fontpath'], $config['round_corner'], $homeurl, '', '', false, $id_agent); $period,
} 100,
else { $height,
$out = slicesbar_graph($data, $period, $width, $height, $colors, $config['fontpath'], $config['round_corner'], $homeurl); $full_legend,
$colors,
// Draw legend $config['fontpath'],
$out .= "<br>"; $config['round_corner'],
$out .= "&nbsp;"; $homeurl,
foreach ($legend as $hour) { '',
$out .= "<span style='font-size: 6pt'>" . $hour . "</span>"; '',
$out .= "&nbsp;"; false,
} $id_agent,
} array(),
true,
1
);
if ($return) { if ($return) {
return $out; 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'); $colors = array(1 => '#38B800', 2 => '#FFFF00', 3 => '#FF0000', 4 => '#C3C3C3');
// Draw slicebar graph // Draw slicebar graph
if ($config['flash_charts']) { echo flot_slicesbar_graph(
echo flot_slicesbar_graph($data, $period, $width, 50, $legend, $colors, $config['fontpath'], $config['round_corner'], $homeurl, '', $adapt_key, $stat_win); $data,
} $period,
else { $width,
echo slicesbar_graph($data, $period, $width, 15, $colors, $config['fontpath'], $config['round_corner'], $homeurl); 50,
} $legend,
$colors,
$config['fontpath'],
$config['round_corner'],
$homeurl,
'',
$adapt_key,
$stat_win
);
} }
function graph_nodata_image($width = 300, $height = 110, $type = 'area', $text = '') { function graph_nodata_image($width = 300, $height = 110, $type = 'area', $text = '') {

View File

@ -696,7 +696,6 @@ function reporting_SLA($report, $content, $type = 'dinamic',
$urlImage = ui_get_full_url(false, true, false, false); $urlImage = ui_get_full_url(false, true, false, false);
$sla_failed = false; $sla_failed = false;
$total_SLA = 0; $total_SLA = 0;
$total_result_SLA = 'ok'; $total_result_SLA = 'ok';
@ -775,7 +774,6 @@ function reporting_SLA($report, $content, $type = 'dinamic',
$slice $slice
); );
if ($metaconsole_on) { if ($metaconsole_on) {
//Restore db connection //Restore db connection
metaconsole_restore_db(); metaconsole_restore_db();
@ -933,6 +931,38 @@ function reporting_SLA($report, $content, $type = 'dinamic',
// Slice graphs calculation // Slice graphs calculation
if ($show_graphs) { 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 = array();
$dataslice['agent'] = io_safe_output(modules_get_agentmodule_agent_alias ($sla['id_agent_module'])); $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'])); $dataslice['module'] = io_safe_output(modules_get_agentmodule_name ($sla['id_agent_module']));
@ -948,12 +978,13 @@ function reporting_SLA($report, $content, $type = 'dinamic',
$content, $content,
$content['time_from'], $content['time_from'],
$content['time_to'], $content['time_to'],
1920, 100,
50, 70,
$urlImage, $urlImage,
$ttl, $ttl,
$raw_graph, $array_result,
false); false
);
$return['charts'][] = $dataslice; $return['charts'][] = $dataslice;
} }
@ -5499,7 +5530,6 @@ function reporting_availability_graph($report, $content, $pdf=false) {
reporting_set_conf_charts($width, $height, $only_image, $type, reporting_set_conf_charts($width, $height, $only_image, $type,
$content, $ttl); $content, $ttl);
$return["id_rc"] = $content['id_rc']; $return["id_rc"] = $content['id_rc'];
$edge_interval = 10; $edge_interval = 10;
@ -5547,7 +5577,6 @@ function reporting_availability_graph($report, $content, $pdf=false) {
//Restore db connection //Restore db connection
metaconsole_restore_db(); metaconsole_restore_db();
} }
continue; continue;
} }
@ -5597,7 +5626,6 @@ function reporting_availability_graph($report, $content, $pdf=false) {
$slice $slice
); );
if ($metaconsole_on) { if ($metaconsole_on) {
//Restore db connection //Restore db connection
metaconsole_restore_db(); metaconsole_restore_db();
@ -5722,6 +5750,38 @@ function reporting_availability_graph($report, $content, $pdf=false) {
$data['order'] = $data['sla_value']; $data['order'] = $data['sla_value'];
$return['data'][] = $data; $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 // Slice graphs calculation
$dataslice = array(); $dataslice = array();
$dataslice['agent'] = modules_get_agentmodule_agent_alias ($sla['id_agent_module']); $dataslice['agent'] = modules_get_agentmodule_agent_alias ($sla['id_agent_module']);
@ -5743,12 +5803,13 @@ function reporting_availability_graph($report, $content, $pdf=false) {
$content, $content,
$content['time_from'], $content['time_from'],
$content['time_to'], $content['time_to'],
1920, 100,
50, 70,
$urlImage, $urlImage,
$ttl, $ttl,
$raw_graph, $array_result,
false); false
);
$return['charts'][] = $dataslice; $return['charts'][] = $dataslice;
@ -5756,7 +5817,6 @@ function reporting_availability_graph($report, $content, $pdf=false) {
//Restore db connection //Restore db connection
metaconsole_restore_db(); metaconsole_restore_db();
} }
} }
// SLA items sorted descending () // SLA items sorted descending ()
@ -9743,331 +9803,6 @@ function reporting_get_agentmodule_sla_day ($id_agent_module, $period = 0, $min_
return (float) (100 - ($bad_period / $period_reduced) * 100); 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) { function reporting_get_stats_servers($tiny = true) {
global $config; global $config;

View File

@ -374,7 +374,6 @@ function reporting_html_SLA($table, $item, $mini) {
$table->data['sla']['cell'] = $item['failed']; $table->data['sla']['cell'] = $item['failed'];
} }
else { else {
if (!empty($item['planned_downtimes'])) { if (!empty($item['planned_downtimes'])) {
$downtimes_table = reporting_html_planned_downtimes_table($item['planned_downtimes']); $downtimes_table = reporting_html_planned_downtimes_table($item['planned_downtimes']);
@ -641,7 +640,6 @@ function reporting_html_SLA($table, $item, $mini) {
$table3->data[] = $row3; $table3->data[] = $row3;
} }
} }
$table->colspan['sla']['cell'] = 2; $table->colspan['sla']['cell'] = 2;
$table->data['sla']['cell'] = html_print_table($table1, true); $table->data['sla']['cell'] = html_print_table($table1, true);
$table->colspan['time_global']['cell'] = 2; $table->colspan['time_global']['cell'] = 2;
@ -649,10 +647,11 @@ function reporting_html_SLA($table, $item, $mini) {
$table->colspan['checks_global']['cell'] = 2; $table->colspan['checks_global']['cell'] = 2;
$table->data['checks_global']['cell'] = html_print_table($table3, true); $table->data['checks_global']['cell'] = html_print_table($table3, true);
} }
if (!empty($item['charts'])) { if (!empty($item['charts'])) {
$table1 = new stdClass(); $table1 = new stdClass();
$table1->width = '99%'; $table1->width = '99%';
$table1->size = array ();
$table1->size[0] = '10%';
$table1->data = array (); $table1->data = array ();
if (!$hide_notinit_agent) { if (!$hide_notinit_agent) {
@ -2501,7 +2500,6 @@ function reporting_html_availability(&$table, $item) {
$same_agent_in_resume = $item['data']['agent']; $same_agent_in_resume = $item['data']['agent'];
} }
} }
$table1->data[] = $table_row; $table1->data[] = $table_row;
$table2->data[] = $table_row2; $table2->data[] = $table_row2;
} }
@ -2577,6 +2575,11 @@ function reporting_html_availability_graph(&$table, $item, $pdf=0) {
$table1 = new stdClass(); $table1 = new stdClass();
$table1->width = '99%'; $table1->width = '99%';
$table1->data = array (); $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) { foreach ($item['charts'] as $chart) {
$checks_resume = ''; $checks_resume = '';
$sla_value = ''; $sla_value = '';
@ -3747,17 +3750,7 @@ function reporting_get_event_histogram ($events, $text_header_event = false) {
} }
$table = new stdClass(); $table = new stdClass();
if (!$text_header_event) {
$table->width = '100%'; $table->width = '100%';
}
else {
if (defined("METACONSOLE")) {
$table->width = '100%';
}
else {
$table->width = '70%';
}
}
$table->data = array (); $table->data = array ();
$table->size = array (); $table->size = array ();
$table->head = array (); $table->head = array ();
@ -3765,17 +3758,28 @@ function reporting_get_event_histogram ($events, $text_header_event = false) {
$table->data[0][0] = "" ; $table->data[0][0] = "" ;
if (!empty($graph_data)) { if (!empty($graph_data)) {
if (defined("METACONSOLE")) $url_slice = defined("METACONSOLE")
$slicebar = flot_slicesbar_graph($graph_data, $max_value, "100%", 35, $full_legend, $colors, $config['fontpath'], $config['round_corner'], $url); ? $url
else { : $urlImage;
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);
}
}
$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; $table->data[0][0] = $slicebar;
} }
@ -3941,7 +3945,25 @@ function reporting_get_event_histogram_meta ($width) {
$table->data[0][0] = "" ; $table->data[0][0] = "" ;
if (!empty($data)) { 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; $table->data[0][0] = $slicebar;
} }
else { else {

View File

@ -1494,24 +1494,24 @@ function visual_map_print_item($mode = "read", $layoutData,
else { else {
if ($width == 0 || $height == 0) { if ($width == 0 || $height == 0) {
if ($layoutData['label_position']=='left') { 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') { 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 { 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{ else{
if ($layoutData['label_position']=='left') { 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') { 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 { 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>';
} }
} }
} }

View File

@ -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( function vbar_graph(
$chart_data, $chart_data,
$width, $width,

View File

@ -684,7 +684,14 @@ function flot_vcolumn_chart ($graph_data, $width, $height, $color, $legend, $lon
return $return; 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; global $config;
// Get a unique identifier to graph // Get a unique identifier to graph