mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-30 17:25:26 +02:00
#11494 Fix service level detail function
This commit is contained in:
parent
0140183ae4
commit
750b318a2e
@ -4784,6 +4784,7 @@ function service_level_module_data($datetime_from, $datetime_to, $id_agentmodule
|
|||||||
$data['availability'] = false;
|
$data['availability'] = false;
|
||||||
|
|
||||||
$availability = 0;
|
$availability = 0;
|
||||||
|
$type = '';
|
||||||
|
|
||||||
$uncompressed_data = db_uncompress_module_data(
|
$uncompressed_data = db_uncompress_module_data(
|
||||||
$id_agentmodule,
|
$id_agentmodule,
|
||||||
@ -4796,6 +4797,10 @@ function service_level_module_data($datetime_from, $datetime_to, $id_agentmodule
|
|||||||
foreach ($data_module['data'] as $subdata) {
|
foreach ($data_module['data'] as $subdata) {
|
||||||
if (!empty($subdata['datos'])) {
|
if (!empty($subdata['datos'])) {
|
||||||
$first_utimestamp = $subdata['utimestamp'];
|
$first_utimestamp = $subdata['utimestamp'];
|
||||||
|
if (isset($subdata['type'])) {
|
||||||
|
$type = $subdata['type'];
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4862,8 +4867,19 @@ function service_level_module_data($datetime_from, $datetime_to, $id_agentmodule
|
|||||||
}
|
}
|
||||||
|
|
||||||
// hd($availability, true);
|
// hd($availability, true);
|
||||||
|
if (count($mtbf_array) > 1) {
|
||||||
$mtbf = round(( $total_time_failed / count($mtbf_array)));
|
$mtbf = round(( $total_time_failed / count($mtbf_array)));
|
||||||
|
} else {
|
||||||
|
$mtbf = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count($mtrs_array) === 1 && (string) $first_utimestamp !== '0' && $type === 0) {
|
||||||
|
$mtrs = round($total_time_failed / count($mtrs_array));
|
||||||
|
} else if (count($mtrs_array) > 1 && (string) $first_utimestamp !== '0') {
|
||||||
$mtrs = round((array_sum($mtrs_array) / count($mtrs_array)));
|
$mtrs = round((array_sum($mtrs_array) / count($mtrs_array)));
|
||||||
|
} else {
|
||||||
|
$mtrs = false;
|
||||||
|
}
|
||||||
|
|
||||||
$data['mtbf'] = $mtbf;
|
$data['mtbf'] = $mtbf;
|
||||||
$data['mtrs'] = $mtrs;
|
$data['mtrs'] = $mtrs;
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Widget Clock Pandora FMS Console
|
* Widget Service Level Pandora FMS Console
|
||||||
*
|
*
|
||||||
* @category Console Class
|
* @category Console Class
|
||||||
* @package Pandora FMS
|
* @package Pandora FMS
|
||||||
* @subpackage Widget Clock
|
* @subpackage Widget Service Level
|
||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
* @license See below
|
* @license See below
|
||||||
*
|
*
|
||||||
@ -493,16 +493,9 @@ class ServiceLevelWidget extends Widget
|
|||||||
// Mean Time To Solution.
|
// Mean Time To Solution.
|
||||||
// Availability.
|
// Availability.
|
||||||
$module_data = service_level_module_data($interval_range['start'], $interval_range['end'], $data_module_array['id_agente_modulo']);
|
$module_data = service_level_module_data($interval_range['start'], $interval_range['end'], $data_module_array['id_agente_modulo']);
|
||||||
if ($module_data['mtrs'] !== false && $module_data['mtbf'] !== false && $module_data['availability'] !== false) {
|
$visualData[$agent_id]['modules'][$module->name()]['mtrs'] = ($module_data['mtrs'] !== false) ? human_milliseconds_to_string(($module_data['mtrs'] * 100), 'short') : '-';
|
||||||
$visualData[$agent_id]['modules'][$module->name()]['mtrs'] = human_milliseconds_to_string(($module_data['mtrs'] * 100), 'short');
|
$visualData[$agent_id]['modules'][$module->name()]['mtbf'] = ($module_data['mtbf'] !== false) ? human_milliseconds_to_string(($module_data['mtbf'] * 100), 'short') : '-';
|
||||||
$visualData[$agent_id]['modules'][$module->name()]['mtbf'] = human_milliseconds_to_string(($module_data['mtbf'] * 100), 'short');
|
$visualData[$agent_id]['modules'][$module->name()]['availability'] = ($module_data['availability'] !== false) ? $module_data['availability'] : '100';
|
||||||
$visualData[$agent_id]['modules'][$module->name()]['availability'] = $module_data['availability'];
|
|
||||||
} else {
|
|
||||||
$visualData[$agent_id]['modules'][$module->name()]['mtrs'] = '-';
|
|
||||||
$visualData[$agent_id]['modules'][$module->name()]['mtbf'] = '-';
|
|
||||||
$visualData[$agent_id]['modules'][$module->name()]['availability'] = '100';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Count events.
|
// Count events.
|
||||||
$sql = 'SELECT COUNT(*) as critical_events FROM tevento
|
$sql = 'SELECT COUNT(*) as critical_events FROM tevento
|
||||||
WHERE id_agentmodule= '.$data_module_array['id_agente_modulo'].'
|
WHERE id_agentmodule= '.$data_module_array['id_agente_modulo'].'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user