Fixed no function in pandora 6
This commit is contained in:
parent
c8189b1014
commit
35def77548
|
@ -284,7 +284,7 @@ if ($get_module_detail) {
|
|||
}
|
||||
else if (is_numeric($row[$attr[0]]) && !modules_is_string_type($row['module_type']) ) {
|
||||
|
||||
$data[] = (double) $row[$attr[0]];
|
||||
$data[] = remove_right_zeros(number_format($row[$attr[0]], $config['graph_precision']));
|
||||
}
|
||||
else {
|
||||
if ($row[$attr[0]] == '') {
|
||||
|
@ -854,7 +854,6 @@ if ($list_modules) {
|
|||
modules_get_status($module['id_agente_modulo'], $module['estado'],
|
||||
$module_value, $status, $title);
|
||||
|
||||
|
||||
$data[5] = ui_print_status_image($status, $title, true);
|
||||
if (!$show_context_help_first_time) {
|
||||
$show_context_help_first_time = true;
|
||||
|
@ -864,7 +863,6 @@ if ($list_modules) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
if ($module["id_tipo_modulo"] == 24) {
|
||||
// log4x
|
||||
switch($module["datos"]) {
|
||||
|
|
|
@ -344,10 +344,10 @@ switch ($action) {
|
|||
|
||||
$return = array();
|
||||
if ($returnValue_value[1] != "") {
|
||||
$return['value'] = number_format($returnValue_value[0], $config['graph_precision']) . " " . $returnValue_value[1];
|
||||
$return['value'] = remove_right_zeros(number_format($returnValue_value[0], $config['graph_precision'])) . " " . $returnValue_value[1];
|
||||
}
|
||||
else {
|
||||
$return['value'] = number_format($returnValue_value[0], $config['graph_precision']);
|
||||
$return['value'] = remove_right_zeros(number_format($returnValue_value[0], $config['graph_precision']));
|
||||
}
|
||||
$return['max_percentile'] = $layoutData['height'];
|
||||
$return['width_percentile'] = $layoutData['width'];
|
||||
|
|
|
@ -2654,4 +2654,9 @@ function pandora_setlocale() {
|
|||
setlocale(LC_ALL,
|
||||
str_replace(array_keys($replace_locale), $replace_locale, $user_language));
|
||||
}
|
||||
|
||||
function remove_right_zeros ($value) {
|
||||
$value_to_return = rtrim($value, "0");
|
||||
return rtrim($value_to_return, ".");
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -353,7 +353,7 @@ function reporting_html_SLA($table, $item, $mini) {
|
|||
$row = array();
|
||||
$row[] = $sla['agent'];
|
||||
$row[] = $sla['module'];
|
||||
$row[] = number_format($sla['max'], $config['graph_precision']) . " / " . number_format($sla['min'], $config['graph_precision']);
|
||||
$row[] = remove_right_zeros(number_format($sla['max'], $config['graph_precision'])) . " / " . remove_right_zeros(number_format($sla['min'], $config['graph_precision']));
|
||||
$row[] = round($sla['sla_limit'], 2) . "%";
|
||||
|
||||
if ($sla['sla_value_unknown']) {
|
||||
|
@ -380,7 +380,7 @@ function reporting_html_SLA($table, $item, $mini) {
|
|||
$row = array();
|
||||
$row[] = $sla['agent'];
|
||||
$row[] = $sla['module'];
|
||||
$row[] = number_format($sla['max'], $config['graph_precision']) . " / " . number_format($sla['min'], $config['graph_precision']);
|
||||
$row[] = remove_right_zeros(number_format($sla['max'], $config['graph_precision'])) . " / " . remove_right_zeros(number_format($sla['min'], $config['graph_precision']));
|
||||
$row[] = round($sla['sla_limit'], 2) . "%";
|
||||
|
||||
if ($sla['sla_value_unknown']) {
|
||||
|
@ -1509,13 +1509,13 @@ function reporting_html_monitor_report($table, $item, $mini) {
|
|||
'<p style="font: bold ' . $font_size . 'em Arial, Sans-serif; color: ' . COL_NORMAL . ';">';
|
||||
$table1->data['data']['ok'] .=
|
||||
html_print_image("images/module_ok.png", true) . ' ' .
|
||||
__('OK') . ': ' . number_format($item['data']["ok"]["formated_value"], $config['graph_precision']).' %</p>';
|
||||
__('OK') . ': ' . remove_right_zeros(number_format($item['data']["ok"]["formated_value"], $config['graph_precision'])).' %</p>';
|
||||
|
||||
$table1->data['data']['fail'] =
|
||||
'<p style="font: bold ' . $font_size . 'em Arial, Sans-serif; color: ' . COL_CRITICAL . ';">';
|
||||
$table1->data['data']['fail'] .=
|
||||
html_print_image("images/module_critical.png", true) . ' ' .
|
||||
__('Not OK') . ': ' . number_format($item['data']["fail"]["formated_value"], $config['graph_precision']) . ' % ' . '</p>';
|
||||
__('Not OK') . ': ' . remove_right_zeros(number_format($item['data']["fail"]["formated_value"], $config['graph_precision'])) . ' % ' . '</p>';
|
||||
}
|
||||
|
||||
$table->data['module']['cell'] = html_print_table($table1, true);
|
||||
|
@ -1753,10 +1753,10 @@ function reporting_html_availability(&$table, $item) {
|
|||
$table_row[] = $row['availability_item'];
|
||||
$table_row[] = $row['checks'];
|
||||
$table_row[] = $row['failed'];
|
||||
$table_row[] = number_format($row['fail'], $config['graph_precision']);
|
||||
$table_row[] = remove_right_zeros(number_format($row['fail'], $config['graph_precision']));
|
||||
$table_row[] = $row['poling_time'];
|
||||
$table_row[] = $row['time_unavaliable'];
|
||||
$table_row[] = number_format($row['ok'], $config['graph_precision']);
|
||||
$table_row[] = remove_right_zeros(number_format($row['ok'], $config['graph_precision']));
|
||||
}
|
||||
else {
|
||||
if ($item['date']['to'] > $the_first_men_time) {
|
||||
|
@ -1765,10 +1765,10 @@ function reporting_html_availability(&$table, $item) {
|
|||
$table_row[] = $row['availability_item'];
|
||||
$table_row[] = $row['checks'];
|
||||
$table_row[] = $row['failed'];
|
||||
$table_row[] = number_format($row['fail'], $config['graph_precision']);
|
||||
$table_row[] = remove_right_zeros(number_format($row['fail'], $config['graph_precision']));
|
||||
$table_row[] = $row['poling_time'];
|
||||
$table_row[] = $row['time_unavaliable'];
|
||||
$table_row[] = number_format($row['ok'], $config['graph_precision']);
|
||||
$table_row[] = remove_right_zeros(number_format($row['ok'], $config['graph_precision']));
|
||||
}
|
||||
else {
|
||||
$same_agent_in_resume = $row['agent'];
|
||||
|
@ -1818,10 +1818,10 @@ function reporting_html_availability(&$table, $item) {
|
|||
|
||||
$table1->data[] = array(
|
||||
'max_text' => $item['resume']['min_text'],
|
||||
'max' => number_format($item['resume']['max'], $config['graph_precision']) . "%",
|
||||
'avg' => number_format($item['resume']['avg'], $config['graph_precision']) . "%",
|
||||
'max' => remove_right_zeros(number_format($item['resume']['max'], $config['graph_precision'])) . "%",
|
||||
'avg' => remove_right_zeros(number_format($item['resume']['avg'], $config['graph_precision'])) . "%",
|
||||
'min_text' => $item['resume']['max_text'],
|
||||
'min' => number_format($item['resume']['min'], $config['graph_precision']) . "%"
|
||||
'min' => remove_right_zeros(number_format($item['resume']['min'], $config['graph_precision'])) . "%"
|
||||
);
|
||||
|
||||
$table->colspan[2][0] = 3;
|
||||
|
|
|
@ -1016,16 +1016,16 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
$returnValue_value = explode(' ', $value);
|
||||
|
||||
if ($returnValue_value[1] != "") {
|
||||
$value = number_format($returnValue_value[0], $config['graph_precision']) . " " . $returnValue_value[1];
|
||||
$value = remove_right_zeros(number_format($returnValue_value[0], $config['graph_precision'])) . " " . $returnValue_value[1];
|
||||
}
|
||||
else {
|
||||
$value = number_format($returnValue_value[0], $config['graph_precision']);
|
||||
$value = remove_right_zeros(number_format($returnValue_value[0], $config['graph_precision']));
|
||||
}
|
||||
}
|
||||
else {
|
||||
// If the value is a string, dont format it
|
||||
if (!is_string($value)) {
|
||||
$value = format_for_graph($value, $config['graph_precision']);
|
||||
$value = remove_right_zeros(format_for_graph($value, $config['graph_precision']));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -56,6 +56,7 @@ function include_javascript_dependencies_flot_graph($return = false) {
|
|||
ui_get_full_url($metaconsole_hack . '/include/graphs/flot/pandora.flot.js') .'"></script>';
|
||||
$output .= "
|
||||
<script type='text/javascript'>
|
||||
var precision_graph = " . $config['graph_precision'] . ";
|
||||
function pieHover(event, pos, obj)
|
||||
{
|
||||
if (!obj)
|
||||
|
@ -545,11 +546,11 @@ function flot_custom_pie_chart ($flash_charts, $graph_values,
|
|||
foreach ($graph_values as $label => $value) {
|
||||
if ($value['value']) {
|
||||
if ($value['value'] > 1000000)
|
||||
$legendvalue = sprintf("%sM", number_format($value['value'] / 1000000, $config['graph_precision']));
|
||||
$legendvalue = sprintf("%sM", remove_right_zeros(number_format($value['value'] / 1000000, $config['graph_precision'])));
|
||||
else if ($value['value'] > 1000)
|
||||
$legendvalue = sprintf("%sK", number_format($value['value'] / 1000, $config['graph_precision']));
|
||||
$legendvalue = sprintf("%sK", remove_right_zeros(number_format($value['value'] / 1000, $config['graph_precision'])));
|
||||
else
|
||||
$legendvalue = $value['value'];
|
||||
$legendvalue = remove_right_zeros(number_format($value['value'], $config['graph_precision']));
|
||||
}
|
||||
else
|
||||
$legendvalue = __('No data');
|
||||
|
|
|
@ -1136,35 +1136,74 @@ if (!empty($result)) {
|
|||
__('NOT INIT'), true);
|
||||
}
|
||||
elseif ($row['estado'] == 0) {
|
||||
$data[6] = ui_print_status_image(STATUS_MODULE_OK,
|
||||
__('NORMAL') . ': ' . $row['datos'], true);
|
||||
if (is_numeric($row['datos'])) {
|
||||
$data[6] = ui_print_status_image(STATUS_MODULE_OK,
|
||||
__('NORMAL') . ': ' . remove_right_zeros(number_format($row['datos'], $config['graph_precision'])), true);
|
||||
}
|
||||
else {
|
||||
$data[6] = ui_print_status_image(STATUS_MODULE_OK,
|
||||
__('NORMAL') . ': ' . $row['datos'], true);
|
||||
}
|
||||
}
|
||||
elseif ($row['estado'] == 1) {
|
||||
$data[6] = ui_print_status_image(STATUS_MODULE_CRITICAL,
|
||||
__('CRITICAL') . ': ' . $row['datos'], true);
|
||||
if (is_numeric($row['datos'])) {
|
||||
$data[6] = ui_print_status_image(STATUS_MODULE_CRITICAL,
|
||||
__('CRITICAL') . ': ' . remove_right_zeros(number_format($row['datos'], $config['graph_precision'])), true);
|
||||
}
|
||||
else {
|
||||
$data[6] = ui_print_status_image(STATUS_MODULE_CRITICAL,
|
||||
__('CRITICAL') . ': ' . $row['datos'], true);
|
||||
}
|
||||
}
|
||||
elseif ($row['estado'] == 2) {
|
||||
$data[6] = ui_print_status_image(STATUS_MODULE_WARNING,
|
||||
__('WARNING') . ': ' . $row['datos'], true);
|
||||
if (is_numeric($row['datos'])) {
|
||||
$data[6] = ui_print_status_image(STATUS_MODULE_WARNING,
|
||||
__('WARNING') . ': ' . remove_right_zeros(number_format($row['datos'], $config['graph_precision'])), true);
|
||||
}
|
||||
else {
|
||||
$data[6] = ui_print_status_image(STATUS_MODULE_WARNING,
|
||||
__('WARNING') . ': ' . $row['datos'], true);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$last_status = modules_get_agentmodule_last_status(
|
||||
$row['id_agente_modulo']);
|
||||
switch($last_status) {
|
||||
case 0:
|
||||
$data[6] = ui_print_status_image(STATUS_MODULE_UNKNOWN,
|
||||
__('UNKNOWN') . ' - ' . __('Last status') . " " .
|
||||
__('NORMAL') . ': ' . $row['datos'], true);
|
||||
if (is_numeric($row['datos'])) {
|
||||
$data[6] = ui_print_status_image(STATUS_MODULE_UNKNOWN,
|
||||
__('UNKNOWN') . ' - ' . __('Last status') . " " .
|
||||
__('NORMAL') . ': ' . remove_right_zeros(number_format($row['datos'], $config['graph_precision'])), true);
|
||||
}
|
||||
else {
|
||||
$data[6] = ui_print_status_image(STATUS_MODULE_UNKNOWN,
|
||||
__('UNKNOWN') . ' - ' . __('Last status') . " " .
|
||||
__('NORMAL') . ': ' . $row['datos'], true);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
$data[6] = ui_print_status_image(STATUS_MODULE_UNKNOWN,
|
||||
__('UNKNOWN') . ' - ' . __('Last status') ." " .
|
||||
__('CRITICAL') . ': ' . $row['datos'], true);
|
||||
if (is_numeric($row['datos'])) {
|
||||
$data[6] = ui_print_status_image(STATUS_MODULE_UNKNOWN,
|
||||
__('UNKNOWN') . ' - ' . __('Last status') ." " .
|
||||
__('CRITICAL') . ': ' . remove_right_zeros(number_format($row['datos'], $config['graph_precision'])), true);
|
||||
}
|
||||
else {
|
||||
$data[6] = ui_print_status_image(STATUS_MODULE_UNKNOWN,
|
||||
__('UNKNOWN') . ' - ' . __('Last status') ." " .
|
||||
__('CRITICAL') . ': ' . $row['datos'], true);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
$data[6] = ui_print_status_image(STATUS_MODULE_UNKNOWN,
|
||||
__('UNKNOWN') . ' - ' . __('Last status') . " " .
|
||||
__('WARNING') . ': ' . $row['datos'], true);
|
||||
if (is_numeric($row['datos'])) {
|
||||
$data[6] = ui_print_status_image(STATUS_MODULE_UNKNOWN,
|
||||
__('UNKNOWN') . ' - ' . __('Last status') . " " .
|
||||
__('WARNING') . ': ' . remove_right_zeros(number_format($row['datos'], $config['graph_precision'])), true);
|
||||
}
|
||||
else {
|
||||
$data[6] = ui_print_status_image(STATUS_MODULE_UNKNOWN,
|
||||
__('UNKNOWN') . ' - ' . __('Last status') . " " .
|
||||
__('WARNING') . ': ' . $row['datos'], true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1246,12 +1285,12 @@ if (!empty($result)) {
|
|||
$salida = $config['render_proc_fail'];
|
||||
break;
|
||||
default:
|
||||
$salida = number_format($row['datos'], $config['graph_precision']);
|
||||
$salida = remove_right_zeros(number_format($row['datos'], $config['graph_precision']));
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$salida = number_format($row['datos'], $config['graph_precision']);
|
||||
$salida = remove_right_zeros(number_format($row['datos'], $config['graph_precision']));
|
||||
}
|
||||
|
||||
// Show units ONLY in numeric data types
|
||||
|
|
Loading…
Reference in New Issue