mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 16:24:54 +02:00
Changed the agent name by its alias and fixed the exception reporting item
This commit is contained in:
parent
289549a49f
commit
2f3053ebbd
@ -1867,6 +1867,7 @@ function reporting_exception($report, $content, $type = 'dinamic',
|
|||||||
$max = $min;
|
$max = $min;
|
||||||
$avg = 0;
|
$avg = 0;
|
||||||
|
|
||||||
|
$items = array();
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ($exceptions as $exc) {
|
foreach ($exceptions as $exc) {
|
||||||
@ -1880,10 +1881,10 @@ function reporting_exception($report, $content, $type = 'dinamic',
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$ag_name = modules_get_agentmodule_agent_name ($exc ['id_agent_module']);
|
$ag_name = modules_get_agentmodule_agent_name($exc['id_agent_module']);
|
||||||
$mod_name = modules_get_agentmodule_name ($exc ['id_agent_module']);
|
$ag_alias = modules_get_agentmodule_agent_alias($exc['id_agent_module']);
|
||||||
$unit = db_get_value('unit', 'tagente_modulo',
|
$mod_name = modules_get_agentmodule_name($exc['id_agent_module']);
|
||||||
'id_agente_modulo', $exc['id_agent_module']);
|
$unit = db_get_value('unit', 'tagente_modulo', 'id_agente_modulo', $exc['id_agent_module']);
|
||||||
|
|
||||||
if ($content['period'] == 0) {
|
if ($content['period'] == 0) {
|
||||||
$value =
|
$value =
|
||||||
@ -1954,18 +1955,21 @@ function reporting_exception($report, $content, $type = 'dinamic',
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$i++;
|
$item = array();
|
||||||
$data_exceptions[] = $value;
|
$item['value'] = $value;
|
||||||
$id_agent_module[] = $exc['id_agent_module'];
|
$item['module_id'] = $exc['id_agent_module'];
|
||||||
$agent_name[] = $ag_name;
|
$item['module'] = $mod_name;
|
||||||
$module_name[] = $mod_name;
|
$item['agent'] = $ag_alias;
|
||||||
$units[] = $unit;
|
$item['unit'] = $unit;
|
||||||
if ($exc['operation'] == 'avg') {
|
if ($exc['operation'] == 'avg') {
|
||||||
$operation[] = "rate";
|
$item['operation'] = "rate";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$operation[] = $exc['operation'];
|
$item['operation'] = $exc['operation'];
|
||||||
}
|
}
|
||||||
|
$items[] = $item;
|
||||||
|
|
||||||
|
$i++;
|
||||||
}
|
}
|
||||||
//Restore dbconnection
|
//Restore dbconnection
|
||||||
if (($config ['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) {
|
if (($config ['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) {
|
||||||
@ -2008,64 +2012,62 @@ function reporting_exception($report, $content, $type = 'dinamic',
|
|||||||
else {
|
else {
|
||||||
$avg = $avg / $i;
|
$avg = $avg / $i;
|
||||||
|
|
||||||
switch ($order_uptodown) {
|
// Sort the items
|
||||||
//Order descending
|
$sort_number = function ($a, $b, $sort = SORT_ASC) {
|
||||||
case 1:
|
if ($a == $b) return 0;
|
||||||
array_multisort($data_exceptions, SORT_DESC,
|
else if ($a > $b) return ($sort === SORT_ASC) ? 1 : -1;
|
||||||
$agent_name, SORT_ASC, $module_name, SORT_ASC,
|
else return ($sort === SORT_ASC) ? -1 : 1;
|
||||||
$id_agent_module, SORT_ASC);
|
};
|
||||||
break;
|
$sort_string = function ($a, $b, $sort = SORT_ASC) {
|
||||||
//Order ascending
|
if ($sort === SORT_ASC) return strcasecmp($a, $b);
|
||||||
case 2:
|
else return strcasecmp($b, $a);
|
||||||
array_multisort($data_exceptions, SORT_ASC,
|
};
|
||||||
$agent_name, SORT_ASC, $module_name, SORT_ASC,
|
usort($items, function($a, $b) use ($order_uptodown, $sort_number, $sort_string) {
|
||||||
$id_agent_module, SORT_ASC);
|
switch ($order_uptodown) {
|
||||||
break;
|
case 1:
|
||||||
//Order by agent name or without selection
|
case 2:
|
||||||
case 0:
|
if ($a['value'] == $b['value']) {
|
||||||
case 3:
|
if ($a['agent'] == $b['agent']) {
|
||||||
array_multisort($agent_name, SORT_ASC,
|
if ($a['module'] == $b['module']) {
|
||||||
$data_exceptions, SORT_ASC, $module_name,
|
return $sort_number($a['module_id'], $b['module_id']);
|
||||||
SORT_ASC, $id_agent_module, SORT_ASC);
|
}
|
||||||
break;
|
return $sort_string($a['module'], $b['module']);
|
||||||
}
|
}
|
||||||
|
return $sort_string($a['agent'], $b['agent']);
|
||||||
if ($order_uptodown == 1 || $order_uptodown == 2) {
|
}
|
||||||
$j = 0;
|
return $sort_number($a['value'], $b['value'], ($order_uptodown == 1) ? SORT_DESC : SORT_ASC);
|
||||||
$data_pie_graph = array();
|
//Order by agent name or without selection
|
||||||
$data_hbar = array();
|
case 0:
|
||||||
foreach ($data_exceptions as $dex) {
|
case 3:
|
||||||
$data_hbar[$agent_name[$j]]['g'] = $dex;
|
if ($a['agent'] == $b['agent']) {
|
||||||
$data_pie_graph[$agent_name[$j]] = $dex;
|
if ($a['value'] == $b['value']) {
|
||||||
if ($show_graph == 0 || $show_graph == 1) {
|
if ($a['module'] == $b['module']) {
|
||||||
$data = array();
|
return $sort_number($a['module_id'], $b['module_id']);
|
||||||
$data['agent'] = $agent_name[$j];
|
}
|
||||||
$data['module'] = $module_name[$j];
|
return $sort_string($a['module'], $b['module']);
|
||||||
$data['operation'] = __($operation[$j]);
|
}
|
||||||
$data['value'] = $dex;
|
return $sort_number($a['value'], $b['value']);
|
||||||
$data['formated_value'] = format_for_graph($dex, 2) . " " . $units[$j];
|
}
|
||||||
$return['data'][] = $data;
|
return $sort_string($a['agent'], $b['agent']);
|
||||||
}
|
|
||||||
$j++;
|
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
else if ($order_uptodown == 0 || $order_uptodown == 3) {
|
|
||||||
$j = 0;
|
$data_pie_graph = array();
|
||||||
$data_pie_graph = array();
|
$data_hbar = array();
|
||||||
$data_hbar = array();
|
foreach ($items as $key => $item) {
|
||||||
foreach ($agent_name as $an) {
|
if ($show_graph == 1 || $show_graph == 2) {
|
||||||
$data_hbar[$an]['g'] = $data_exceptions[$j];
|
// TODO: Find a better way to show the graphs
|
||||||
$data_pie_graph[$an] = $data_exceptions[$j];
|
$data_hbar[$item['agent'] . ' - ' . $item['operation']]['g'] = $item['value'];
|
||||||
if ($show_graph == 0 || $show_graph == 1) {
|
$data_pie_graph[$item['agent'] . ' - ' . $item['operation']] = $item['value'];
|
||||||
$data = array();
|
}
|
||||||
$data['agent'] = $an;
|
if ($show_graph == 0 || $show_graph == 1) {
|
||||||
$data['module'] = $module_name[$j];
|
$data = array();
|
||||||
$data['operation'] = __($operation[$j]);
|
$data['agent'] = $item['agent'];
|
||||||
$data['value'] = $data_exceptions[$j];
|
$data['module'] = $item['module'];
|
||||||
$data['formated_value'] = format_for_graph($data_exceptions[$j], 2) . " " . $units[$j];
|
$data['operation'] = __($item['operation']);
|
||||||
$return['data'][] = $data;
|
$data['value'] = $item['value'];
|
||||||
}
|
$data['formated_value'] = format_for_graph($item['value'], 2) . " " . $item['unit'];
|
||||||
$j++;
|
$return['data'][] = $data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user