2013-02-14 Miguel de Dios <miguel.dedios@artica.es>
* godmode/massive/massive_operations.php, godmode/massive/massive_enable_disable_alerts.php, godmode/massive/massive_standby_alerts.php, godmode/tag/edit_tag.php, include/functions_graph.php, include/functions_io.php, include/functions_ui.php: cleaned source code style. * include/functions_modules.php: erased deprecated function "modules_give_modulecategory_name". git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7648 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
5855f5895d
commit
6658fe31a3
|
@ -1,3 +1,15 @@
|
|||
2013-02-14 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* godmode/massive/massive_operations.php,
|
||||
godmode/massive/massive_enable_disable_alerts.php,
|
||||
godmode/massive/massive_standby_alerts.php,
|
||||
godmode/tag/edit_tag.php, include/functions_graph.php,
|
||||
include/functions_io.php, include/functions_ui.php: cleaned source
|
||||
code style.
|
||||
|
||||
* include/functions_modules.php: erased deprecated function
|
||||
"modules_give_modulecategory_name".
|
||||
|
||||
2013-02-13 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* extensions/module_groups.php,
|
||||
|
|
|
@ -67,7 +67,7 @@ $recursion = get_parameter ('recursion');
|
|||
|
||||
$result = false;
|
||||
|
||||
switch($action) {
|
||||
switch ($action) {
|
||||
case 'enable_alerts':
|
||||
$id_alert_templates = (int) get_parameter ('id_alert_template_disabled', 0);
|
||||
$id_disabled_alerts = get_parameter_post ('id_disabled_alerts', array());
|
||||
|
@ -77,7 +77,7 @@ switch($action) {
|
|||
|
||||
ui_print_result_message ($result, __('Successfully enabled'), __('Could not be enabled'));
|
||||
|
||||
$info = 'Alert: ' . json_encode($id_disabled_alerts);
|
||||
$info = 'Alert: ' . json_encode($id_disabled_alerts);
|
||||
if ($result) {
|
||||
db_pandora_audit("Masive management", "Enable alert", false, false, $info);
|
||||
}
|
||||
|
|
|
@ -199,7 +199,7 @@ echo '</div>';
|
|||
<?php
|
||||
|
||||
echo "<br />";
|
||||
echo '<form method="post" id="form_options" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations">';
|
||||
echo '<form method="post" id="form_options" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations">';
|
||||
echo '<table border="0"><tr><td>';
|
||||
echo __("Action");
|
||||
echo '</td><td>';
|
||||
|
|
|
@ -77,7 +77,7 @@ switch($action) {
|
|||
|
||||
ui_print_result_message ($result, __('Successfully set off standby'), __('Could not be set off standby'));
|
||||
|
||||
$info = 'Alert: ' . json_encode($id_standby_alerts);
|
||||
$info = 'Alert: ' . json_encode($id_standby_alerts);
|
||||
if ($result) {
|
||||
db_pandora_audit("Masive management", "Set off standby alerts", false, false, $info);
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ switch($action) {
|
|||
|
||||
ui_print_result_message ($result, __('Successfully set standby'), __('Could not be set standby'));
|
||||
|
||||
$info = 'Alert: ' . json_encode($id_not_standby_alerts);
|
||||
$info = 'Alert: ' . json_encode($id_not_standby_alerts);
|
||||
if ($result) {
|
||||
db_pandora_audit("Masive management", "Set on standby alerts", false, false, $info);
|
||||
}
|
||||
|
|
|
@ -52,10 +52,10 @@ $buttons[$tab]['active'] = true;
|
|||
|
||||
if (defined('METACONSOLE')) {
|
||||
// Print header
|
||||
ui_meta_print_header(__('Tags'), "", $buttons);
|
||||
ui_meta_print_header(__('Tags'), "", $buttons);
|
||||
}
|
||||
else {
|
||||
|
||||
|
||||
// Header
|
||||
ui_print_page_header (__('Tags configuration'), "images/setup.png", false, "", true, $buttons);
|
||||
|
||||
|
@ -63,11 +63,11 @@ else {
|
|||
|
||||
// Two actions can performed in this page: update and create tags
|
||||
// Update tag: update an existing tag
|
||||
if ($update_tag && $id_tag != 0) {
|
||||
|
||||
if ($update_tag && $id_tag != 0) {
|
||||
|
||||
// Erase comma characters on tag name
|
||||
$name_tag = str_replace(',', '', $name_tag);
|
||||
|
||||
|
||||
$values = array();
|
||||
$values['name'] = $name_tag;
|
||||
$values['description'] = $description_tag;
|
||||
|
@ -143,7 +143,7 @@ echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/tag/edit_t
|
|||
echo '<div align=left style="width: 98%" class="pandora_form">';
|
||||
|
||||
echo "<table border=0 cellpadding=4 cellspacing=4 class=databox width=98%>";
|
||||
echo "<tr>";
|
||||
echo "<tr>";
|
||||
echo "<td align=center>";
|
||||
html_print_label (__("Name"),'name');
|
||||
echo "</td>";
|
||||
|
@ -156,7 +156,7 @@ echo "<table border=0 cellpadding=4 cellspacing=4 class=databox width=98%>";
|
|||
html_print_label (__("Description"),'name');
|
||||
echo "</td>";
|
||||
echo "<td align=center>";
|
||||
html_print_input_text ('description_tag', $description_tag);
|
||||
html_print_input_text ('description_tag', $description_tag);
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
echo "<tr>";
|
||||
|
|
|
@ -440,13 +440,13 @@ function grafico_modulo_sparse_data_chart (&$chart, &$chart_data_extra, &$long_i
|
|||
}
|
||||
}*/
|
||||
|
||||
if(!empty($event_ids)) {
|
||||
if (!empty($event_ids)) {
|
||||
$chart_extra_data[count($chart)-1]['events'] = implode(',',$event_ids);
|
||||
}
|
||||
if(!empty($alert_ids)) {
|
||||
if (!empty($alert_ids)) {
|
||||
$chart_extra_data[count($chart)-1]['alerts'] = implode(',',$alert_ids);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -503,13 +503,13 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
|
|||
"utimestamp < $date",
|
||||
'order' => 'utimestamp ASC'),
|
||||
array ('id_evento', 'evento', 'utimestamp', 'event_type'));
|
||||
|
||||
|
||||
// Get the last event after inverval to know if graph start on unknown
|
||||
$prev_event = db_get_row_filter ('tevento',
|
||||
array ('id_agentmodule' => $agent_module_id,
|
||||
"utimestamp <= $datelimit",
|
||||
'order' => 'utimestamp DESC'));
|
||||
if(isset($prev_event['event_type']) && $prev_event['event_type'] == 'going_unknown') {
|
||||
if (isset($prev_event['event_type']) && $prev_event['event_type'] == 'going_unknown') {
|
||||
$start_unknown = true;
|
||||
}
|
||||
|
||||
|
@ -529,7 +529,7 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
|
|||
// Get module warning_min and critical_min
|
||||
$warning_min = db_get_value('min_warning','tagente_modulo','id_agente_modulo',$agent_module_id);
|
||||
$critical_min = db_get_value('min_critical','tagente_modulo','id_agente_modulo',$agent_module_id);
|
||||
|
||||
|
||||
if ($data === false) {
|
||||
$data = array ();
|
||||
}
|
||||
|
@ -611,14 +611,14 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
|
|||
$projection, $avg_only, $uncompressed_module,
|
||||
$show_events, $show_alerts, $show_unknown, $baseline,
|
||||
$baseline_data, $events, $series_suffix, $start_unknown);
|
||||
|
||||
|
||||
// Return chart data and don't draw
|
||||
if ($return_data == 1) {
|
||||
return $chart;
|
||||
}
|
||||
|
||||
$graph_stats = get_statwin_graph_statistics($chart, $series_suffix);
|
||||
|
||||
|
||||
// Fix event and alert scale
|
||||
$event_max = 2 + (float)$max_value * 1.05;
|
||||
foreach ($chart as $timestamp => $chart_data) {
|
||||
|
@ -749,10 +749,10 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
|
|||
return $data_returned;
|
||||
}
|
||||
|
||||
if($compare === 'overlapped') {
|
||||
if ($compare === 'overlapped') {
|
||||
$i = 0;
|
||||
foreach($chart as $k=>$v) {
|
||||
if(!isset($chart_prev[$i])) {
|
||||
foreach ($chart as $k=>$v) {
|
||||
if (!isset($chart_prev[$i])) {
|
||||
continue;
|
||||
}
|
||||
$chart[$k] = array_merge($v,$chart_prev[$i]);
|
||||
|
@ -1214,38 +1214,42 @@ function graphic_combined_module ($module_list, $weight_list, $period, $width, $
|
|||
$fixed_font_size = $config['font_size'] - 1;
|
||||
|
||||
//Set graph color
|
||||
|
||||
|
||||
$color = array();
|
||||
|
||||
|
||||
$color[0] = array('border' => '#000000', 'color' => $config['graph_color1'], 'alpha' => 50);
|
||||
$color[1] = array('border' => '#000000', 'color' => $config['graph_color2'], 'alpha' => 50);
|
||||
$color[2] = array('border' => '#000000', 'color' => $config['graph_color3'], 'alpha' => 50);
|
||||
|
||||
$color[1] = array('border' => '#000000', 'color' => $config['graph_color2'], 'alpha' => 50);
|
||||
$color[2] = array('border' => '#000000', 'color' => $config['graph_color3'], 'alpha' => 50);
|
||||
|
||||
switch ($stacked) {
|
||||
case GRAPH_AREA:
|
||||
return area_graph($flash_charts, $graph_values, $width, $height,
|
||||
$color, $module_name_list, $long_index, ui_get_full_url("images/image_problem.opaque.png"),
|
||||
"", "", $homeurl, $water_mark,
|
||||
$config['fontpath'], $fixed_font_size, "", $ttl);
|
||||
return area_graph($flash_charts, $graph_values, $width,
|
||||
$height, $color, $module_name_list, $long_index,
|
||||
ui_get_full_url("images/image_problem.opaque.png"), "",
|
||||
"", $homeurl, $water_mark, $config['fontpath'],
|
||||
$fixed_font_size, "", $ttl);
|
||||
break;
|
||||
default:
|
||||
case GRAPH_STACKED_AREA:
|
||||
return stacked_area_graph($flash_charts, $graph_values, $width, $height,
|
||||
$color, $module_name_list, $long_index, ui_get_full_url("images/image_problem.opaque.png"),
|
||||
"", "", $water_mark,
|
||||
$config['fontpath'], $fixed_font_size, "", $ttl, $homeurl);
|
||||
return stacked_area_graph($flash_charts, $graph_values,
|
||||
$width, $height, $color, $module_name_list, $long_index,
|
||||
ui_get_full_url("images/image_problem.opaque.png"), "",
|
||||
"", $water_mark, $config['fontpath'], $fixed_font_size,
|
||||
"", $ttl, $homeurl);
|
||||
break;
|
||||
case GRAPH_LINE:
|
||||
return line_graph($flash_charts, $graph_values, $width, $height,
|
||||
$color, $module_name_list, $long_index, ui_get_full_url("images/image_problem.opaque.png"),
|
||||
"", "", $water_mark,
|
||||
$config['fontpath'], $fixed_font_size, "", $ttl, $homeurl);
|
||||
return line_graph($flash_charts, $graph_values, $width,
|
||||
$height, $color, $module_name_list, $long_index,
|
||||
ui_get_full_url("images/image_problem.opaque.png"), "",
|
||||
"", $water_mark, $config['fontpath'], $fixed_font_size,
|
||||
"", $ttl, $homeurl);
|
||||
break;
|
||||
case GRAPH_STACKED_LINE:
|
||||
return stacked_line_graph($flash_charts, $graph_values, $width, $height,
|
||||
$color, $module_name_list, $long_index, ui_get_full_url("images/image_problem.opaque.png"),
|
||||
"", "", $water_mark,
|
||||
$config['fontpath'], $fixed_font_size, "", $ttl, $homeurl);
|
||||
return stacked_line_graph($flash_charts, $graph_values,
|
||||
$width, $height, $color, $module_name_list, $long_index,
|
||||
ui_get_full_url("images/image_problem.opaque.png"), "",
|
||||
"", $water_mark, $config['fontpath'], $fixed_font_size,
|
||||
"", $ttl, $homeurl);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -2133,11 +2137,11 @@ function graph_custom_sql_graph ($id, $width, $height, $type = 'sql_graph_vbar',
|
|||
if (enterprise_hook('metaconsole_load_external_db', array($metaconsole_connection)) != NOERR) {
|
||||
//ui_print_error_message ("Error connecting to ".$server_name);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$data_result = db_get_all_rows_sql ($sql);
|
||||
|
||||
|
||||
if (($config['metaconsole'] == 1) && defined('METACONSOLE'))
|
||||
enterprise_hook('metaconsole_restore_db');
|
||||
|
||||
|
|
|
@ -274,9 +274,9 @@ function io_safe_output_html($value, $utf8 = true)
|
|||
//Revert html entities to chars
|
||||
for ($i=0;$i<33;$i++) {
|
||||
$value = str_ireplace("&#x".dechex($i).";",io_html_to_ascii(dechex($i)), $value);
|
||||
}
|
||||
}
|
||||
|
||||
return $value;
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -998,8 +998,8 @@ function modules_get_monitors_in_agent ($id_agent) {
|
|||
AND ttipo_modulo.nombre LIKE '%%_proc'
|
||||
AND tagente.id_agente = %d", $id_agent);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return db_get_all_rows_sql ($sql);
|
||||
}
|
||||
|
||||
|
@ -1016,14 +1016,16 @@ function modules_get_monitors_in_agent ($id_agent) {
|
|||
*/
|
||||
function modules_get_monitors_down ($monitors, $period = 0, $date = 0) {
|
||||
$monitors_down = array ();
|
||||
|
||||
if (empty ($monitors))
|
||||
return $monitors_down;
|
||||
|
||||
return $monitors_down;
|
||||
|
||||
foreach ($monitors as $monitor) {
|
||||
$down = modules_get_monitor_downs_in_period ($monitor['id_agente_modulo'], $period, $date);
|
||||
if ($down > 0)
|
||||
array_push ($monitors_down, $monitor);
|
||||
}
|
||||
|
||||
return $monitors_down;
|
||||
}
|
||||
|
||||
|
@ -1069,13 +1071,13 @@ function modules_get_moduletypes ($type = "all", $rows = "nombre") {
|
|||
elseif ($type == "agent") {
|
||||
return array_merge (range (1,4), range (19,24));
|
||||
}
|
||||
|
||||
|
||||
$sql = sprintf ("SELECT id_tipo, %s FROM ttipo_modulo", implode (",", $rows));
|
||||
$result = db_get_all_rows_sql ($sql);
|
||||
if ($result === false) {
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
foreach ($result as $type) {
|
||||
if ($row_cnt > 1) {
|
||||
$return[$type["id_tipo"]] = $type;
|
||||
|
@ -1084,6 +1086,7 @@ function modules_get_moduletypes ($type = "all", $rows = "nombre") {
|
|||
$return[$type["id_tipo"]] = $type[reset ($rows)];
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
@ -1119,32 +1122,6 @@ function modules_show_icon_type ($id_type) {
|
|||
return (string) db_get_value ('icon', 'ttipo_modulo', 'id_tipo', $id_type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a module category name
|
||||
*
|
||||
* @param int Id category
|
||||
*
|
||||
* @return Name of the given category
|
||||
*/
|
||||
function modules_give_modulecategory_name ($id_category) {
|
||||
switch ($id_category) {
|
||||
case 0:
|
||||
return __('Software agent data');
|
||||
break;
|
||||
case 1:
|
||||
return __('Software agent monitor');
|
||||
break;
|
||||
case 2:
|
||||
return __('Network agent data');
|
||||
break;
|
||||
case 3:
|
||||
return __('Network agent monitor');
|
||||
break;
|
||||
}
|
||||
|
||||
return __('Unknown');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get agent id from an agent module.
|
||||
*
|
||||
|
|
|
@ -2873,11 +2873,11 @@ function ui_print_agent_autocomplete_input($parameters) {
|
|||
|
||||
var term = input_value; //Word to search
|
||||
|
||||
' . $javascript_change_ajax_params_text . '
|
||||
|
||||
' . $javascript_change_ajax_params_text . '
|
||||
|
||||
if (' . ((int) !$metaconsole_enabled) . ') {
|
||||
data_params[\'force_local\'] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
jQuery.ajax ({
|
||||
data: data_params,
|
||||
|
|
Loading…
Reference in New Issue