Merge branch '1632-Pandora_FMS_charts' into 'develop'

1632 pandora fms charts

See merge request artica/pandorafms!1179
This commit is contained in:
vgilc 2017-12-13 17:53:38 +01:00
commit a90fa27fa5
16 changed files with 1037 additions and 558 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

View File

@ -478,10 +478,13 @@ if ($get_extended_event) {
if ($get_events_details) {
$event_ids = explode(',',get_parameter ('event_ids'));
$events = db_get_all_rows_filter ('tevento',
array ('id_evento' => $event_ids,
'order' => 'utimestamp ASC'),
array ('evento', 'utimestamp', 'estado', 'criticity', 'id_usuario'));
$events = db_get_all_rows_filter (
'tevento',
array ('id_evento' => $event_ids,'order' => 'utimestamp ASC'),
array ('evento', 'utimestamp', 'estado', 'criticity', 'id_usuario'),
'AND',
true
);
$out = '<table class="eventtable" style="width:100%;height:100%;padding:0px 0px 0px 0px; border-spacing: 0px; margin: 0px 0px 0px 0px;">';
$out .= '<tr style="font-size:0px; heigth: 0px; background: #ccc;"><td></td><td></td></tr>';

View File

@ -738,7 +738,7 @@ function mysql_db_get_row_sql ($sql, $search_history_db = false) {
*
* @return mixed Array of the row or false in case of error.
*/
function mysql_db_get_row_filter ($table, $filter, $fields = false, $where_join = 'AND') {
function mysql_db_get_row_filter ($table, $filter, $fields = false, $where_join = 'AND', $historydb = false) {
if (empty ($fields)) {
$fields = '*';
}
@ -758,7 +758,7 @@ function mysql_db_get_row_filter ($table, $filter, $fields = false, $where_join
$sql = sprintf ('SELECT %s FROM %s %s', $fields, $table, $filter);
return db_get_row_sql ($sql);
return db_get_row_sql ($sql, $historydb);
}
/**

View File

@ -2580,7 +2580,7 @@ function get_percentile($percentile, $array) {
$index = ($percentile / 100) * count($array);
if (floor($index) == $index) {
$result = ($array[$index-1] + $array[$index]) / 2;
$result = ($array[$index-1] + $array[$index]) / 2;
}
else {
$result = $array[floor($index)];

View File

@ -416,12 +416,12 @@ function db_get_row ($table, $field_search, $condition, $fields = false) {
*
* @return mixed Array of the row or false in case of error.
*/
function db_get_row_filter($table, $filter, $fields = false, $where_join = 'AND') {
function db_get_row_filter($table, $filter, $fields = false, $where_join = 'AND', $historydb = false) {
global $config;
switch ($config["dbtype"]) {
case "mysql":
return mysql_db_get_row_filter($table, $filter, $fields, $where_join);
return mysql_db_get_row_filter($table, $filter, $fields, $where_join, $historydb);
break;
case "postgresql":
return postgresql_db_get_row_filter($table, $filter, $fields, $where_join);
@ -481,9 +481,6 @@ function db_get_all_rows_sql($sql, $search_history_db = false, $cache = true, $d
}
}
/**
*
* Returns the time the module is in unknown status (by events)
@ -493,7 +490,7 @@ function db_get_all_rows_sql($sql, $search_history_db = false, $cache = true, $d
* @param int $tend end of search
*
*/
function db_get_module_ranges_unknown($id_agente_modulo, $tstart = false, $tend = false) {
function db_get_module_ranges_unknown($id_agente_modulo, $tstart = false, $tend = false, $historydb = false) {
global $config;
if (!isset($id_agente_modulo)) {
@ -514,20 +511,19 @@ function db_get_module_ranges_unknown($id_agente_modulo, $tstart = false, $tend
return false;
}
// Retrieve going unknown events in range
$query = "SELECT utimestamp,event_type FROM tevento WHERE id_agentmodule = " . $id_agente_modulo;
$query .= " AND event_type like 'going_%' ";
$query .= " AND utimestamp >= $tstart AND utimestamp <= $tend ";
$query .= " ORDER BY utimestamp ASC";
$events = db_get_all_rows_sql($query);
$events = db_get_all_rows_sql($query, $historydb);
if (! is_array($events)){
return false;
}
$last_status = 0; // normal
$last_status = $events[0]["event_type"] != "going_unknown" ? 1:0;
$return = array();
$i=0;
foreach ($events as $event) {
@ -555,6 +551,9 @@ function db_get_module_ranges_unknown($id_agente_modulo, $tstart = false, $tend
}
}
}
if(!isset($return[0])){
return false;
}
return $return;
}
@ -573,6 +572,16 @@ function db_get_module_ranges_unknown($id_agente_modulo, $tstart = false, $tend
*
* Note: All "unknown" data are marked as NULL
* Warning: Be careful with the amount of data, check your RAM size available
* We'll return a bidimensional array
* Structure returned: schema:
*
* uncompressed_data =>
* pool_id (int)
* utimestamp (start of current slice)
* data
* array
* datos
* utimestamp
*
*/
function db_uncompress_module_data($id_agente_modulo, $tstart = false, $tend = false) {
@ -582,17 +591,6 @@ function db_uncompress_module_data($id_agente_modulo, $tstart = false, $tend = f
return false;
}
if ((!isset($tstart)) || ($tstart === false)) {
// Return data from the begining
// Get first available utimestamp in active DB
$query_first_man_time = " SELECT utimestamp FROM tagente_datos ";
$query_first_man_time .= " WHERE id_agente_modulo = $id_agente_modulo";
$query_first_man_time .= " ORDER BY utimestamp ASC LIMIT 1";
$first_man_time = db_get_all_rows_sql( $query_first_man_time, false);
$tstart = $first_man_time[0]['utimestamp'];
}
if ((!isset($tend)) || ($tend === false)) {
// Return data until now
$tend = time();
@ -612,270 +610,263 @@ function db_uncompress_module_data($id_agente_modulo, $tstart = false, $tend = f
}
$module_type = $module['id_tipo_modulo'];
$module_type_str = modules_get_type_name ($module_type);
if (strstr ($module_type_str, 'string') !== false) {
$table = "tagente_datos_string";
}
// Get first available utimestamp in active DB
$query = " SELECT utimestamp, datos FROM $table ";
$query .= " WHERE id_agente_modulo=$id_agente_modulo AND utimestamp < $tstart";
$query .= " ORDER BY utimestamp DESC LIMIT 1";
$ret = db_get_all_rows_sql( $query , $search_historydb);
if ( ( $ret === false ) || (( isset($ret[0]["utimestamp"]) && ($ret[0]["utimestamp"] > $tstart )))) {
// Value older than first retrieved from active DB
$search_historydb = true;
$ret = db_get_all_rows_sql( $query , $search_historydb);
if ($ret) {
$tstart = $ret[0]["utimestamp"];
}
$flag_async = false;
if(strstr ($module_type_str, 'async_data') !== false) {
$flag_async = true;
}
else {
$first_data["utimestamp"] = $ret[0]["utimestamp"];
$first_data["datos"] = $ret[0]["datos"];
if(strstr ($module_type_str, 'async_proc') !== false) {
$flag_async = true;
}
if ( ( $ret === false ) || (( isset($ret[0]["utimestamp"]) && ($ret[0]["utimestamp"] > $tstart )))) {
// No previous data. -> not init
// Avoid false unknown status
$first_data["utimestamp"] = time();
$result = modules_get_first_date($id_agente_modulo,$tstart);
$first_utimestamp = $result["first_utimestamp"];
$search_historydb = $result["search_historydb"];
if ($first_utimestamp === false) {
$first_data["utimestamp"] = $tstart;
$first_data["datos"] = false;
}
else {
$first_data["utimestamp"] = $ret[0]["utimestamp"];
$first_data["datos"] = $ret[0]["datos"];
$query = "SELECT datos,utimestamp FROM $table ";
$query .= " WHERE id_agente_modulo=$id_agente_modulo ";
$query .= " AND utimestamp=" . $first_utimestamp;
$data = db_get_all_rows_sql($query,$search_historydb);
if ($data === false) {
// first utimestamp not found in active database
// SEARCH HISTORY DB
$search_historydb = true;
$data = db_get_all_rows_sql($query,$search_historydb);
}
if ($data === false) { // Not init
$first_data["utimestamp"] = $tstart;
$first_data["datos"] = false;
}
else {
$first_data["utimestamp"] = $data[0]["utimestamp"];
$first_data["datos"] = $data[0]["datos"];
}
}
$query = " SELECT utimestamp, datos FROM $table ";
$query .= " WHERE id_agente_modulo=$id_agente_modulo AND utimestamp >= $tstart AND utimestamp <= $tend";
$query .= " ORDER BY utimestamp ASC";
// Retrieve all data from module in given range
$raw_data = db_get_all_rows_sql($query, $search_historydb);
if (($raw_data === false) && ($ret === false)) {
$module_interval = modules_get_interval ($id_agente_modulo);
if (($raw_data === false) && ( ($first_utimestamp < $tstart - (SECONDS_1DAY + 2*$module_interval)) ) ) {
// No data
return false;
}
// Retrieve going unknown events in range
$unknown_events = db_get_module_ranges_unknown($id_agente_modulo, $tstart, $tend);
$unknown_events = db_get_module_ranges_unknown($id_agente_modulo, $tstart, $tend, $search_historydb);
// Get the last event after inverval to know if graph start on unknown
$previous_unknown_events = db_get_row_filter (
'tevento',
array ('id_agentmodule' => $id_agente_modulo,
"utimestamp <= $tstart",
'order' => 'utimestamp DESC'
),
false,
'AND',
$search_historydb
);
//show graph if graph is inside unknown
if( $previous_unknown_events && $previous_unknown_events['event_type'] == 'going_unknown' &&
$unknown_events === false && $raw_data === false){
$last_inserted_value = $first_data["datos"];
$unknown_events[0]['time_from'] = $tstart+0.1;
}
//if time to is missing in last event force time to outside range time
if( $unknown_events && !isset($unknown_events[count($unknown_events) -1]['time_to']) ){
$unknown_events[count($unknown_events) -1]['time_to'] = $tend + $module_interval;
}
//if time to is missing in first event force time to outside range time
if ($first_data["datos"] === false && !$flag_async) {
$last_inserted_value = false;
}elseif( ($unknown_events && !isset($unknown_events[0]['time_from']) &&
$previous_unknown_events && $previous_unknown_events['event_type'] == 'going_unknown' && !$flag_async) ||
($first_utimestamp < $tstart - (SECONDS_1DAY + 2*$module_interval) && !$flag_async) ){
//$last_inserted_value = null;
$last_inserted_value = $first_data["datos"];
$unknown_events[0]['time_from'] = $tstart+0.1;
}
else{
$last_inserted_value = $first_data["datos"];
}
// Retrieve module_interval to build the template
$module_interval = modules_get_interval ($id_agente_modulo);
$slice_size = $module_interval;
// We'll return a bidimensional array
// Structure returned: schema:
//
// uncompressed_data =>
// pool_id (int)
// utimestamp (start of current slice)
// data
// array
// utimestamp
// datos
$return = array();
// Point current_timestamp to begin of the set and initialize flags
$current_timestamp = $tstart;
$last_inserted_value = $first_data["datos"];
$last_timestamp = $first_data["utimestamp"];
$data_found = 0;
$last_value = $first_data["datos"];
//reverse array data optimization
$raw_data = array_reverse($raw_data);
// Build template
$pool_id = 0;
$now = time();
$in_unknown_status = 0;
if (is_array($unknown_events)) {
$current_unknown = array_shift($unknown_events);
if($unknown_events){
$current_unknown = array_shift($unknown_events);
}
else{
$current_unknown = null;
}
if($raw_data){
$current_raw_data = array_pop($raw_data);
}
else{
$current_raw_data = null;
}
while ( $current_timestamp < $tend ) {
$expected_data_generated = 0;
while ( $current_timestamp < $tend ) {
$return[$pool_id]["data"] = array();
$tmp_data = array();
$data_found = 0;
$current_timestamp_end = $current_timestamp + $slice_size;
if (is_array($unknown_events)) {
$i = 0;
while ($current_timestamp >= $unknown_events[$i]["time_to"] ) {
// Skip unknown events in past
array_splice($unknown_events, $i,1);
$i++;
if (!isset($unknown_events[$i])) {
break;
}
}
if (isset($current_unknown)) {
// check if recovered from unknown status
if(is_array($unknown_events) && isset($current_unknown)) {
if ( (($current_timestamp+$slice_size) > $current_unknown["time_to"])
&& ($current_timestamp < $current_unknown["time_to"])
&& ($in_unknown_status == 1) ) {
// Recovered from unknown
if ( ($current_unknown["time_to"] > $current_timestamp)
&& ($expected_data_generated == 0) ) {
// also add the "expected" data
$tmp_data["utimestamp"] = $current_timestamp;
if ($in_unknown_status == 1) {
$tmp_data["datos"] = null;
}
else {
$tmp_data["datos"] = $last_inserted_value;
}
$return[$pool_id]["utimestamp"] = $current_timestamp;
array_push($return[$pool_id]["data"], $tmp_data);
$expected_data_generated = 1;
}
$tmp_data["utimestamp"] = $current_unknown["time_to"];
$tmp_data["datos"] = $last_inserted_value;
// debug purpose
//$tmp_data["obs"] = "event recovery data";
$return[$pool_id]["utimestamp"] = $current_timestamp;
array_push($return[$pool_id]["data"], $tmp_data);
$data_found = 1;
$in_unknown_status = 0;
}
if ( (($current_timestamp+$slice_size) > $current_unknown["time_from"])
&& (($current_timestamp+$slice_size) < $current_unknown["time_to"])
&& ($in_unknown_status == 0) ) {
// Add unknown state detected
if ( $current_unknown["time_from"] < ($current_timestamp+$slice_size)) {
if ( ($current_unknown["time_from"] > $current_timestamp)
&& ($expected_data_generated == 0) ) {
// also add the "expected" data
$tmp_data["utimestamp"] = $current_timestamp;
if ($in_unknown_status == 1) {
$tmp_data["datos"] = null;
}
else {
$tmp_data["datos"] = $last_inserted_value;
}
$return[$pool_id]["utimestamp"] = $current_timestamp;
array_push($return[$pool_id]["data"], $tmp_data);
$expected_data_generated = 1;
}
$tmp_data["utimestamp"] = $current_unknown["time_from"];
$tmp_data["datos"] = null;
// debug purpose
//$tmp_data["obs"] = "event data";
$return[$pool_id]["utimestamp"] = $current_timestamp;
array_push($return[$pool_id]["data"], $tmp_data);
$data_found = 1;
}
$in_unknown_status = 1;
}
if ( ($in_unknown_status == 0) && ($current_timestamp >= $current_unknown["time_to"]) ) {
$current_unknown = array_shift($unknown_events);
}
}
} // unknown events handle
}
// Search for data
$i=0;
if (is_array($raw_data)) {
foreach ($raw_data as $data) {
if ( ($data["utimestamp"] >= $current_timestamp)
&& ($data["utimestamp"] < ($current_timestamp+$slice_size)) ) {
// Data in block, push in, and remove from $raw_data (processed)
if ( ($data["utimestamp"] > $current_timestamp)
&& ($expected_data_generated == 0) ) {
// also add the "expected" data
$tmp_data["utimestamp"] = $current_timestamp;
if ($in_unknown_status == 1) {
$tmp_data["datos"] = null;
}
else {
$tmp_data["datos"] = $last_inserted_value;
}
//$tmp_data["obs"] = "expected data";
$return[$pool_id]["utimestamp"] = $current_timestamp;
array_push($return[$pool_id]["data"], $tmp_data);
$expected_data_generated = 1;
}
$tmp_data["utimestamp"] = intval($data["utimestamp"]);
$tmp_data["datos"] = $data["datos"];
// debug purpose
//$tmp_data["obs"] = "real data";
$return[$pool_id]["utimestamp"] = $current_timestamp;
array_push($return[$pool_id]["data"], $tmp_data);
$last_inserted_value = $data["datos"];
$last_timestamp = intval($data["utimestamp"]);
unset($raw_data[$i]);
$data_found = 1;
$in_unknown_status = 0;
}
elseif ($data["utimestamp"] > ($current_timestamp+$slice_size)) {
// Data in future, stop searching new ones
break;
}
}
$i++;
}
if ($data_found == 0) {
// No data found, lug the last_value until SECONDS_1DAY + 2*modules_get_interval
// UNKNOWN!
if (($current_timestamp > $now) || (($current_timestamp - $last_timestamp) > (SECONDS_1DAY + 2*$module_interval))) {
if (isset($last_inserted_value)) {
// unhandled unknown status control
$unhandled_time_unknown = $current_timestamp - (SECONDS_1DAY + 2*$module_interval) - $last_timestamp;
if ($unhandled_time_unknown > 0) {
// unhandled unknown status detected. Add to previous pool
$tmp_data["utimestamp"] = intval($last_timestamp) + (SECONDS_1DAY + 2*$module_interval);
$tmp_data["datos"] = null;
// debug purpose
//$tmp_data["obs"] = "unknown extra";
// add to previous pool if needed
if (isset($return[$pool_id-1])) {
array_push($return[$pool_id-1]["data"], $tmp_data);
}
}
}
$last_inserted_value = null;
}
$tmp_data["utimestamp"] = $current_timestamp;
if ($in_unknown_status == 1) {
$tmp_data["datos"] = null;
}
else {
$tmp_data["datos"] = $last_inserted_value;
}
// debug purpose
//$tmp_data["obs"] = "virtual data";
if (( $current_timestamp > $now) ||
( ($current_timestamp_end - $last_timestamp) >
(SECONDS_1DAY + 2 * $module_interval) ) ) {
$tmp_data["utimestamp"] = $last_timestamp + SECONDS_1DAY + 2 * $module_interval;
$return[$pool_id]["utimestamp"] = $current_timestamp;
//check not init
$tmp_data["datos"] = $last_value === false ? false : null;
//async not unknown
if($flag_async && $tmp_data["datos"] === null){
$tmp_data["datos"] = $last_inserted_value;
}
// debug purpose
//$tmp_data["obs"] = "unknown extra";
array_push($return[$pool_id]["data"], $tmp_data);
}
//insert first slice data
$tmp_data["utimestamp"] = $current_timestamp;
$tmp_data["datos"] = $last_inserted_value;
// debug purpose
//$tmp_data["obs"] = "virtual data";
$return[$pool_id]["utimestamp"] = $current_timestamp;
array_push($return[$pool_id]["data"], $tmp_data);
//insert raw data
while ( ($current_raw_data != null) &&
( ($current_timestamp_end >= $current_raw_data['utimestamp']) &&
($current_timestamp < $current_raw_data['utimestamp']) ) ) {
// Add unknown state detected
$tmp_data["utimestamp"] = $current_raw_data["utimestamp"];
$tmp_data["datos"] = $current_raw_data["datos"];
// debug purpose
//$tmp_data["obs"] = "real data";
array_push($return[$pool_id]["data"], $tmp_data);
$last_value = $current_raw_data["datos"];
$last_timestamp = $current_raw_data["utimestamp"];
if($raw_data){
$current_raw_data = array_pop($raw_data);
}
else{
$current_raw_data = null;
}
}
//unknown
$data_slices = $return[$pool_id]["data"];
if(!$flag_async){
while ( ($current_unknown != null) &&
( ( ($current_unknown['time_from'] != null) &&
($current_timestamp_end >= $current_unknown['time_from']) ) ||
($current_timestamp_end >= $current_unknown['time_to']) ) ) {
if( ( $current_timestamp <= $current_unknown['time_from']) &&
( $current_timestamp_end >= $current_unknown['time_from'] ) ){
// Add unknown state detected
$tmp_data["utimestamp"] = $current_unknown["time_from"];
$tmp_data["datos"] = null;
// debug purpose
//$tmp_data["obs"] = "event data unknown from";
array_push($return[$pool_id]["data"], $tmp_data);
$current_unknown["time_from"] = null;
}
if( ($current_timestamp <= $current_unknown['time_to']) &&
($current_timestamp_end >= $current_unknown['time_to'] ) ){
$tmp_data["utimestamp"] = $current_unknown["time_to"];
$i = count($data_slices) - 1;
while ($i >= 0) {
if($data_slices[$i]['utimestamp'] <= $current_unknown["time_to"]){
$tmp_data["datos"] =
$data_slices[$i]['datos'] == null
? $last_value
: $data_slices[$i]['datos'];
break;
}
$i--;
}
// debug purpose
//$tmp_data["obs"] = "event data unknown to";
array_push($return[$pool_id]["data"], $tmp_data);
if($unknown_events){
$current_unknown = array_shift($unknown_events);
}
else{
$current_unknown = null;
}
}
}
}
//sort current slice
usort(
$return[$pool_id]['data'],
function ($a, $b) {
if ($a['utimestamp'] == $b['utimestamp']) return 0;
return ($a['utimestamp'] < $b['utimestamp']) ? -1 : 1;
}
);
//put the last slice data like first element of next slice
$last_inserted_value = end($return[$pool_id]['data']);
$last_inserted_value = $last_inserted_value['datos'];
//increment
$pool_id++;
$current_timestamp += $slice_size;
$current_timestamp = $current_timestamp_end;
}
//slice to the end.
if($pool_id == 1){
$end_array = array();
$end_array['data'][0]['utimestamp'] = $tend;
$end_array['data'][0]['datos'] = $last_inserted_value;
//$end_array['data'][0]['obs'] = 'virtual data END';
array_push($return, $end_array);
}
return $return;
}

View File

@ -247,27 +247,23 @@ function grafico_modulo_sparse_data_chart (&$chart, &$chart_data_extra, &$long_i
// Event iterator
$event_i = 0;
// Is unknown flag
$is_unknown = $start_unknown;
// Calculate chart data
$last_known = $previous_data;
$first_events_unknown = $start_unknown;
for ($i = 0; $i <= $resolution; $i++) {
$timestamp = $datelimit + ($interval * $i);
if ($fullscale && ($resolution > ($config['graph_res'] * 50))) {
$timestamp = $data[$i]['utimestamp'];
}
$total = 0;
$count = 0;
// Read data that falls in the current interval
$interval_min = false;
$interval_max = false;
while (isset ($data[$data_i]) && $data[$data_i]['utimestamp'] >= $timestamp && $data[$data_i]['utimestamp'] < ($timestamp + $interval)) {
while (isset ($data[$data_i]) && $data[$data_i]['utimestamp'] >= $timestamp
&& $data[$data_i]['utimestamp'] < ($timestamp + $interval)) {
if ($interval_min === false) {
$interval_min = $data[$data_i]['datos'];
}
@ -308,11 +304,17 @@ function grafico_modulo_sparse_data_chart (&$chart, &$chart_data_extra, &$long_i
$alert_value = 0;
$unknown_value = 0;
// Is the first point of a unknown interval
$check_unknown = false;
$first_unknown = false;
if($first_events_unknown){
$is_unknown = true;
}
$event_ids = array();
$alert_ids = array();
while (isset ($events[$event_i]) && $events[$event_i]['utimestamp'] >= $timestamp && $events[$event_i]['utimestamp'] <= ($timestamp + $interval)) {
while (isset ($events[$event_i]) && $events[$event_i]['utimestamp'] >= $timestamp
&& $events[$event_i]['utimestamp'] <= ($timestamp + $interval)) {
if ($show_events == 1) {
$event_value++;
$event_ids[] = $events[$event_i]['id_evento'];
@ -327,8 +329,11 @@ function grafico_modulo_sparse_data_chart (&$chart, &$chart_data_extra, &$long_i
$first_unknown = true;
}
$is_unknown = true;
$check_unknown = true;
}
else if (substr ($events[$event_i]['event_type'], 0, 5) == 'going') {
$first_events_unknown = false;
$first_unknown = false;
$is_unknown = false;
}
}
@ -489,9 +494,14 @@ function grafico_modulo_sparse_data_chart (&$chart, &$chart_data_extra, &$long_i
if (!isset($chart[$timestamp]['unknown'.$series_suffix])) {
$chart[$timestamp]['unknown'.$series_suffix] = 0;
}
$chart[$timestamp]['unknown'.$series_suffix] = $unknown_value;
$series_type['unknown'.$series_suffix] = 'area';
if($unknown_value == 0 && $check_unknown == true){
$chart[$timestamp]['unknown'.$series_suffix] = 1;
$check_unknown = false;
}
$series_type['unknown'.$series_suffix] = 'unknown';
}
if (!empty($event_ids)) {
@ -502,6 +512,14 @@ function grafico_modulo_sparse_data_chart (&$chart, &$chart_data_extra, &$long_i
}
}
//min paint graph 2 elements
if(count($chart) == 1){
$timestamp_short = date($time_format, $date_limit);
foreach($chart as $key => $value){
$chart[$timestamp_short] = $value;
}
}
if (!is_null($percentil) && $percentil) {
$avg = array_map(function($item) { return $item['sum'];}, $chart);
@ -546,12 +564,15 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
$start_unknown = false;
// Set variables
if ($date == 0) $date = get_system_time();
if ($date == 0) {
$date = get_system_time();
}
$datelimit = $date - $period;
$search_in_history_db = db_search_in_history_db($datelimit);
if($force_interval){
$resolution = $period/$time_interval;
}
@ -564,6 +585,7 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
}
else{
$interval = (int) ($period / $resolution);
}
$agent_name = modules_get_agentmodule_agent_name ($agent_module_id);
@ -582,18 +604,29 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
// Get event data (contains alert data too)
$events = array();
if ($show_unknown == 1 || $show_events == 1 || $show_alerts == 1) {
$events = db_get_all_rows_filter ('tevento',
$events = db_get_all_rows_filter (
'tevento',
array ('id_agentmodule' => $agent_module_id,
"utimestamp > $datelimit",
"utimestamp < $date",
'order' => 'utimestamp ASC'),
array ('id_evento', 'evento', 'utimestamp', 'event_type'));
array ('id_evento', 'evento', 'utimestamp', 'event_type'),
'AND',
$search_in_history_db
);
// Get the last event after inverval to know if graph start on unknown
$prev_event = db_get_row_filter ('tevento',
$prev_event = db_get_row_filter (
'tevento',
array ('id_agentmodule' => $agent_module_id,
"utimestamp <= $datelimit",
'order' => 'utimestamp DESC'));
'order' => 'utimestamp DESC'
),
false,
'AND',
$search_in_history_db
);
if (isset($prev_event['event_type']) && $prev_event['event_type'] == 'going_unknown') {
$start_unknown = true;
}
@ -608,7 +641,7 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
fullscale_data( $chart, $chart_data_extra, $long_index, $series_type,
$agent_module_id, $datelimit, $date, $events,
$show_events, $show_unknown, $show_alerts,
$series_suffix, $percentil, $flash_chart);
$series_suffix, $percentil, $flash_chart, false);
if (count($chart) > $resolution) {
$resolution = count($chart); //Number of points of the graph
$interval = (int) ($period / $resolution);
@ -620,45 +653,8 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
"utimestamp > $datelimit",
"utimestamp < $date",
'order' => 'utimestamp ASC'),
array ('datos', 'utimestamp'), 'AND', false);
array ('datos', 'utimestamp'), 'AND', $search_in_history_db);
if ($search_in_history_db) {
$cache = false;
$history = false;
$sql = "SELECT datos, utimestamp FROM tagente_datos WHERE id_agente_modulo = " . (int)$agent_module_id .
" AND utimestamp > " . $datelimit . " AND utimestamp < " . $date .
" ORDER BY utimestamp ASC";
// Connect to the history DB
if (! isset ($config['history_db_connection']) || $config['history_db_connection'] === false) {
$config['history_db_connection'] = db_connect($config['history_db_host'], $config['history_db_name'], $config['history_db_user'], io_output_password($config['history_db_pass']), $config['history_db_port'], false);
}
if ($config['history_db_connection'] !== false) {
$history = mysql_db_process_sql ($sql, 'affected_rows', $config['history_db_connection'], false);
}
if ($history === false) {
$history = array ();
}
$new_data = array();
$last_timestamp = 0;
foreach($history as $h) {
$new_data[] = $h;
$last_timestamp = $h['utimestamp'];
}
foreach($data as $d) {
if ($d['utimestamp'] > $last_timestamp) {
$new_data[] = $d;
$last_timestamp = $d['utimestamp'];
}
}
$data = $new_data;
}
if ($data === false) {
$data = array ();
}
@ -746,6 +742,18 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
// Calculate chart data
if($fullscale){
$avg_only = 1;
//Percentil
if (!is_null($percentil) && $percentil) {
$avg = array_map(function($item) { return $item['sum'];}, $chart);
$percentil_result = get_percentile($percentil, $avg);
//Fill the data of chart
array_walk($chart, function(&$item) use ($percentil_result, $series_suffix) {
$item['percentil' . $series_suffix] = $percentil_result; });
$series_type['percentil' . $series_suffix] = 'line';
}
}
else{
grafico_modulo_sparse_data_chart ($chart, $chart_data_extra, $long_index,
@ -756,7 +764,7 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
$percentil, $fullscale, $force_interval, $time_interval,
$max_only, $min_only);
}
// Return chart data and don't draw
if ($return_data == 1) {
return $chart;
@ -773,8 +781,11 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
$event_max = 5;
}
}
foreach ($chart as $timestamp => $chart_data) {
if($chart_data['max'] > $event_max){
$event_max = $chart_data['max'];
}
if ($show_events && $chart_data['event' . $series_suffix] > 0) {
$chart[$timestamp]['event' . $series_suffix] = $event_max * 1.2;
}
@ -1307,6 +1318,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
if ($data === false) {
$data = array ();
}
// Uncompressed module data
if ($uncompressed_module) {
@ -1337,7 +1349,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
$min_necessary = 2;
}
// Set initial conditions
$graph_values[$i] = array();
@ -1437,7 +1449,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
$min = null;
$avg = 0;
$countAvg = 0;
// Calculate chart data
$last_known = $previous_data;
for ($l = 0; $l <= $resolution; $l++) {
@ -1469,7 +1481,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
$count++;
$j++;
}
// Average
if ($count > 0) {
$total /= $count;
@ -1517,7 +1529,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
$min = $temp_graph_values[$timestamp_short];
}
$avg += $temp_graph_values[$timestamp_short];
// Added to support projection graphs
if ($projection != false and $i != 0) {
$projection_data = array();
@ -1528,7 +1540,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
$graph_values[$i] = $temp_graph_values;
}
}
//Add the max, min and avg in the legend
$avg = round($avg / $countAvg, 1);
@ -1608,8 +1620,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
$temp = array();
if ($flash_charts === false && $stacked == CUSTOM_GRAPH_GAUGE)
$stacked = CUSTOM_GRAPH_BULLET_CHART;
$stacked = CUSTOM_GRAPH_BULLET_CHART;
switch ($stacked) {
case CUSTOM_GRAPH_BULLET_CHART_THRESHOLD:
case CUSTOM_GRAPH_BULLET_CHART:
@ -1727,7 +1738,6 @@ function graphic_combined_module ($module_list, $weight_list, $period,
else
$module = $module_item;
$module_data = modules_get_agentmodule($module);
$query_last_value = sprintf('
SELECT datos
@ -1910,6 +1920,16 @@ function graphic_combined_module ($module_list, $weight_list, $period,
}
}
}
//check min array two elements
if(count($temp) == 1){
$timestamp_short = graph_get_formatted_date($date, $time_format, $time_format_2);
foreach($temp as $key => $value){
foreach($value as $k => $v){
$temp[$timestamp_short][$k] = $v;
}
}
}
break;
}
}
@ -1919,7 +1939,13 @@ function graphic_combined_module ($module_list, $weight_list, $period,
$flash_charts = false;
}
$temp = fullscale_data_combined($module_list, $period, $date, $flash_charts);
$temp = fullscale_data_combined($module_list, $period, $date, $flash_charts, $percentil);
if (!is_null($percentil) && $percentil) {
if(isset($temp['percentil'])){
$percentil_result = array_pop($temp);
}
}
$resolution = count($temp); //Number of points of the graph
$interval = (int) ($period / $resolution);
@ -1948,10 +1974,20 @@ function graphic_combined_module ($module_list, $weight_list, $period,
$module_name_list[$key] = $alias . " / " . $module_name;
}
}
}
$graph_values = $temp;
if (!is_null($percentil) && $percentil) {
foreach ($module_list as $key => $value) {
$agent_name = io_safe_output( modules_get_agentmodule_agent_name ($value) );
$alias = db_get_value ("alias","tagente","nombre",$agent_name);
$module_name = io_safe_output( modules_get_agentmodule_name ($value) );
$module_name_list['percentil'.$key] = __('Percentile %dº', $config['percentil']) . __(' of module ') . $agent_name .' / ' . $module_name . ' (' . $percentil_result[$key][0] . ' ' . $unit . ') ';
$series_type[$key] = 'line';
}
}
}
$graph_values = $temp;
if($config["fixed_graph"] == false){
$water_mark = array(
'file' => $config['homedir'] . "/images/logo_vertical_water.png",
@ -2283,8 +2319,8 @@ function graphic_combined_module ($module_list, $weight_list, $period,
}
}
function fullscale_data_combined($module_list, $period, $date, $flash_charts){
function fullscale_data_combined($module_list, $period, $date, $flash_charts, $percentil){
global $config;
// Set variables
if ($date == 0){
$date = get_system_time();
@ -2293,6 +2329,10 @@ function fullscale_data_combined($module_list, $period, $date, $flash_charts){
$datelimit = $date - $period;
foreach ($module_list as $key_module => $value_module) {
if (!is_null($percentil) && $percentil) {
$array_percentil = array();
}
$data_uncompress = db_uncompress_module_data($value_module, $datelimit, $date);
foreach ($data_uncompress as $key_data => $value_data) {
foreach ($value_data['data'] as $k => $v) {
@ -2302,14 +2342,24 @@ function fullscale_data_combined($module_list, $period, $date, $flash_charts){
else{
$real_date = $v['utimestamp'];
}
if (!is_null($percentil) && $percentil) {
$array_percentil[] = $v['datos'];
}
$data_all[$real_date][$key_module] = $v['datos'];
}
}
if (!is_null($percentil) && $percentil) {
$percentil_value = get_percentile($config['percentil'], $array_percentil);
$percentil_result[$key_module] = array_fill (0, count($data_all), $percentil_value);
}
}
$data_prev = array();
ksort($data_all);
//ksort($data_all);
foreach ($data_all as $key => $value) {
foreach ($module_list as $key_module => $value_module) {
if(!isset($value[$key_module])){
@ -2321,6 +2371,10 @@ function fullscale_data_combined($module_list, $period, $date, $flash_charts){
}
}
if (!is_null($percentil) && $percentil) {
$data_all['percentil'] = $percentil_result;
}
return $data_all;
}
@ -4043,7 +4097,7 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
$datelimit = $date - $period;
$search_in_history_db = db_search_in_history_db($datelimit);
$resolution = $config['graph_res'] * 50; //Number of points of the graph
$interval = (int) ($period / $resolution);
$interval = (float) ($period / $resolution);
$agent_name = modules_get_agentmodule_agent_name ($agent_module_id);
$agent_id = agents_get_agent_id ($agent_name);
$module_name = modules_get_agentmodule_name ($agent_module_id);
@ -4053,22 +4107,33 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
if ($uncompressed_module) {
$avg_only = 1;
}
$search_in_history_db = db_search_in_history_db($datelimit);
// Get event data (contains alert data too)
if ($show_unknown == 1 || $show_events == 1 || $show_alerts == 1) {
$events = db_get_all_rows_filter('tevento',
$events = db_get_all_rows_filter(
'tevento',
array ('id_agentmodule' => $agent_module_id,
"utimestamp > $datelimit",
"utimestamp < $date",
'order' => 'utimestamp ASC'),
array ('evento', 'utimestamp', 'event_type', 'id_evento'));
'order' => 'utimestamp ASC'
),
array ('evento', 'utimestamp', 'event_type', 'id_evento'),
'AND',
$search_in_history_db
);
// Get the last event after inverval to know if graph start on unknown
$prev_event = db_get_row_filter ('tevento',
$prev_event = db_get_row_filter (
'tevento',
array ('id_agentmodule' => $agent_module_id,
"utimestamp <= $datelimit",
'order' => 'utimestamp DESC'));
'order' => 'utimestamp DESC'
),
false,
'AND',
$search_in_history_db
);
if (isset($prev_event['event_type']) && $prev_event['event_type'] == 'going_unknown') {
$start_unknown = true;
}
@ -4082,7 +4147,7 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
fullscale_data( $chart, $chart_data_extra, $long_index, $series_type,
$agent_module_id, $datelimit, $date, $events,
$show_events, $show_unknown, $show_alerts,
$series_suffix, $percentil, $flash_chart);
$series_suffix, $percentil, $flash_chart,true);
if (count($chart) > $resolution) {
$resolution = count($chart); //Number of points of the graph
$interval = (int) ($period / $resolution);
@ -4106,8 +4171,6 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
// Uncompressed module data
if ($uncompressed_module) {
$min_necessary = 1;
// Compressed module data
}
else {
// Get previous data
@ -4141,8 +4204,6 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
graphic_error ();
}
// Data iterator
$j = 0;
@ -4159,21 +4220,18 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
}
$max_value = 0;
// Calculate chart data
$last_known = $previous_data;
$first_events_unknown = $start_unknown;
for ($i = 0; $i <= $resolution; $i++) {
$timestamp = $datelimit + ($interval * $i);
/*
if ($fullscale && ($resolution > ($config['graph_res'] * 50))) {
$timestamp = $data[$i]['utimestamp'];
}
*/
$zero = 0;
$total = 0;
$count = 0;
$is_unknown = false;
// Read data that falls in the current interval
while (isset ($data[$j]) &&
$data[$j]['utimestamp'] >= $timestamp &&
@ -4203,10 +4261,13 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
$event_value = 0;
$alert_value = 0;
$unknown_value = 0;
// Is the first point of a unknown interval
$check_unknown = false;
$first_unknown = false;
if($first_events_unknown){
$is_unknown = true;
}
$event_ids = array();
$alert_ids = array();
while (isset ($events[$k]) &&
@ -4226,8 +4287,11 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
$first_unknown = true;
}
$is_unknown = true;
$check_unknown = true;
}
else if (substr ($events[$k]['event_type'], 0, 5) == 'going') {
$first_events_unknown = false;
$first_unknown = false;
$is_unknown = false;
}
}
@ -4269,12 +4333,12 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
if ($total > $max_value) {
$max_value = $total;
}
// Data
if ($show_events) {
if (!isset($chart[$timestamp]['event'.$series_suffix])) {
$chart[$timestamp]['event'.$series_suffix] = 0;
}
$chart[$timestamp]['event'.$series_suffix] += $event_value;
$series_type['event'.$series_suffix] = 'points';
}
@ -4306,23 +4370,28 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
}
}
$series_type['sum' . $series_suffix] = 'boolean';
if ($show_unknown) {
if (!isset($chart[$timestamp]['unknown'.$series_suffix])) {
$chart[$timestamp]['unknown'.$series_suffix] = 0;
}
$chart[$timestamp]['unknown'.$series_suffix] = $unknown_value;
$series_type['unknown'.$series_suffix] = 'area';
if($unknown_value == 0 && $check_unknown == true){
$chart[$timestamp]['unknown'.$series_suffix] = 1;
$check_unknown = false;
}
$series_type['unknown'.$series_suffix] = 'unknown';
}
$series_type['sum' . $series_suffix] = 'boolean';
if (!empty($event_ids)) {
$chart_extra_data[count($chart)-1]['events'] = implode(',',$event_ids);
}
if (!empty($alert_ids)) {
$chart_extra_data[count($chart)-1]['alerts'] = implode(',',$alert_ids);
}
}
}
@ -4336,6 +4405,7 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
$graph_stats = get_statwin_graph_statistics($chart, $series_suffix);
// Fix event and alert scale
$max_value = 1;
foreach ($chart as $timestamp => $chart_data) {
if ($show_events) {
if ($chart_data['event'.$series_suffix] > 0) {
@ -4353,7 +4423,6 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
}
}
}
///////////////////////////////////////////////////
if(!$fullscale){
// Set the title and time format
@ -4434,171 +4503,150 @@ function fullscale_data ( &$chart_data, &$chart_extra_data, &$long_index,
$events = false, $show_events = false,
$show_unknown = false, $show_alerts = false,
$series_suffix = '', $percentil = false,
$flash_chart = true ){
$flash_chart = true, $boolean_graph = false){
global $config;
global $max_value;
global $min_value;
global $series_type;
global $chart_extra_data;
$ranges_unknown = db_get_module_ranges_unknown($agent_module_id, $datelimit, $date);
$table = "tagente_datos";
$module_type_str = modules_get_type_name ($agent_module_id);
if (strstr ($module_type_str, 'string') !== false) {
$table = "tagente_datos_string";
}
$first_data = 0;
$query = " SELECT utimestamp, datos FROM $table ";
$query .= " WHERE id_agente_modulo=$agent_module_id ";
$query .= " ORDER BY utimestamp ASC LIMIT 1";
$ret = db_get_all_rows_sql( $query , true);
$first_data = $ret[0]['utimestamp'];
$data_uncompress = db_uncompress_module_data($agent_module_id, $datelimit, $date);
$i = 0;
$max_value = 0;
$min_value = 0;
$timestamp_second = 0;
if(is_array($data_uncompress)){
foreach ($data_uncompress as $v) {
foreach ($v['data'] as $key => $value) {
$real_date = date("Y M d H:i:s", $value['utimestamp']);
$chart_data = array();
$min_value = PHP_INT_MAX-1;
$max_value = PHP_INT_MIN+1;
$previous_data = $first_data;
$previous_unknown = 0;
$i=0;
$current_event = $events[0];
$prueba = array();
foreach ($data_uncompress as $k) {
foreach ($k["data"] as $v) {
$real_date = date("Y M d H:i:s", $v['utimestamp']);
if(!$flash_chart){
$real_date = date("Y/M/d", $v['utimestamp']);
$real_date .= "\n";
$real_date .= date(" H:i:s", $v['utimestamp']);
}
$event_ids = array();
$alert_ids = array();
while (isset($current_event) && ($v['utimestamp'] >= $current_event["utimestamp"]) ) {
$event_date = date("Y M d H:i:s", $current_event['utimestamp']);
if(!$flash_chart){
$real_date = date("Y/M/d", $value['utimestamp']);
$real_date .= "\n";
$real_date .= date(" H:i:s", $value['utimestamp']);
$event_date = date("Y/M/d", $current_event['utimestamp']);
$event_date .= "\n";
$event_date .= date(" H:i:s", $current_event['utimestamp']);
}
// Read events and alerts that fall in the current interval
$event_value = 0;
$alert_value = 0;
$unknown_value = 0;
$event_i = 0;
// Is the first point of a unknown interval
$first_unknown = false;
$event_ids = array();
$alert_ids = array();
//
if($timestamp_second == 0){
$timestamp_second = $value['utimestamp'];
if ($show_events && (strpos($current_event["event_type"], "going") !== false)) {
$event_ids[$event_date][] = $current_event["id_evento"];
$chart_data[$event_date]["event" . $series_suffix] = 1;
$chart_data[$event_date]["alert" . $series_suffix] = NULL;
$chart_extra_data[count($chart_data)-1]['events'] = implode (',', $event_ids[$event_date]);
}
elseif ($show_alerts && (strpos($current_event["event_type"], "alert") !== false)) {
$alert_ids[$event_date][] = $current_event["id_evento"];
$chart_data[$event_date]["event" . $series_suffix] = NULL;
$chart_data[$event_date]["alert" . $series_suffix] = 1;
$chart_extra_data[count($chart_data)-1]['alerts'] = implode (',', $alert_ids[$event_date]);
}
$timestamp_first = $timestamp_second;
$timestamp_second = $value['utimestamp'];
foreach ($events as $key => $val) {
if( $val['utimestamp'] > $timestamp_first &&
$val['utimestamp'] <= $timestamp_second ){
if ($show_events == 1) {
$event_ids[] = $val['id_evento'];
$event_value++;
}
if ($show_alerts == 1 && substr ($val['event_type'], 0, 5) == 'alert') {
$alert_ids[] = $val['id_evento'];
$alert_value++;
}
if ($show_unknown) {
if ($val['event_type'] == 'going_unknown') {
if ($is_unknown == false) {
$first_unknown = true;
}
$is_unknown = true;
}
else if (substr ($val['event_type'], 0, 5) == 'going') {
$is_unknown = false;
}
}
$chart_data[$event_date]["sum" . $series_suffix] = $previous_data;
if($show_unknown) {
$chart_data[$event_date]["unknown" . $series_suffix] = $previous_unknown;
}
$current_event = $events[$i++];
}
if ($v["datos"] === NULL) {
// Unknown
if (!isset($chart_data[$real_date]["event" . $series_suffix])) {
if($show_events) {
$chart_data[$real_date]["event" . $series_suffix] = NULL;
}
if($show_alerts) {
$chart_data[$real_date]["alert" . $series_suffix] = NULL;
}
}
if(empty($value['datos'])){
if($value['utimestamp'] < $first_data){
//$chart_data[$real_date]['unknown'.$series_suffix] = 0;
$is_unknown = false;
$chart_data[$real_date]["sum" . $series_suffix] = $previous_data;
if($show_unknown) {
$chart_data[$real_date]["unknown" . $series_suffix] = "1";
}
$previous_unknown = "1";
}
elseif($v["datos"] === false) {
// Not Init
$previous_data = $v["datos"];
if (!isset($chart_data[$real_date]["event" . $series_suffix])) {
if ($show_events) {
$chart_data[$real_date]["event" . $series_suffix] = NULL;
}
else{
//$chart_data[$real_date]['unknown'.$series_suffix] = 1;
$first_unknown = true;
if ($show_alerts) {
$chart_data[$real_date]["alert" . $series_suffix] = NULL;
}
}
$timestamp_short = date("Y M d H:i:s", $value['utimestamp']);
if(!$flash_chart){
$timestamp_short = date("Y/M/d", $value['utimestamp']);
$timestamp_short .= "\n";
$timestamp_short .= date(" H:i:s", $value['utimestamp']);
}
$long_index[$timestamp_short] = date(
html_entity_decode($config['date_format'], ENT_QUOTES, "UTF-8"), $value['utimestamp']);
// In some cases, can be marked as known because a recovery event
// was found in same interval. For this cases first_unknown is
// checked too
if ($is_unknown || $first_unknown) {
$unknown_value++;
}
// Data
if ($show_events) {
if (!isset($chart_data[$real_date]['event'.$series_suffix])) {
$chart_data[$real_date]['event'.$series_suffix] = 0;
}
$chart_data[$real_date]['event'.$series_suffix] += $event_value;
$series_type['event'.$series_suffix] = 'points';
}
if ($show_alerts) {
if (!isset($chart_data[$real_date]['alert'.$series_suffix])) {
$chart_data[$real_date]['alert'.$series_suffix] = 0;
}
$chart_data[$real_date]['alert'.$series_suffix] += $alert_value;
$series_type['alert'.$series_suffix] = 'points';
}
$chart_data[$real_date]['sum'.$series_suffix] = $value['datos'];
if($value['datos'] > $max_value){
$max_value = $value['datos'];
}
if($value['datos'] < $min_value){
$min_value = $value['datos'];
}
if ($show_unknown) {
if (!isset($chart_data[$real_date]['unknown'.$series_suffix])) {
$chart_data[$real_date]['unknown'.$series_suffix] = 0;
}
$chart_data[$real_date]['unknown'.$series_suffix] = $unknown_value;
$series_type['unknown'.$series_suffix] = 'area';
$chart_data[$real_date]["sum" . $series_suffix] = $v["datos"];
if($v['datos'] >= $max_value){
$max_value = $v['datos'];
}
if (!empty($event_ids)) {
$chart_extra_data[count($chart_data)-1]['events'] = implode(',',$event_ids);
if($v['datos'] <= $min_value){
$min_value = $v['datos'];
}
if (!empty($alert_ids)) {
$chart_extra_data[count($chart_data)-1]['alerts'] = implode(',',$alert_ids);
if($show_unknown) {
$chart_data[$real_date]["unknown" . $series_suffix] = NULL;
$previous_unknown = NULL;
}
}
else {
$previous_data = $v["datos"];
if (!isset($chart_data[$real_date]["event" . $series_suffix])) {
if ($show_events) {
$chart_data[$real_date]["event" . $series_suffix] = NULL;
}
if ($show_alerts) {
$chart_data[$real_date]["alert" . $series_suffix] = NULL;
}
}
$chart_data[$real_date]["sum" . $series_suffix] = $v["datos"];
if($v['datos'] >= $max_value){
$max_value = $v['datos'];
}
if($v['datos'] <= $min_value){
$min_value = $v['datos'];
}
if($show_unknown) {
$chart_data[$real_date]["unknown" . $series_suffix] = NULL;
$previous_unknown = NULL;
}
}
}
if (!is_null($percentil) && $percentil) {
$avg = array_map(function($item) { return $item['sum']; }, $chart_data);
$percentil_result = get_percentile($percentil, $avg);
//Fill the data of chart
array_walk($chart_data, function(&$item) use ($percentil_result, $series_suffix) {
$item['percentil' . $series_suffix] = $percentil_result; });
$series_type['percentil' . $series_suffix] = 'line';
}
}
$series_type['event'.$series_suffix] = 'points';
$series_type['alert'.$series_suffix] = 'points';
$series_type['unknown'.$series_suffix] = 'unknown';
if($boolean_graph){
$series_type['sum'.$series_suffix] = 'boolean';
}
else{
$series_type['sum'.$series_suffix] = 'area';
}
}

View File

@ -2308,50 +2308,53 @@ function modules_change_relation_lock ($id_relation) {
return ($result !== false ? $new_value : $old_value);
}
function modules_get_count_datas($id_agent_module, $date_init, $date_end) {
$interval = modules_get_interval ($id_agent_module);
// TODO REMOVE THE TIME IN PLANNED DOWNTIME
if (!is_numeric($date_init)) {
$date_init = strtotime($date_init);
}
if (!is_numeric($date_end)) {
$date_end = strtotime($date_end);
}
$first_date = modules_get_first_contact_date($id_agent_module);
if ($date_init < $first_date) {
$date_init = $first_date;
}
$diff = $date_end - $date_init;
return ($diff / $interval);
}
function modules_get_first_contact_date($id_agent_module) {
/*
* @return utimestamp with the first contact of the module or first contact before datelimit, false if not-init
*/
function modules_get_first_date($id_agent_module, $datelimit = 0) {
global $config;
// TODO REMOVE THE TIME IN PLANNED DOWNTIME
//check datatype string or normal
$table = "tagente_datos";
$module_type_str = modules_get_type_name ($id_agent_module);
if (strstr ($module_type_str, 'string') !== false) {
$table = "tagente_datos_string";
}
$search_historydb = false;
// tagente_estado.first_utimestamp is not valid or is not updated. Scan DBs for first utimestamp
if ($datelimit > 0) {
// get last data before datelimit
$query = " SELECT max(utimestamp) as utimestamp FROM $table ";
$query .= " WHERE id_agente_modulo=$id_agent_module ";
$query .= " AND utimestamp < $datelimit ";
// TODO FOR OTHER KIND OF DATA
}
else {
// get first utimestamp
$query = " SELECT min(utimestamp) as utimestamp FROM $table ";
$query .= " WHERE id_agente_modulo=$id_agent_module ";
}
$first_date = db_get_value('utimestamp', 'tagente_datos',
'id_agente_modulo', $id_agent_module,
$config['history_db_enabled']);
return $first_date;
// SEARCH ACTIVE DB
$data = db_get_all_rows_sql($query,$search_historydb);
if (($data === false) || ($data[0]["utimestamp"] === NULL) || ($data[0]["utimestamp"] <= 0)) {
// first utimestamp not found in active database
// SEARCH HISTORY DB
$search_historydb = true;
$data = db_get_all_rows_sql($query,$search_historydb);
}
if (($data === false) || ($data[0]["utimestamp"] === NULL) || ($data[0]["utimestamp"] <= 0)) {
// Nor active DB nor history DB have the data, the module is not-init
return array ("first_utimestamp" => false, "search_historydb" => $search_historydb);
}
// The data has been found
return array ("first_utimestamp" => $data[0]["utimestamp"], "search_historydb" => $search_historydb);
}
/**

View File

@ -942,6 +942,7 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
filled = false;
steps_chart = false
break;
case 'unknown':
case 'boolean':
line_show = true;
points_show = false;
@ -1772,9 +1773,11 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
if (timesize+timenewpos > canvaslimit) {
$('#timestamp_'+graph_id).css('left', timenewpos - timesize);
$('#timestamp_'+graph_id).css('top', 50);
}
else {
$('#timestamp_'+graph_id).css('left', timenewpos);
$('#timestamp_'+graph_id).css('top', 50);
}
}
else {
@ -1817,24 +1820,16 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
plot.unhighlight();
if (item && item.series.label != '' && (item.series.label == legend_events || item.series.label == legend_events+series_suffix_str || item.series.label == legend_alerts || item.series.label == legend_alerts+series_suffix_str)) {
plot.unhighlight();
var canvaslimit = parseInt(plot.offset().left + plot.width());
var dataset = plot.getData();
var timenewpos = parseInt(dataset[0].xaxis.p2c(pos.x)+plot.offset().left);
var extrasize = parseInt($('#extra_'+graph_id).css('width').split('px')[0]);
var left_pos;
if (extrasize+timenewpos > canvaslimit) {
left_pos = timenewpos - extrasize - 20;
}
else {
left_pos = timenewpos - (extrasize / 2);
}
var extra_info = '<i>No info to show</i>';
var extra_show = false;
$('#extra_'+graph_id).css('left',left_pos);
$('#extra_'+graph_id).css('top',plot.offset().top + 25);
var coord_x = (item.dataIndex/item.series.xaxis.datamax)* (event.target.clientWidth - event.target.offsetLeft + 1) + event.target.offsetLeft;
$('#extra_'+graph_id).css('left',coord_x);
$('#extra_'+graph_id).css('top', event.target.offsetTop + 55 );
switch(item.series.label) {
case legend_alerts+series_suffix_str:

View File

@ -337,7 +337,7 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend,
}
foreach ($chart_data as $label => $values) {
$labels[] = io_safe_output($label);
$labels[] = $label;
foreach($values as $key => $value) {
$jsvar = "data_" . $graph_id . "_" . $key;
@ -716,7 +716,7 @@ function flot_hcolumn_chart ($graph_data, $width, $height, $water_mark, $font =
$data = array();
foreach ($graph_data as $label => $values) {
$labels[] = io_safe_output($label);
$labels[] = $label;
$i--;
foreach ($values as $key => $value) {
@ -818,7 +818,7 @@ function flot_vcolumn_chart ($graph_data, $width, $height, $color, $legend, $lon
$max = 0;
$i = count($graph_data);
foreach ($graph_data as $label => $values) {
$labels[] = io_safe_output($label);
$labels[] = $label;
$i--;
foreach ($values as $key => $value) {
@ -942,7 +942,7 @@ function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $
$c = 0;
$acumulate_data = array();
foreach ($graph_data as $label => $values) {
$labels[] = io_safe_output($label);
$labels[] = $label;
$i--;
foreach ($values as $key => $value) {

View File

@ -0,0 +1,148 @@
<?php
/*
* @package Include/help/es/
*/
?>
<style type="text/css">
* {
font-family: 'lato-bolder';
font-size: 1em;
}
img.hlp_graphs {
width: 80%;
max-width: 800px;
min-width: 400px;
margin: 15px auto;
display: block;
}
ul.clean {
list-style-type: none;
}
p,u,i,b {
font-family: 'lato-bolder';
}
b {
font-size: 0.90em!important;
}
dl dt {
margin-top: 1em;
font-weight: bold;
}
dl {
margin-bottom: 2em;
}
div.img_title {
text-align: center;
font-size: 0.8em;
font-style: italic;
width: 100%;
margin-top: 4em;
}
</style>
<body class="hlp_graphs">
<h1>INTERPRETING GHRAPHS IN PANDORA FMS</h1>
<p>In Pandora FMS, graphs represent the values a module has had during a given period.</p>
<p>Due to the large amount of data that Pandora FMS stores, two different types of functionality are offered</p>
<h2>NORMAL GRAPHS</h2>
<img class="hlp_graphs" src="<?php echo $config["homeurl"];?>images/help/chart_normal_sample.png" alt="regular chart sample" />
<h4>General characteristics</h4>
<p>These are graphs that represent the information stored by the module at a basic level.</p>
<p>They allow us to see an approximation of the values in which our module oscillates.</p>
<p>The module data are divided into <i>boxes</i> in such a way that a sample of the module values is represented, <b>not all values are shown</b>. This is complemented by dividing the view into three graphs, <b>Max</b> (maximum values), <b>min</b> (minimum values) and <b>avg</b> (average values)</p>
<ul class="clean">
<li><b>Advantages</b>: They are generated very quickly without consuming hardly any resources.</li>
<li><b>Disadvantages</b>: The information provided is approximate. The status of the monitors they represent are calculated on an event-driven basis.</li>
<h4>Display options</h4>
<dl>
<dt>Refresh time</dt>
<dd>Time the graph will take to be created again.</dd>
<dt>Avg. Only</dt>
<dd>Only the averages graph will be created.</dd>
<dt>Starting date</dt>
<dd>Date until which the graphic will be created.</dd>
<dt>Startup time</dt>
<dd>Hour minutes and seconds until the graphic is created.</dd>
<dt>Zoom factor</dt>
<dd>Graph viewfinder size, multiplicative.</dd>
<dt>Time Range</dt>
<dd>Sets the time period from which data will be collected.</dd>
<dt>Show events</dt>
<dd>Displays indicator points with event information at the top.</dd>
<dt>Show alerts</dt>
<dd>Shows indicator points with triggered alert information at the top.</dd>
<dt>Show percentile</dt>
<dd>Adds a graph that indicates the percentile line (configurable in general visual options of Pandora).</dd>
<dt>Time comparison (superimposed)</dt>
<dd>Displays the same graphic overlay, but in the period before the selected one. For example, if we request a period of one week and activate this option, the week before the chosen one will also be shown superimposed.</dd>
<dt>Time comparison (independent)</dt>
<dd>Displays the same graph, but in the period before the selected one, in a separate area. For example, if we request a period of one week and activate this option, the week before the chosen one will also be shown.</dd>
<dt>Display unknown graphic</dt>
<dd>It shows boxes in grey shading covering the periods in which Pandora FMS cannot guarantee the module's status, either due to data loss, disconnection of a software agent, etc.</dd>
<dt>Show Full Scale Graph (TIP)</dt>
<dd>Switches the creation mode from "normal" to "TIP". In this mode, the graphs will show real data rather than approximations, so the time it will take to generate them will be longer. More detailed information on this type of graphs can be found in the following section.</dd>
</dl>
<br />
<br />
<h2>TIP GRAPS</h2>
<img class="hlp_graphs "src="<?php echo $config["homeurl"];?>images/help/chart_tip_sample.png" alt="TIP chart sample" />
<h4>General characteristics</h4>
<p>These are graphs that represent <b>real data</b>.</p>
<p>They show us a true representation of the data reported by our module.</p>
<p>As these are real data, it will not be necessary to supplement the information with extra graphs (avg, min, max).</p>
<p>The calculation of periods in unknown state is supported by events, such as normal graphs, but is complemented by extra detection if there is any.</p>
<p>Examples of resolution offered by normal and TIP methods:</p>
<div class="img_title">Example of normal graph in unknown interval</div>
<img class="hlp_graphs "src="<?php echo $config["homeurl"];?>images/help/chart_normal_detail.png" alt="TIP chart detail" />
<div class="img_title">Example of TIP graph in unknown interval</div>
<img class="hlp_graphs "src="<?php echo $config["homeurl"];?>images/help/chart_tip_detail.png" alt="TIP chart detail" />
<br />
<ul class="clean">
<li><b>Advantages</b>: The data represented are real data. This is the most realistic way to review module data.</li>
<li><b>Disadvantages</b>: Processing is slower than in normal graphs. Depending on the time range and the volume of data to be displayed, your display may be less fluid.</li>
</ul>
</body>

View File

@ -0,0 +1,148 @@
<?php
/*
* @package Include/help/es/
*/
?>
<style type="text/css">
* {
font-family: 'lato-bolder';
font-size: 1em;
}
img.hlp_graphs {
width: 80%;
max-width: 800px;
min-width: 400px;
margin: 15px auto;
display: block;
}
ul.clean {
list-style-type: none;
}
p,u,i,b {
font-family: 'lato-bolder';
}
b {
font-size: 0.90em!important;
}
dl dt {
margin-top: 1em;
font-weight: bold;
}
dl {
margin-bottom: 2em;
}
div.img_title {
text-align: center;
font-size: 0.8em;
font-style: italic;
width: 100%;
margin-top: 4em;
}
</style>
<body class="hlp_graphs">
<h1>Interpretar las gr&aacute;ficas en Pandora FMS</h1>
<p>Las gr&aacute;ficas en Pandora representan los valores que un m&oacute;dulo ha tenido a lo largo de un período.</p>
<p>Debido a la gran cantidad de datos que Pandora FMS almacena, se ofrecen dos tipos diferentes de funcionalidad:</p>
<h2>Gr&aacute;ficas Normales</h2>
<img class="hlp_graphs" src="<?php echo $config["homeurl"];?>images/help/chart_normal_sample.png" alt="regular chart sample" />
<h4>Caracter&iacute;sticas generales</h4>
<p>Son gr&aacute;ficas que representan la informaci&oacute;n almacenada por el m&oacute;dulo a un nivel b&aacute;sico.</p>
<p>Nos permite ver una aproximaci&oacute;n de los valores en los que oscila nuestro m&oacute;dulo.</p>
<p>Dividen los datos del m&oacute;dulo en <i>cajas</i> de tal manera que se representa una muestra de los valores del m&oacute;dulo, <b>no se pintan todos los valores</b>. Esta carencia se complementa dividiendo la vista en tres gr&aacute;ficas, <b>Max</b> (valores m&aacute;ximos), <b>min</b> (valores m&iacute;nimos) y <b>avg</b> (valores promedios)</p>
<ul class="clean">
<li><b>Ventajas</b>: Se generan muy r&aacute;pidamente sin consumir apenas recursos.</li>
<li><b>Inconvenientes</b>: La informaci&oacute;n que proveen es aproximada. Los estados de los monitores que representan se calculan en base a eventos.</li>
<h4>Opciones de visualizaci&oacute;n</h4>
<dl>
<dt>Tiempo de refresco</dt>
<dd>Tiempo en que se pintar&aacute; la gr&aacute;fica de nuevo.</dd>
<dt>Avg. Only</dt>
<dd>Solo se pintar&aacute; la gr&aacute;fica de promedios.</dd>
<dt>Fecha de inicio</dt>
<dd>Fecha hasta la que se pintar&aacute; la gr&aacute;fica.</dd>
<dt>Tiempo de inicio</dt>
<dd>Hora minutos y segundos hasta los que se pintar&aacute; la gr&aacute;fica.</dd>
<dt>Factor de zoom</dt>
<dd>Tama&ntilde;o del visor de la gr&aacute;fica, multiplicativo.</dd>
<dt>Rango de tiempo</dt>
<dd>Establece el per&iacute;odo de tiempo desde el que se recoger&aacute;n los datos.</dd>
<dt>Mostrar eventos</dt>
<dd>Muestra puntos indicadores con la informaci&oacute;n de eventos en la parte superior.</dd>
<dt>Mostrar alertas</dt>
<dd>Muestra puntos indicadores con la informaci&oacute;n de alertas disparadas en la parte superior.</dd>
<dt>Mostrar percentil</dt>
<dd>Agrega una gr&aacute;fica que indica la l&iacute;nea del percentil (configurable en opciones visuales generales de Pandora).</dd>
<dt>Comparaci&oacute;n de tiempo (superpuesto)</dt>
<dd>Muestra superpuesta la misma gr&aacute;fica, pero en el per&iacute;odo anterior al seleccionado. Por ejemplo, si solicitamos un per&iacute;odo de una semana y activamos esta opci&oacute;n, la semana anterior a la elegida tambi&eacute;n se mostrar&aacute; superpuesta.</dd>
<dt>Comparaci&oacute;n de tiempo (independiente)</dt>
<dd>Muestra la misma gr&aacute;fica, pero en el per&iacute;odo anterior al seleccionado, en un area independiente. Por ejemplo, si solicitamos un per&iacute;odo de una semana y activamos esta opci&oacute;n, la semana anterior a la elegida tambi&eacute;n se mostrar&aacute;.</dd>
<dt>Mostrar gr&aacute;fica de desconocidos</dt>
<dd>Muestra cajas en sombreado gris cubriendo los per&iacute;odos en que Pandora FMS no puede garantizar el estado del m&oacute;dulo, ya sea por p&eacute;rdida de datos, desconexi&oacute;n de un agente software, etc.</dd>
<dt>Mostrar gr&aacute;fica de escala completa (TIP)</dt>
<dd>Cambia el modo de pintado de "normal" a "TIP". En este modo, las gr&aacute;ficas mostrar&aacute;n datos reales en vez de aproximaciones, por lo que el tiempo que emplear&aacute;n para su generaci&oacute;n ser&aacute; mayor. Podr&aacute; encontrar informaci&oacute;n m&aacute;s detallada de este tipo de gr&aacute;ficas en el siguiente apartado.</dd>
</dl>
<br />
<br />
<h2>Gr&aacute;ficas TIP</h2>
<img class="hlp_graphs "src="<?php echo $config["homeurl"];?>images/help/chart_tip_sample.png" alt="TIP chart sample" />
<h4>Caracter&iacute;sticas generales</h4>
<p>Son gr&aacute;ficas que representan <b>datos reales</b>.</p>
<p>Nos muestra una representaci&oacute;n veraz de los datos reportados por nuestro m&oacute;dulo.</p>
<p>Al ser datos reales no ser&aacute; necesario complementar la informaci&oacute;n con gr&aacute;ficas extra (avg,min,max).</p>
<p>El c&aacute;lculo de per&iacute;odos en estado desconocido se apoya en eventos, tal y como funcionan las gr&aacute;ficas normales, pero se complementa con una detecci&oacute;n extra en caso de haberlos.</p>
<p>Ejemplos de resoluci&oacute;n ofrecidas por metodos normal y TIP:</p>
<div class="img_title">Ejemplo de gr&aacute;fica normal en intervalo desconocido</div>
<img class="hlp_graphs "src="<?php echo $config["homeurl"];?>images/help/chart_normal_detail.png" alt="TIP chart detail" />
<div class="img_title">Ejemplo de gr&aacute;fica TIP en intervalo desconocido</div>
<img class="hlp_graphs "src="<?php echo $config["homeurl"];?>images/help/chart_tip_detail.png" alt="TIP chart detail" />
<br />
<ul class="clean">
<li><b>Ventajas</b>: Los datos representados son datos reales. Es la forma m&aacute;s realista de revisar los datos de un m&oacute;dulo.</li>
<li><b>Inconvenientes</b>: Su procesado es m&aacute;s lento que en las gr&aacute;ficas normales. Dependiendo del rango de tiempo y el volumen de datos a mostrar es posible que su visualizaci&oacute;n sea menos flu&iacute;da.</li>
</ul>
</body>

View File

@ -0,0 +1,148 @@
<?php
/*
* @package Include/help/es/
*/
?>
<style type="text/css">
* {
font-family: 'lato-bolder';
font-size: 1em;
}
img.hlp_graphs {
width: 80%;
max-width: 800px;
min-width: 400px;
margin: 15px auto;
display: block;
}
ul.clean {
list-style-type: none;
}
p,u,i,b {
font-family: 'lato-bolder';
}
b {
font-size: 0.90em!important;
}
dl dt {
margin-top: 1em;
font-weight: bold;
}
dl {
margin-bottom: 2em;
}
div.img_title {
text-align: center;
font-size: 0.8em;
font-style: italic;
width: 100%;
margin-top: 4em;
}
</style>
<body class="hlp_graphs">
<h1>INTERPRETING GHRAPHS IN PANDORA FMS</h1>
<p>In Pandora FMS, graphs represent the values a module has had during a given period.</p>
<p>Due to the large amount of data that Pandora FMS stores, two different types of functionality are offered</p>
<h2>NORMAL GRAPHS</h2>
<img class="hlp_graphs" src="<?php echo $config["homeurl"];?>images/help/chart_normal_sample.png" alt="regular chart sample" />
<h4>General characteristics</h4>
<p>These are graphs that represent the information stored by the module at a basic level.</p>
<p>They allow us to see an approximation of the values in which our module oscillates.</p>
<p>The module data are divided into <i>boxes</i> in such a way that a sample of the module values is represented, <b>not all values are shown</b>. This is complemented by dividing the view into three graphs, <b>Max</b> (maximum values), <b>min</b> (minimum values) and <b>avg</b> (average values)</p>
<ul class="clean">
<li><b>Advantages</b>: They are generated very quickly without consuming hardly any resources.</li>
<li><b>Disadvantages</b>: The information provided is approximate. The status of the monitors they represent are calculated on an event-driven basis.</li>
<h4>Display options</h4>
<dl>
<dt>Refresh time</dt>
<dd>Time the graph will take to be created again.</dd>
<dt>Avg. Only</dt>
<dd>Only the averages graph will be created.</dd>
<dt>Starting date</dt>
<dd>Date until which the graphic will be created.</dd>
<dt>Startup time</dt>
<dd>Hour minutes and seconds until the graphic is created.</dd>
<dt>Zoom factor</dt>
<dd>Graph viewfinder size, multiplicative.</dd>
<dt>Time Range</dt>
<dd>Sets the time period from which data will be collected.</dd>
<dt>Show events</dt>
<dd>Displays indicator points with event information at the top.</dd>
<dt>Show alerts</dt>
<dd>Shows indicator points with triggered alert information at the top.</dd>
<dt>Show percentile</dt>
<dd>Adds a graph that indicates the percentile line (configurable in general visual options of Pandora).</dd>
<dt>Time comparison (superimposed)</dt>
<dd>Displays the same graphic overlay, but in the period before the selected one. For example, if we request a period of one week and activate this option, the week before the chosen one will also be shown superimposed.</dd>
<dt>Time comparison (independent)</dt>
<dd>Displays the same graph, but in the period before the selected one, in a separate area. For example, if we request a period of one week and activate this option, the week before the chosen one will also be shown.</dd>
<dt>Display unknown graphic</dt>
<dd>It shows boxes in grey shading covering the periods in which Pandora FMS cannot guarantee the module's status, either due to data loss, disconnection of a software agent, etc.</dd>
<dt>Show Full Scale Graph (TIP)</dt>
<dd>Switches the creation mode from "normal" to "TIP". In this mode, the graphs will show real data rather than approximations, so the time it will take to generate them will be longer. More detailed information on this type of graphs can be found in the following section.</dd>
</dl>
<br />
<br />
<h2>TIP GRAPS</h2>
<img class="hlp_graphs "src="<?php echo $config["homeurl"];?>images/help/chart_tip_sample.png" alt="TIP chart sample" />
<h4>General characteristics</h4>
<p>These are graphs that represent <b>real data</b>.</p>
<p>They show us a true representation of the data reported by our module.</p>
<p>As these are real data, it will not be necessary to supplement the information with extra graphs (avg, min, max).</p>
<p>The calculation of periods in unknown state is supported by events, such as normal graphs, but is complemented by extra detection if there is any.</p>
<p>Examples of resolution offered by normal and TIP methods:</p>
<div class="img_title">Example of normal graph in unknown interval</div>
<img class="hlp_graphs "src="<?php echo $config["homeurl"];?>images/help/chart_normal_detail.png" alt="TIP chart detail" />
<div class="img_title">Example of TIP graph in unknown interval</div>
<img class="hlp_graphs "src="<?php echo $config["homeurl"];?>images/help/chart_tip_detail.png" alt="TIP chart detail" />
<br />
<ul class="clean">
<li><b>Advantages</b>: The data represented are real data. This is the most realistic way to review module data.</li>
<li><b>Disadvantages</b>: Processing is slower than in normal graphs. Depending on the time range and the volume of data to be displayed, your display may be less fluid.</li>
</ul>
</body>

View File

@ -106,13 +106,11 @@ $alias = db_get_value ("alias","tagente","id_agente",$id_agent);
</head>
<body bgcolor="#ffffff" style='background:#ffffff;'>
<?php
// Module id
$id = (int) get_parameter ("id", 0);
// Agent id
$agent_id = (int) modules_get_agentmodule_agent($id);
// Kind module
$type_module = modules_get_agentmodule_kind($id);
if (empty($id) || empty($agent_id)) {
ui_print_error_message(__('There was a problem locating the source of the graph'));
@ -171,7 +169,6 @@ $alias = db_get_value ("alias","tagente","id_agente",$id_agent);
$time_compare_overlapped = get_parameter ("time_compare_overlapped", 0);
$unknown_graph = get_parameter_checkbox ("unknown_graph", 1);
//$type_module == 'predictionserver';
$fullscale_sent = get_parameter ("fullscale_sent", 0);
if(!$fullscale_sent){
if(!isset($config['full_scale_option']) || $config['full_scale_option'] == 0){
@ -289,7 +286,7 @@ $alias = db_get_value ("alias","tagente","id_agente",$id_agent);
$params = array();
// TOP TEXT
//Use the no_meta parameter because this image is only in the base console
$params['top_text'] = "<div style='color: white; width: 100%; text-align: center; font-weight: bold; vertical-align: top;'>" . html_print_image('images/wrench_blanco.png', true, array('width' => '16px'), false, false, true) . ' ' . __('Pandora FMS Graph configuration menu') . "</div>";
$params['top_text'] = "<div style='color: white; width: 100%; text-align: center; font-weight: bold; vertical-align: top;'>" . html_print_image('images/wrench_blanco.png', true, array('width' => '16px'), false, false, true) . ' ' . __('Pandora FMS Graph configuration menu') . ui_print_help_icon ("graphs",true, $config["homeurl"], "images/help_w.png") . "</div>";
$params['body_text'] = "<div class='menu_sidebar_outer'>";
$params['body_text'] .=__('Please, make your changes and apply with the <i>Reload</i> button');
@ -423,14 +420,12 @@ $alias = db_get_value ("alias","tagente","id_agente",$id_agent);
break;
}
if($type_module != 'predictionserver'){
$data = array();
$data[0] = __('Show full scale graph (TIP)');
$data[1] = html_print_checkbox ("fullscale", 1, (bool) $fullscale,
true, false);
$table->data[] = $data;
$table->rowclass[] = '';
}
$data = array();
$data[0] = __('Show full scale graph (TIP)');
$data[1] = html_print_checkbox ("fullscale", 1, (bool) $fullscale,
true, false);
$table->data[] = $data;
$table->rowclass[] = '';
$form_table = html_print_table($table, true);