2009-10-20 Miguel de Dios <miguel.dedios@artica.es>

* pandora_console/operation/menu.php,
	pandora_console/godmode/reporting/graphs.php,
	pandora_console/godmode/reporting/graph_builder.php: clean debug trace
	functions.
	* pandora_console/godmode/agentes/module_manager.php,
	pandora_console/godmode/alerts/alert_list.php: add the enterprise column
	that it has a icon when the alert or module is make for policy.
	* pandora_console/godmode/agentes/agent_manager.php: fix bug that when
	create a new agent and in the md5 dir has a file with the next name
	d41d8cd98f00b204e9800998ecf8427e, that name is a md5 of empty string. When
	you has this file, the form take as conf file.






git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2040 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2009-10-20 15:23:26 +00:00
parent 200eb4e427
commit 1516062622
7 changed files with 145 additions and 87 deletions

View File

@ -1,3 +1,17 @@
2009-10-20 Miguel de Dios <miguel.dedios@artica.es>
* pandora_console/operation/menu.php,
pandora_console/godmode/reporting/graphs.php,
pandora_console/godmode/reporting/graph_builder.php: clean debug trace
functions.
* pandora_console/godmode/agentes/module_manager.php,
pandora_console/godmode/alerts/alert_list.php: add the enterprise column
that it has a icon when the alert or module is make for policy.
* pandora_console/godmode/agentes/agent_manager.php: fix bug that when
create a new agent and in the md5 dir has a file with the next name
d41d8cd98f00b204e9800998ecf8427e, that name is a md5 of empty string. When
you has this file, the form take as conf file.
2009-10-20 Sancho Lerena <slerena@artica.es>
* include/help/en/help_alert_macros.php: Updated help.

View File

@ -67,10 +67,12 @@ if ($id_agente) {
echo "</h2>";
echo '<div style="height: 5px">&nbsp;</div>';
// Agent remote configuration editor
$agent_md5 = md5 ($nombre_agente, false);
$filename['md5'] = $config["remote_config"]."/md5/".$agent_md5.".md5";
$filename['conf'] = $config["remote_config"]."/conf/".$agent_md5.".conf";
if (!$new_agent) {
// Agent remote configuration editor
$agent_md5 = md5 ($nombre_agente, false);
$filename['md5'] = $config["remote_config"]."/md5/".$agent_md5.".md5";
$filename['conf'] = $config["remote_config"]."/conf/".$agent_md5.".conf";
}
$disk_conf = (bool) get_parameter ('disk_conf');
@ -108,10 +110,12 @@ if ($id_agente) {
}
// Remote configuration available
if (file_exists ($filename['md5'])) {
$table->data[0][1] .= '<a href="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=main&amp;id_agente='.$id_agente.'&amp;disk_conf='.$agent_md5.'">';
$table->data[0][1] .= print_image ("images/application_edit.png", true, array ("border" => 0, "title" => __('This agent can be remotely configured')));
$table->data[0][1] .= '</a>'.print_help_tip (__('You can remotely edit this agent configuration'), true);
if (!$new_agent) {
if (file_exists ($filename['md5'])) {
$table->data[0][1] .= '<a href="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=main&amp;id_agente='.$id_agente.'&amp;disk_conf='.$agent_md5.'">';
$table->data[0][1] .= print_image ("images/application_edit.png", true, array ("border" => 0, "title" => __('This agent can be remotely configured')));
$table->data[0][1] .= '</a>'.print_help_tip (__('You can remotely edit this agent configuration'), true);
}
}
$table->data[1][0] = __('IP Address');
@ -189,14 +193,18 @@ $table->data[10][1] .= __('Active').' '.print_radio_button_extended ("disabled",
// Remote configuration
$table->data[11][0] = __('Remote configuration');
if (file_exists ($filename['md5'])) {
$table->data[11][1] = date ("F d Y H:i:s", fileatime ($filename['md5']));
// Delete remote configuration
$table->data[11][1] .= '<a href="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=main&amp;disk_conf_delete=1&amp;id_agente='.$id_agente.'">';
$table->data[11][1] .= print_image ("images/cross.png", true).'</a>';
} else {
$table->data[11][1] = '<em>'.__('Not available').'</em>';
if (!$new_agent) {
if (file_exists ($filename['md5'])) {
$table->data[11][1] = date ("F d Y H:i:s", fileatime ($filename['md5']));
// Delete remote configuration
$table->data[11][1] .= '<a href="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=main&amp;disk_conf_delete=1&amp;id_agente='.$id_agente.'">';
$table->data[11][1] .= print_image ("images/cross.png", true).'</a>';
}
else
$table->data[11][1] = '<em>'.__('Not available').'</em>';
}
else
$table->data[11][1] = '<em>'.__('Not available').'</em>';
print_table ($table);

View File

@ -20,6 +20,7 @@ if (isset ($id_agente)) {
}
enterprise_include ('godmode/agentes/module_manager.php');
$isFunctionPolicies = enterprise_include_once ('include/functions_policies.php');
// Create module/type combo
echo '<table width="300" cellpadding="4" cellspacing="4" class="databox">';
@ -140,21 +141,23 @@ if ($modules === false) {
$table->width = '95%';
$table->head = array ();
$table->head[0] = __('Name');
/* S stands for "Server" */;
$table->head[1] = __('S');
$table->head[2] = __('Type');
$table->head[3] = __('Interval');
$table->head[4] = __('Description');
$table->head[5] = __('Max/Min');
$table->head[6] = __('Action');
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK)
$table->head[1] = "<span title='" . __('Policy') . "'>" . __('P.') . "</span>";
$table->head[2] = "<span title='" . __('Server') . "'>" . __('S.') . "</span>";
$table->head[3] = __('Type');
$table->head[4] = __('Interval');
$table->head[5] = __('Description');
$table->head[6] = __('Max/Min');
$table->head[7] = __('Action');
$table->style = array ();
$table->style[0] = 'font-weight: bold';
$table->size = array ();
$table->size[6] = '65px';
$table->size[2] = '35px';
$table->size[7] = '65px';
$table->align = array ();
$table->align[1] = 'center';
$table->align[6] = 'center';
$table->align[2] = 'left';
$table->align[7] = 'left';
$table->data = array ();
$agent_interval = get_agent_interval ($id_agente);
@ -186,7 +189,10 @@ foreach ($modules as $module) {
$data[0] = '<strong>'.get_modulegroup_name ($last_modulegroup).'</strong>';
$i = array_push ($table->data, $data);
$table->rowclass[$i - 1] = 'datos3';
$table->colspan[$i - 1][0] = 7;
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK)
$table->colspan[$i - 1][0] = 8;
else
$table->colspan[$i - 1][0] = 7;
$data = array ();
}
@ -198,52 +204,65 @@ foreach ($modules as $module) {
$data[0] .= $module['nombre'];
$data[0] .= '</a>';
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
$policyInfo = isModuleInPolicy($module['id_agente_modulo'], false);
if ($policyInfo === false)
$data[1] = '';
else {
$img = 'images/policies.png';
$data[1] = '<a href="?sec=gpolicies&sec2=enterprise/godmode/policies/policies&id=' . $policyInfo['id_policy'] . '">' .
print_image($img,true, array('title' => $policyInfo['name_policy'])) .
'</a>';
}
}
// Module type (by server type )
$data[1] = '';
$data[2] = '';
if ($module['id_modulo'] > 0) {
$data[1] = show_server_type ($module['id_modulo']);
$data[2] = show_server_type ($module['id_modulo']);
}
// This module is initialized ? (has real data)
$module_init = get_db_value ('utimestamp', 'tagente_estado', 'id_agente_modulo', $module['id_agente_modulo']);
if ($module_init == 0)
$data[1] .= print_image ('images/error.png', true, array ('title' => __('Non initialized module')));
$data[2] .= print_image ('images/error.png', true, array ('title' => __('Non initialized module')));
// Module type (by data type)
$data[2] = '';
$data[3] = '';
if ($type) {
$data[2] = print_moduletype_icon ($type, true);
$data[3] = print_moduletype_icon ($type, true);
}
// Module interval
if ($module['module_interval']) {
$data[3] = $module['module_interval'];
$data[4] = $module['module_interval'];
} else {
$data[3] = $agent_interval;
$data[4] = $agent_interval;
}
$data[4] = substr ($module['descripcion'], 0, 30);
$data[5] = substr ($module['descripcion'], 0, 30);
// MAX / MIN values
$data[5] = $module["max"] ? $module["max"] : __('N/A');
$data[5] .= ' / '.($module["min"] != $module['max']? $module["min"] : __('N/A'));
$data[6] = $module["max"] ? $module["max"] : __('N/A');
$data[6] .= ' / '.($module["min"] != $module['max']? $module["min"] : __('N/A'));
// Delete module
$data[6] = print_checkbox('id_delete[]', $module['id_agente_modulo'], false, true);
$data[6] .= '<a href="index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&delete_module='.$module['id_agente_modulo'].'"
$data[7] = print_checkbox('id_delete[]', $module['id_agente_modulo'], false, true);
$data[7] .= '<a href="index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&delete_module='.$module['id_agente_modulo'].'"
onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
$data[6] .= print_image ('images/cross.png', true,
$data[7] .= print_image ('images/cross.png', true,
array ('title' => __('Delete')));
$data[6] .= '</a> ';
$data[7] .= '</a> ';
// Make a data normalization
if (isset($numericModules[$type])) {
if ($numericModules[$type] === true) {
$data[6] .= '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&tab=module&fix_module='.$module['id_agente_modulo'].'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
$data[6] .= print_image ('images/chart_curve.png', true,
$data[7] .= '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&tab=module&fix_module='.$module['id_agente_modulo'].'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
$data[7] .= print_image ('images/chart_curve.png', true,
array ('title' => __('Normalize')));
$data[6] .= '</a>';
$data[7] .= '</a>';
}
}

View File

@ -97,6 +97,7 @@ if (! give_acl ($config['id_user'], 0, "LW")) {
require_once ('include/functions_agents.php');
require_once ('include/functions_alerts.php');
$isFunctionPolicies = enterprise_include ('include/functions_policies.php');
$create_alert = (bool) get_parameter ('create_alert');
$add_action = (bool) get_parameter ('add_action');
@ -321,22 +322,32 @@ if (! $id_agente) {
$table->size[1] = '15%';
$table->size[2] = '20%';
$table->size[3] = '15%';
$table->size[4] = '50%';
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
$table->size[4] = '20px';
}
$table->size[5] = '50%';
} else {
/* Different sizes or the layout screws up */
$table->size[0] = '20px';
$table->size[2] = '30%';
$table->size[3] = '20%';
$table->size[4] = '50%';
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
$table->size[4] = '20px';
}
$table->size[5] = '50%';
}
$table->head[2] = __('Module');
$table->head[3] = __('Template');
$table->head[4] = __('Actions');
$table->head[5] = '';
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
$table->head[4] = "<span title='" . __('Policy') . "'>" . __('P.') . "</span>";
}
$table->head[5] = __('Actions');
$table->head[6] = '';
$table->data = array ();
$rowPair = true;
$iterator = 0;
foreach ($simple_alerts as $alert) {
if ($rowPair)
$table->rowclass[$iterator] = 'rowPair';
@ -351,7 +362,8 @@ foreach ($simple_alerts as $alert) {
if ($alert['disabled']) {
$data[0] .= print_input_image ('enable', 'images/lightbulb_off.png', 1, '', true);
$data[0] .= print_input_hidden ('enable_alert', 1, true);
} else {
}
else {
$data[0] .= print_input_image ('disable', 'images/lightbulb.png', 1, '', true);
$data[0] .= print_input_hidden ('disable_alert', 1, true);
}
@ -370,51 +382,64 @@ foreach ($simple_alerts as $alert) {
<img id="template-details-'.$alert['id_alert_template'].'" class="img_help" src="images/zoom.png"/></a> ';
$data[3] .= get_alert_template_name ($alert['id_alert_template']);
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
$policyInfo = isAlertInPolicy($alert['id_agent_module'], $alert['id_alert_template'], false);
if ($policyInfo === false)
$data[1] = '';
else {
$img = 'images/policies.png';
$data[1] = '<a href="?sec=gpolicies&sec2=enterprise/godmode/policies/policies&id=' . $policyInfo['id_policy'] . '">' .
print_image($img,true, array('title' => $policyInfo['name_policy'])) .
'</a>';
}
}
$actions = get_alert_agent_module_actions ($alert['id']);
$data[4] = '<ul class="action_list">';
$data[5] = '<ul class="action_list">';
foreach ($actions as $action_id => $action) {
$data[4] .= '<li><div>';
$data[4] .= '<span class="action_name">';
$data[4] .= $action['name'];
$data[4] .= ' <em>(';
$data[5] .= '<li><div>';
$data[5] .= '<span class="action_name">';
$data[5] .= $action['name'];
$data[5] .= ' <em>(';
if ($action['fires_min'] == $action['fires_max']) {
if ($action['fires_min'] == 0)
$data[4] .= __('Always');
$data[5] .= __('Always');
else
$data[4] .= __('On').' '.$action['fires_min'];
$data[5] .= __('On').' '.$action['fires_min'];
} else {
if ($action['fires_min'] == 0)
$data[4] .= __('Until').' '.$action['fires_max'];
$data[5] .= __('Until').' '.$action['fires_max'];
else
$data[4] .= __('From').' '.$action['fires_min'].
$data[5] .= __('From').' '.$action['fires_min'].
' '.__('to').' '.$action['fires_max'];
}
$data[4] .= ')</em>';
$data[4] .= '</span>';
$data[4] .= ' <span class="delete" style="clear:right">';
$data[4] .= '<form method="post" class="delete_link">';
$data[4] .= print_input_image ('delete', 'images/cross.png', 1, '', true);
$data[4] .= print_input_hidden ('delete_action', 1, true);
$data[4] .= print_input_hidden ('id_alert', $alert['id'], true);
$data[4] .= print_input_hidden ('id_action', $action_id, true);
$data[4] .= '</form>';
$data[4] .= '</span>';
$data[4] .= '</div></li>';
$data[5] .= ')</em>';
$data[5] .= '</span>';
$data[5] .= ' <span class="delete" style="clear:right">';
$data[5] .= '<form method="post" class="delete_link">';
$data[5] .= print_input_image ('delete', 'images/cross.png', 1, '', true);
$data[5] .= print_input_hidden ('delete_action', 1, true);
$data[5] .= print_input_hidden ('id_alert', $alert['id'], true);
$data[5] .= print_input_hidden ('id_action', $action_id, true);
$data[5] .= '</form>';
$data[5] .= '</span>';
$data[5] .= '</div></li>';
}
$data[4] .= '</ul>';
$data[5] .= '</ul>';
$data[4] .= '<a class="add_action" id="add-action-'.$alert['id'].'" href="#">';
$data[4] .= print_image ('images/add.png', true);
$data[4] .= ' '.__('Add action');
$data[4] .= '</a>';
$data[5] .= '<a class="add_action" id="add-action-'.$alert['id'].'" href="#">';
$data[5] .= print_image ('images/add.png', true);
$data[5] .= ' '.__('Add action');
$data[5] .= '</a>';
$data[5] = '<form class="delete_alert_form" method="post" style="display: inline;">';
$data[6] = '<form class="delete_alert_form" method="post" style="display: inline;">';
$data[5] .= print_input_image ('delete', 'images/cross.png', 1, '', true);
$data[5] .= print_input_hidden ('delete_alert', 1, true);
$data[5] .= print_input_hidden ('id_alert', $alert['id'], true);
$data[5] .= '</form>';
$data[6] .= print_input_image ('delete', 'images/cross.png', 1, '', true);
$data[6] .= print_input_hidden ('delete_alert', 1, true);
$data[6] .= print_input_hidden ('id_alert', $alert['id'], true);
$data[6] .= '</form>';
array_push ($table->data, $data);
}

View File

@ -607,13 +607,6 @@ if (isset($module_array)){
echo "<input type='hidden' name='period' value='$period'>";
echo "<input type='hidden' name='events' value='$events'>";
echo "<input type='hidden' name='stacked' value='$stacked'>";
debugPrint($module_array);
debugPrint($width);
debugPrint($height);
debugPrint($period);
debugPrint($events);
debugPrint($stacked);
for ($a=0; $a < count($module_array); $a++){
$id_agentemodulo = $module_array[$a];

View File

@ -56,7 +56,7 @@ if ($delete_graph) {
echo "<h2>".__('Reporting')." &raquo; " . __('Graphs management').'</h2>';
$graphs = get_user_custom_graphs ();
//debugPrint($graphs);
if (! empty ($graphs)) {
$table->width = '650px';
$tale->class = 'databox_frame';

View File

@ -202,7 +202,6 @@ if (give_acl ($config['id_user'], 0, "AR")) {
/**
* Add the extensions
*/
//debugPrint($config['extensions']);
foreach($config['extensions'] as $extension) {
$operationModeMenu = $extension['operation_menu'];
if ($operationModeMenu == null)