2011-05-25 Vanessa Gil <vanessa.gil@artica.es>

* operation/agentes/ver_agente.php
	operation/agentes/graphs.php
	godmode/agentes/configurar_agente.php
	godmode/agentes/module_manager_editor.php
	godmode/agentes/module_manager_editor_common.php
	include/graphs/fgraph.php
	include/graphs/functions_fsgraph.php
	include/functions_graph.php
	include/functions_modules.php
	pandoradb.oracle.sql
	pandoradb.postgreSQL.sql
	pandoradb.sql: Added units to modules and graphs



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4380 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
vgilc 2011-05-25 09:57:05 +00:00
parent 1e3661884e
commit eae12b8e9b
16 changed files with 80 additions and 24 deletions

View File

@ -1,3 +1,18 @@
2011-05-25 Vanessa Gil <vanessa.gil@artica.es>
* operation/agentes/ver_agente.php
operation/agentes/graphs.php
godmode/agentes/configurar_agente.php
godmode/agentes/module_manager_editor.php
godmode/agentes/module_manager_editor_common.php
include/graphs/fgraph.php
include/graphs/functions_fsgraph.php
include/functions_graph.php
include/functions_modules.php
pandoradb.oracle.sql
pandoradb.postgreSQL.sql
pandoradb.sql: Added units to modules and graphs
2011-05-25 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_agents.php: erased lost trace in source code.

View File

@ -109,6 +109,7 @@ $custom_id = "";
$cascade_protection = 0;
$icon_path = '';
$update_gis_data = 0;
$unit = "";
$create_agent = (bool) get_parameter ('create_agent');
@ -130,6 +131,7 @@ if ($create_agent) {
$icon_path = (string) get_parameter_post ("icon_path",'');
$update_gis_data = (int) get_parameter_post("update_gis_data", 0);
$fields = db_get_all_fields_in_table('tagent_custom_fields');
if($fields === false) $fields = array();
@ -613,7 +615,8 @@ if ($update_module || $create_module) {
$min_critical = (float) get_parameter ('min_critical');
$max_critical = (float) get_parameter ('max_critical');
$ff_event = (int) get_parameter ('ff_event');
$unit = (string) get_parameter('unit');
$active_snmp_v3 = get_parameter('active_snmp_v3');
if ($active_snmp_v3) {
//
@ -661,7 +664,8 @@ if ($update_module) {
'custom_string_3' => $custom_string_3,
'custom_integer_1' => $custom_integer_1,
'custom_integer_2' => $custom_integer_2,
'min_ff_event' => $ff_event);
'min_ff_event' => $ff_event,
'unit' => $unit);
$result = modules_update_agent_module ($id_agent_module,
$values);
@ -738,9 +742,10 @@ if ($create_module) {
'custom_string_3' => $custom_string_3,
'custom_integer_1' => $custom_integer_1,
'custom_integer_2' => $custom_integer_2,
'min_ff_event' => $ff_event
'min_ff_event' => $ff_event,
'unit' => $unit
);
$id_agent_module = modules_create_agent_module ($id_agente, $name, $values);
if ($id_agent_module === false) {

View File

@ -173,6 +173,7 @@ if ($id_agent_module) {
$min_critical = $module['min_critical'];
$max_critical = $module['max_critical'];
$ff_event = $module['min_ff_event'];
$unit = $module['unit'];
}
else {
if (!isset ($moduletype)) {

View File

@ -226,4 +226,7 @@ $table_advanced->data[4][0] = __('Export target');
$table_advanced->data[4][1] = html_print_select_from_sql ('SELECT id, name FROM tserver_export ORDER BY name',
'id_export', $id_export, '',__('None'),'0', true, false, false, $disabledBecauseInPolicy).ui_print_help_tip (__('In case you use an Export server you can link this module and export data to one these.'), true);
$table_advanced->colspan[4][1] = 3;
$table_advanced->data[5][0] = __('Unit');
$table_advanced->data[5][1] = html_print_input_text ('unit', $unit,
'', 20, 65, true);
?>

View File

@ -74,15 +74,19 @@ $table->data[9][0] = __('Base DN');
$table->data[9][1] = html_print_input_text ('ldap_base_dn', $config['ldap_base_dn'], '', 60, 100, true);
$table->data[10][0] = __('Login attribute');
$table->data[10][1] = html_print_input_text ('ldap_login_attr', $config['ldap_login_attr'], '', 60, 100, true);
$table->data[11][0] = __('Username');
$table->data[11][1] = html_print_input_text ('ldap_admin_dn', $config['ldap_admin_dn'], '', 30, 100, true);
$table->data[12][0] = __('Password');
$table->data[12][1] = html_print_input_password ('ldap_admin_pwd', $config['ldap_admin_pwd'], '', 30, 100, true);
// Hide LDAP configuration options
for ($i = 5; $i <= 10; $i++) {
for ($i = 5; $i <= 12; $i++) {
$table->rowstyle[$i] = $config['auth'] == 'ldap' ? '' : 'display: none;';
$table->rowclass[$i] = 'ldap';
}
// Add enterprise authentication options
enterprise_hook ('add_enterprise_auth_options', array (&$table, 11));
enterprise_hook ('add_enterprise_auth_options', array (&$table, 13));
echo '<form id="form_setup" method="post">';
html_print_input_hidden ('update_config', 1);

View File

@ -330,7 +330,7 @@ function ldap_search_user ($login) {
*/
function ldap_valid_login ($login, $password) {
global $ldap_cache, $config;
if (! function_exists ("ldap_connect")) {
die ("Your installation of PHP does not support LDAP");
}
@ -558,7 +558,7 @@ function ldap_connect_bind () {
return $ret;
}
}
if (!empty ($config["auth"]["ldap_admin_dn"])) {
$r = @ldap_bind ($ldap_cache["ds"], $config["auth"]["ldap_admin_dn"], $config["auth"]["ldap_admin_pwd"]);
} else {

View File

@ -204,6 +204,8 @@ function config_update_config () {
config_update_value ('ldap_start_tls', get_parameter ('ldap_start_tls', $config['ldap_start_tls']));
config_update_value ('ldap_base_dn', get_parameter ('ldap_base_dn', $config['ldap_base_dn']));
config_update_value ('ldap_login_attr', get_parameter ('ldap_login_attr', $config['ldap_login_attr']));
config_update_value ('ldap_admin_dn', get_parameter ('ldap_admin_dn', $config['ldap_admin_dn']));
config_update_value ('ldap_admin_pwd', get_parameter ('ldap_admin_pwd', $config['ldap_admin_pwd']));
config_update_value ('ad_server', get_parameter ('ad_server', $config['ad_server']));
config_update_value ('ad_port', get_parameter ('ad_port', $config['ad_port']));
@ -535,6 +537,14 @@ function config_process_config () {
config_update_value ( 'ldap_login_attr', 'uid');
}
if (!isset ($config['ldap_admin_dn'])) {
config_update_value ( 'ldap_admin_dn', '');
}
if (!isset ($config['ldap_admin_pwd'])) {
config_update_value ( 'ldap_admin_pwd', '');
}
if (!isset ($config['ad_server'])) {
config_update_value ( 'ad_server', 'localhost');
}

View File

@ -28,7 +28,7 @@ define("GRAPH_STACKED_LINE", 3);
function grafico_modulo_sparse2 ($agent_module_id, $period, $show_events,
$width, $height , $title = '', $unit_name = null,
$show_alerts = false, $avg_only = 0, $pure = false,
$date = 0, $baseline = 0, $return_data = 0, $show_title = true,
$date = 0, $unit, $baseline = 0, $return_data = 0, $show_title = true,
$only_image = false, $homeurl = '') {
global $config;
global $graphic_type;
@ -310,7 +310,7 @@ function grafico_modulo_sparse2 ($agent_module_id, $period, $show_events,
return area_graph($flash_chart, $chart, $width, $height, $color,$legend,
$long_index, "images/image_problem.opaque.png", "", "", $homeurl,
$config['homedir'] . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
$config['fontpath'], $config['font_size'], $unit);
}
/**
@ -646,7 +646,7 @@ function graphic_combined_module2 ($module_list, $weight_list, $period, $width,
return area_graph($flash_charts, $graph_values, $width, $height,
$color, $module_name_list, $long_index, "images/image_problem.opaque.png",
"", "", $homeurl, $config['homedir'] . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
$config['fontpath'], $config['font_size'], "");
break;
default:
case GRAPH_STACKED_AREA:
@ -729,7 +729,7 @@ function graphic_agentaccess2 ($id_agent, $width, $height, $period = 0) {
echo area_graph($config['flash_charts'], $data, $width, $height,
null, null, null, "images/image_problem.opaque.png", "", "", "",
$config['homedir'] . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
$config['fontpath'], $config['font_size'], "");
}
/**
@ -1788,7 +1788,7 @@ function grafico_modulo_boolean2 ($agent_module_id, $period, $show_events,
return area_graph($flash_chart, $chart, $width, $height, $color, $legend,
$long_index, "images/image_problem.opaque.png", "", "", $homeurl,
$config['homedir'] . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
$config['fontpath'], $config['font_size'], "");
}
/**
@ -2020,7 +2020,7 @@ function grafico_modulo_string2 ($agent_module_id, $period, $show_events,
return area_graph($flash_chart, $chart, $width, $height, $color, $legend,
$long_index, "images/image_problem.opaque.png", "", "", $homeurl,
$config['homedir'] . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
$config['fontpath'], $config['font_size'], "");
}
function grafico_modulo_log4x_2 ($id_agente_modulo, $periodo, $show_event,
@ -2394,4 +2394,4 @@ function grafico_modulo_log4x_format_y_axis2 ( $number , $decimals=2, $dec_point
return "$n";
}
?>
?>

View File

@ -543,6 +543,17 @@ function modules_get_agentmodule_type ($id_agentmodule) {
return (int) db_get_value ('id_tipo_modulo', 'tagente_modulo', 'id_agente_modulo', (int) $id_agentmodule);
}
/**
* Get the unit of an agent module.
*
* @param int $id_agente_module Agent module id.
*
* @return string Module unit of the given agent module.
*/
function modules_get_unit ($id_agente_modulo) {
return $unit = (string) db_get_value ('unit', 'tagente_modulo', 'id_agente_modulo', (int) $id_agente_modulo);
}
/**
* Get all the times a monitor went down during a period.
*

View File

@ -190,13 +190,14 @@ function threshold_graph($flash_chart, $chart_data, $width, $height) {
function area_graph($flash_chart, $chart_data, $width, $height, $color, $legend,
$long_index, $no_data_image, $xaxisname = "", $yaxisname = "", $homedir="",
$water_mark = "", $font = '', $font_size = '') {
$water_mark = "", $font = '', $font_size = '', $unit) {
if (empty($chart_data)) {
return '<img src="' . $no_data_image . '" />';
}
if($flash_chart) {
return fs_area_graph($chart_data, $width, $height, $color, $legend, $long_index, $homedir);
return fs_area_graph($chart_data, $width, $height, $color, $legend, $long_index, $homedir, $unit);
}
else {
$graph = array();

View File

@ -309,7 +309,7 @@ function fs_line_graph($chart_data, $width, $height, $color, $legend, $long_inde
}
function fs_area_graph($chart_data, $width, $height, $color, $legend, $long_index, $homeurl = '') {
function fs_area_graph($chart_data, $width, $height, $color, $legend, $long_index, $homeurl = '', $unit) {
global $config;
$graph_type = "MSArea2D"; //MSLine is possible also
@ -346,7 +346,7 @@ function fs_area_graph($chart_data, $width, $height, $color, $legend, $long_inde
else {
$chart->addCategory($i, 'showName=' . $show_name);
}
$c = 0;
foreach($values as $i2 => $value) {
$data2[$i2][$i] = $value;
@ -390,7 +390,7 @@ function fs_area_graph($chart_data, $width, $height, $color, $legend, $long_inde
$color = 'color=#' . $colors[$i]['color'];
}
}
$chart->addDataSet($legend_text, $alpha .
'showAreaBorder=' . $showAreaBorder . ';' .
$areaBorderColor .
@ -423,7 +423,7 @@ function fs_area_graph($chart_data, $width, $height, $color, $legend, $long_inde
}
}
$chart->setChartParams('animation=0;numVDivLines=' . $num_vlines .
$chart->setChartParams('numberSuffix=' . $unit . ';'.'animation=0;numVDivLines=' . $num_vlines .
';showShadow=0;showAlternateVGridColor=1;showNames=1;rotateNames=1;' .
'lineThickness=0.1;anchorRadius=0.5;showValues=0;baseFontSize=9;showLimits=0;' .
'showAreaBorder=1;areaBorderThickness=0.1;areaBorderColor=000000' . ($empty == 1 ? ';yAxisMinValue=0;yAxisMaxValue=1' : ''));
@ -447,7 +447,7 @@ function fs_area_graph($chart_data, $width, $height, $color, $legend, $long_inde
pie_' . $chart_id . ' ();
-->
</script>';
return $output;
}
///////////////////////////////

View File

@ -822,4 +822,4 @@ function pch_threshold_graph ($graph_type, $index, $data, $width, $height, $font
/* Render the picture */
$myPicture->stroke();
}
?>
?>

View File

@ -40,6 +40,8 @@ $zoom = get_parameter ("zoom", 1);
$modulesChecked = get_parameter('modules', array());
$filter = get_parameter('filter', 0);
$unit = "";
$modules = agents_get_modules($id_agente);
if (!$filter) {
@ -123,8 +125,9 @@ else
foreach ($modulesChecked as $idModuleShowGraph => $value) {
echo "<h3>" . $modules[$idModuleShowGraph] . '</h3>';
$unit = modules_get_unit ($idModuleShowGraph);
echo grafico_modulo_sparse2($idModuleShowGraph, $period, $draw_events, $width, $height,
$modules[$idModuleShowGraph], null, $draw_alerts, $avg_only, false, $date);
$modules[$idModuleShowGraph], null, $draw_alerts, $avg_only, false, $date, $unit);
}
echo "<div style='clear: both;'></div>";

View File

@ -166,6 +166,7 @@ CREATE TABLE tagente_modulo (
id_tipo_modulo NUMBER(10, 0) default 0 NOT NULL,
descripcion CLOB default '',
nombre CLOB default '',
unit VARCHAR2(100) DEFAULT '',
id_policy_module NUMBER(10, 0) default 0 NOT NULL,
max NUMBER(19, 0) default 0 NOT NULL,
min NUMBER(19, 0) default 0 NOT NULL,

View File

@ -152,6 +152,7 @@ CREATE TABLE "tagente_modulo" (
"id_tipo_modulo" INTEGER NOT NULL default 0,
"descripcion" TEXT NOT NULL default '',
"nombre" TEXT NOT NULL default '',
"unit" TEXT default '',
"id_policy_module" INTEGER NOT NULL default 0,
"max" BIGINT NOT NULL default 0,
"min" BIGINT NOT NULL default 0,

View File

@ -146,6 +146,7 @@ CREATE TABLE IF NOT EXISTS `tagente_modulo` (
`id_tipo_modulo` smallint(5) NOT NULL default '0',
`descripcion` TEXT NOT NULL default '',
`nombre` text NOT NULL default '',
`unit` text default '',
`id_policy_module` INTEGER unsigned NOT NULL default '0',
`max` bigint(20) default '0',
`min` bigint(20) default '0',