2014-03-13 Ramon Novoa <rnovoa@artica.es>
* include/functions_netflow.php: Improved version detection. Some distros append alphanumeric character to the version number. * include/functions_reporting.php: Fixed SLA bars. Unknown intervals were not properly computed. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@9584 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
624ae93829
commit
5787f7d97e
|
@ -1,3 +1,11 @@
|
||||||
|
2014-03-13 Ramon Novoa <rnovoa@artica.es>
|
||||||
|
|
||||||
|
* include/functions_netflow.php: Improved version detection. Some distros
|
||||||
|
append alphanumeric character to the version number.
|
||||||
|
|
||||||
|
* include/functions_reporting.php: Fixed SLA bars. Unknown intervals were
|
||||||
|
not properly computed.
|
||||||
|
|
||||||
2014-03-13 Miguel de Dios <miguel.dedios@artica.es>
|
2014-03-13 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
* include/functions_visual_map.php: fixed the link of other visual
|
* include/functions_visual_map.php: fixed the link of other visual
|
||||||
|
|
|
@ -1371,7 +1371,7 @@ function netflow_check_nfdump_binary ($nfdump_binary) {
|
||||||
|
|
||||||
$matches = array();
|
$matches = array();
|
||||||
foreach ($output as $line) {
|
foreach ($output as $line) {
|
||||||
if (preg_match ('/Version:\s*(\d+)\.(\d+)\.(\d+)/', $line, $matches) === 1) {
|
if (preg_match ('/Version:[^\d]+(\d+)\.(\d+)\.(\d+)/', $line, $matches) === 1) {
|
||||||
if ($matches[1] < 1) {
|
if ($matches[1] < 1) {
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
|
@ -679,7 +679,6 @@ function reporting_get_agentmodule_sla_array ($id_agent_module, $period = 0, $mi
|
||||||
array ('id_agentmodule' => $id_agent_module,
|
array ('id_agentmodule' => $id_agent_module,
|
||||||
"utimestamp > $datelimit",
|
"utimestamp > $datelimit",
|
||||||
"utimestamp < $date",
|
"utimestamp < $date",
|
||||||
"event_type" => 'going_unknown',
|
|
||||||
'order' => 'utimestamp ASC'),
|
'order' => 'utimestamp ASC'),
|
||||||
array ('id_evento', 'evento', 'timestamp', 'utimestamp', 'event_type'));
|
array ('id_evento', 'evento', 'timestamp', 'utimestamp', 'event_type'));
|
||||||
|
|
||||||
|
@ -688,9 +687,27 @@ function reporting_get_agentmodule_sla_array ($id_agent_module, $period = 0, $mi
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add unknown periods to data
|
// Add unknown periods to data
|
||||||
foreach($events_unknown as $eu) {
|
for ($i = 0; isset($events_unknown[$i]); $i++) {
|
||||||
$interval_data_indexed[$eu['utimestamp']]['data'] = 0;
|
$eu = $events_unknown[$i];
|
||||||
$interval_data_indexed[$eu['utimestamp']]['status'] = 4;
|
|
||||||
|
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
|
// Get the last event before inverval to know if graph start on unknown
|
||||||
|
@ -707,21 +724,35 @@ function reporting_get_agentmodule_sla_array ($id_agent_module, $period = 0, $mi
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
|
|
||||||
//-----------------Set limits of the interval-----------------------
|
//-----------------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;
|
||||||
|
}
|
||||||
|
elseif (($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 the starting of the graph is unknown we set it
|
||||||
if ($start_unknown) {
|
if ($start_unknown) {
|
||||||
$interval_data_indexed[$datelimit]['data'] = 0;
|
$interval_data_indexed[$datelimit]['data'] = 0;
|
||||||
$interval_data_indexed[$datelimit]['status'] = 4;
|
$interval_data_indexed[$datelimit]['status'] = 4;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// 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 ) {
|
if ($previous_data !== false ) {
|
||||||
$interval_data_indexed[$datelimit]['data'] = $previous_data['datos'];
|
$interval_data_indexed[$datelimit]['data'] = $previous_data['datos'];
|
||||||
}
|
}
|
||||||
else { // If there are not data befor interval set unknown
|
else { // If there are not data befor interval set unknown
|
||||||
$interval_data_indexed[$datelimit]['data'] = 0;
|
$interval_data_indexed[$datelimit]['data'] = 0;
|
||||||
$interval_data_indexed[$datelimit]['status'] = 4;
|
$interval_data_indexed[$datelimit]['status'] = 4;
|
||||||
|
$previous_known_status = 1; // Assume the module was in normal status if there is no previous data.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -832,10 +863,15 @@ function reporting_get_agentmodule_sla_array ($id_agent_module, $period = 0, $mi
|
||||||
foreach ($interval_data_indexed as $utimestamp => $data) {
|
foreach ($interval_data_indexed as $utimestamp => $data) {
|
||||||
$change = false;
|
$change = false;
|
||||||
$value = $data['data'];
|
$value = $data['data'];
|
||||||
//~ $value = $data['datos'];
|
if (isset($data['status'])) {
|
||||||
//$utimestamp = $data['utimestamp'];
|
// Leaving unkown status.
|
||||||
if (isset($data['status'])) { // 4 for the Unknown value amd 5 for planned downtime
|
if ($data['status'] == 6) {
|
||||||
$status = $data['status'];
|
$status = $previous_known_status;
|
||||||
|
}
|
||||||
|
// 4 unknown, 5 planned downtime.
|
||||||
|
else {
|
||||||
|
$status = $data['status'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
elseif ((($value > ($min_value - $percent)) && ($value < ($min_value + $percent))) ||
|
elseif ((($value > ($min_value - $percent)) && ($value < ($min_value + $percent))) ||
|
||||||
(($value > ($max_value - $percent)) && ($value < ($max_value + $percent)))) { //2 when value is within the edges
|
(($value > ($max_value - $percent)) && ($value < ($max_value + $percent)))) { //2 when value is within the edges
|
||||||
|
@ -856,6 +892,11 @@ function reporting_get_agentmodule_sla_array ($id_agent_module, $period = 0, $mi
|
||||||
$previous_status = $status;
|
$previous_status = $status;
|
||||||
$previous_utimestamp = $utimestamp;
|
$previous_utimestamp = $utimestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Save the last known status.
|
||||||
|
if ($status <= 3) {
|
||||||
|
$previous_known_status = $status;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ($change == false) {
|
if ($change == false) {
|
||||||
$data_colors[$i]['data'] = $previous_status;
|
$data_colors[$i]['data'] = $previous_status;
|
||||||
|
|
Loading…
Reference in New Issue