2012-07-24 Miguel de Dios <miguel.dedios@artica.es>

* operation/messages/message_edit.php,
	operation/reporting/reporting_xml.php,
	operation/reporting/graph_viewer.php,
	operation/agentes/exportdata.php, operation/agentes/group_view.php,
	operation/agentes/status_monitor.php,
	godmode/agentes/configurar_agente.php, include/functions_agents.php:
	cleaned source code style.
	
	* godmode/agentes/module_manager.php: fixed the messages for to
	delete multiple modules.
	
	Fixes: #3543532




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6807 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2012-07-25 09:59:03 +00:00
parent b11e18e18d
commit e6ae8a76e0
10 changed files with 169 additions and 122 deletions

View File

@ -1,3 +1,18 @@
2012-07-24 Miguel de Dios <miguel.dedios@artica.es>
* operation/messages/message_edit.php,
operation/reporting/reporting_xml.php,
operation/reporting/graph_viewer.php,
operation/agentes/exportdata.php, operation/agentes/group_view.php,
operation/agentes/status_monitor.php,
godmode/agentes/configurar_agente.php, include/functions_agents.php:
cleaned source code style.
* godmode/agentes/module_manager.php: fixed the messages for to
delete multiple modules.
Fixes: #3543532
2012-07-24 Miguel de Dios <miguel.dedios@artica.es> 2012-07-24 Miguel de Dios <miguel.dedios@artica.es>
* godmode/setup/file_manager.php, godmode/setup/news.php, * godmode/setup/file_manager.php, godmode/setup/news.php,

View File

@ -977,7 +977,7 @@ if ($delete_module) { // DELETE agent module !
$result = db_process_sql_delete('tagente_datos_inc', array('id_agente_modulo' => $id_borrar_modulo)); $result = db_process_sql_delete('tagente_datos_inc', array('id_agente_modulo' => $id_borrar_modulo));
if ($result === false) if ($result === false)
$error++; $error++;
if (alerts_delete_alert_agent_module($id_borrar_modulo) === false) if (alerts_delete_alert_agent_module($id_borrar_modulo) === false)
$error++; $error++;

View File

@ -31,7 +31,8 @@ $search_string = io_safe_output(urldecode(trim(get_parameter ("search_string", "
echo '<form id="create_module_type" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agente.'">'; echo '<form id="create_module_type" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agente.'">';
echo '<table width="98%" cellpadding="2" cellspacing="2" class="databox" >'; echo '<table width="98%" cellpadding="2" cellspacing="2" class="databox" >';
echo "<tr><td class='datos' style='width:25%'>"; echo "<tr><td class='datos' style='width:25%'>";
echo __('Search').' '.html_print_input_text ('search_string', $search_string, '', 15, 255, true); echo __('Search') . ' ' .
html_print_input_text ('search_string', $search_string, '', 15, 255, true);
echo "</td>"; echo "</td>";
echo "<td class='datos' style='width:25%'>"; echo "<td class='datos' style='width:25%'>";
html_print_submit_button (__('Filter'), 'filter', false, 'class="sub search"'); html_print_submit_button (__('Filter'), 'filter', false, 'class="sub search"');
@ -92,13 +93,14 @@ echo "</table>";
if (! isset ($id_agente)) if (! isset ($id_agente))
return; return;
$multiple_delete = (bool) get_parameter('multiple_delete'); $multiple_delete = (bool) get_parameter('multiple_delete');
if ($multiple_delete) { if ($multiple_delete) {
$id_agent_modules_delete = (array)get_parameter('id_delete'); $id_agent_modules_delete = (array)get_parameter('id_delete');
$count_correct_delete_modules = 0;
foreach($id_agent_modules_delete as $id_agent_module_del) { foreach($id_agent_modules_delete as $id_agent_module_del) {
$id_grupo = (int) agents_get_agent_group($id_agente); $id_grupo = (int) agents_get_agent_group($id_agente);
@ -112,7 +114,7 @@ if ($multiple_delete) {
if ($id_agent_module_del < 1) { if ($id_agent_module_del < 1) {
db_pandora_audit("HACK Attempt", db_pandora_audit("HACK Attempt",
"Expected variable from form is not correct"); "Expected variable from form is not correct");
die ("Nice try buddy"); die (__("Nice try buddy"));
exit; exit;
} }
@ -130,14 +132,14 @@ if ($multiple_delete) {
if (db_process_sql("UPDATE tagente_modulo if (db_process_sql("UPDATE tagente_modulo
SET nombre = 'pendingdelete', disabled = 1, delete_pending = 1 WHERE id_agente_modulo = ".$id_agent_module_del, "affected_rows", '', true, $status, false) === false) SET nombre = 'pendingdelete', disabled = 1, delete_pending = 1 WHERE id_agente_modulo = ".$id_agent_module_del, "affected_rows", '', true, $status, false) === false)
$error++; $error++;
switch ($config["dbtype"]) { switch ($config["dbtype"]) {
case "mysql": case "mysql":
case "postgresql": case "postgresql":
$result = db_process_sql_delete('tagente_estado', array('id_agente_modulo' => $id_agent_module_del)); $result = db_process_sql_delete('tagente_estado', array('id_agente_modulo' => $id_agent_module_del));
if ($result === false) if ($result === false)
$error++; $error++;
$result = db_process_sql_delete('tagente_datos_inc', array('id_agente_modulo' => $id_agent_module_del)); $result = db_process_sql_delete('tagente_datos_inc', array('id_agente_modulo' => $id_agent_module_del));
if ($result === false) if ($result === false)
$error++; $error++;
@ -150,8 +152,7 @@ if ($multiple_delete) {
if ($result === false) if ($result === false)
$error++; $error++;
break; break;
}
}
// Trick to detect if we are deleting a synthetic module (avg or arithmetic) // Trick to detect if we are deleting a synthetic module (avg or arithmetic)
// If result is empty then module doesn't have this type of submodules // If result is empty then module doesn't have this type of submodules
@ -177,22 +178,38 @@ if ($multiple_delete) {
$update_orders = false; $update_orders = false;
$result = enterprise_hook('modules_delete_synthetic_operations', array($id_target_module, $id_agent_module_del, $update_orders)); $result = enterprise_hook('modules_delete_synthetic_operations', array($id_target_module, $id_agent_module_del, $update_orders));
if ($result === false) if ($result === false)
$error++; $error++;
$count_components++; $count_components++;
$last_target_module = $id_target_module; $last_target_module = $id_target_module;
} }
} }
} }
//Check for errors //Check for errors
if ($error != 0) { if ($error != 0) {
db_process_sql_rollback (); db_process_sql_rollback ();
ui_print_error_message (__('There was a problem deleting the module'));
} }
else { else {
db_process_sql_commit (); db_process_sql_commit ();
ui_print_success_message (__('Module deleted succesfully')); $count_correct_delete_modules++;
}
}
$count_modules_to_delete = count($id_agent_modules_delete);
if ($count_correct_delete_modules == 0) {
ui_print_error_message(
sprintf(__('There was a problem deleting %s modules, none deleted.'),
$count_modules_to_delete));
}
else {
if ($count_correct_delete_modules == $count_modules_to_delete) {
ui_print_success_message (__('All Modules deleted succesfully'));
}
else {
ui_print_error_message(
sprintf(__('There was a problem only deleted %s modules of %s total.'),
count_correct_delete_modules, $count_modules_to_delete));
} }
} }
} }
@ -224,7 +241,7 @@ switch ($sortField) {
$selectNameUp = $selected; $selectNameUp = $selected;
switch ($config["dbtype"]) { switch ($config["dbtype"]) {
case "mysql": case "mysql":
case "postgresql": case "postgresql":
$order[] = array('field' => 'tagente_modulo.nombre', 'order' => 'ASC'); $order[] = array('field' => 'tagente_modulo.nombre', 'order' => 'ASC');
break; break;
case "oracle": case "oracle":
@ -242,7 +259,7 @@ switch ($sortField) {
case "oracle": case "oracle":
$order[] = array('field' => 'dbms_lob.substr(tagente_modulo.nombre,4000,1)', 'order' => 'DESC'); $order[] = array('field' => 'dbms_lob.substr(tagente_modulo.nombre,4000,1)', 'order' => 'DESC');
break; break;
} }
break; break;
} }
break; break;
@ -305,13 +322,13 @@ switch ($sortField) {
// TODO: CLEAN extra_sql // TODO: CLEAN extra_sql
$extra_sql = ''; $extra_sql = '';
// Build the order sql // Build the order sql
if(!empty($order)) { if (!empty($order)) {
$order_sql = ' ORDER BY '; $order_sql = ' ORDER BY ';
} }
$first = true; $first = true;
foreach($order as $ord) { foreach ($order as $ord) {
if($first) { if($first) {
$first = false; $first = false;
} }
@ -326,12 +343,13 @@ foreach($order as $ord) {
$limit = (int) $config["block_size"]; $limit = (int) $config["block_size"];
$offset = (int) get_parameter ('offset'); $offset = (int) get_parameter ('offset');
$params = implode(',', array ('id_agente_modulo', 'id_tipo_modulo', 'descripcion', 'nombre', $params = implode(',', array ('id_agente_modulo', 'id_tipo_modulo',
'max', 'min', 'module_interval', 'id_modulo', 'id_module_group', 'descripcion', 'nombre', 'max', 'min', 'module_interval',
'disabled','max_warning', 'min_warning', 'str_warning', 'id_modulo', 'id_module_group', 'disabled','max_warning',
'max_critical', 'min_critical', 'str_critical')); 'min_warning', 'str_warning', 'max_critical', 'min_critical',
'str_critical'));
$where = sprintf("delete_pending = 0 AND id_agente = %s", $id_agente);
$where = sprintf("delete_pending = 0 AND id_agente = %s", $id_agente);
$search_string_entities = io_safe_input($search_string); $search_string_entities = io_safe_input($search_string);
@ -344,26 +362,32 @@ switch ($config["dbtype"]) {
if(!isset($limit_sql)) { if(!isset($limit_sql)) {
$limit_sql = " LIMIT $offset, $limit "; $limit_sql = " LIMIT $offset, $limit ";
} }
$sql = sprintf("SELECT %s FROM tagente_modulo WHERE %s (%s %s) %s %s", $sql = sprintf("SELECT %s
$params, $basic_where, $extra_sql, $where, $order_sql, $limit_sql); FROM tagente_modulo
WHERE %s (%s %s) %s %s",
$params, $basic_where, $extra_sql, $where, $order_sql, $limit_sql);
$modules = db_get_all_rows_sql($sql); $modules = db_get_all_rows_sql($sql);
break; break;
case "oracle": case "oracle":
$set = array(); $set = array();
$set['limit'] = $limit; $set['limit'] = $limit;
$set['offset'] = $offset; $set['offset'] = $offset;
$sql = sprintf("SELECT %s FROM tagente_modulo WHERE %s (%s %s) %s", $sql = sprintf("SELECT %s
$params, $basic_where, $extra_sql, $where, $order_sql); FROM tagente_modulo
WHERE %s (%s %s) %s",
$params, $basic_where, $extra_sql, $where, $order_sql);
$modules = oracle_recode_query ($sql, $set, 'AND', false); $modules = oracle_recode_query ($sql, $set, 'AND', false);
break; break;
} }
$sql_total_modules = sprintf("SELECT count(*) FROM tagente_modulo WHERE %s (%s %s)", $basic_where, $extra_sql, $where); $sql_total_modules = sprintf("SELECT count(*)
FROM tagente_modulo
WHERE %s (%s %s)", $basic_where, $extra_sql, $where);
$total_modules = db_get_value_sql($sql_total_modules); $total_modules = db_get_value_sql($sql_total_modules);
$total_modules = isset ($total_modules) ? $total_modules : 0; $total_modules = isset ($total_modules) ? $total_modules : 0;
if ($modules === false) { if ($modules === false) {
echo "<div class='nf'>".__('No available data to show')."</div>"; echo "<div class='nf'>".__('No available data to show')."</div>";
@ -421,11 +445,11 @@ foreach($tempRows as $row) {
foreach ($modules as $module) { foreach ($modules as $module) {
$is_extra = enterprise_hook('policies_is_module_extra_policy', array($module["id_agente_modulo"])); $is_extra = enterprise_hook('policies_is_module_extra_policy', array($module["id_agente_modulo"]));
if($is_extra === ENTERPRISE_NOT_HOOK) { if($is_extra === ENTERPRISE_NOT_HOOK) {
$is_extra = false; $is_extra = false;
} }
if (! check_acl ($config["id_user"], $group, "AW", $id_agente) && !$is_extra) { if (! check_acl ($config["id_user"], $group, "AW", $id_agente) && !$is_extra) {
continue; continue;
} }
@ -571,4 +595,4 @@ html_print_input_hidden ('multiple_delete', 1);
html_print_submit_button (__('Delete'), 'multiple_delete', false, 'class="sub delete"'); html_print_submit_button (__('Delete'), 'multiple_delete', false, 'class="sub delete"');
echo '</div>'; echo '</div>';
echo '</form>' echo '</form>'
?> ?>

View File

@ -1702,7 +1702,6 @@ function agents_get_status($id_agent = 0, $noACLs = false) {
else { else {
return AGENT_MODULE_STATUS_NORMAL; return AGENT_MODULE_STATUS_NORMAL;
} }
} }
/** /**
@ -1948,7 +1947,6 @@ function agents_monitor_unknown ($id_agent, $filter="") {
} }
// Get ok monitors by using the status code in modules. // Get ok monitors by using the status code in modules.
function agents_monitor_ok ($id_agent, $filter="") { function agents_monitor_ok ($id_agent, $filter="") {
if ($filter) { if ($filter) {

View File

@ -304,37 +304,39 @@ if (empty($export_btn)) {
//Agent selector //Agent selector
$table->data[1][0] = '<b>'.__('Source agent').'</b>'; $table->data[1][0] = '<b>'.__('Source agent').'</b>';
if ($group > 0) { if ($group > 0) {
$filter['id_grupo'] = (array) $group; $filter['id_grupo'] = (array) $group;
} else { }
else {
$filter['id_grupo'] = array_keys ($groups); $filter['id_grupo'] = array_keys ($groups);
} }
$agents = array (); $agents = array ();
$rows = agents_get_agents ($filter, false, 'AR'); $rows = agents_get_agents ($filter, false, 'AR');
if ($rows == null) $rows = array(); if ($rows == null) $rows = array();
foreach ($rows as $row) { foreach ($rows as $row) {
$agents[$row['id_agente']] = $row['nombre']; $agents[$row['id_agente']] = $row['nombre'];
} }
//Src code of lightning image with skins //Src code of lightning image with skins
$src_code = html_print_image ('images/lightning.png', true, false, true); $src_code = html_print_image ('images/lightning.png', true, false, true);
$table->data[1][1] = html_print_input_text_extended ('agent', agents_get_name ($agent), 'text-agent', '', 40, 100, false, '', $table->data[1][1] = html_print_input_text_extended ('agent', agents_get_name ($agent), 'text-agent', '', 40, 100, false, '',
array('style' => "background: url($src_code) no-repeat right;"), true) array('style' => "background: url($src_code) no-repeat right;"), true)
. '<a href="#" class="tip">&nbsp;<span>' . __("Type at least two characters to search") . '</span></a>'; . '<a href="#" class="tip">&nbsp;<span>' . __("Type at least two characters to search") . '</span></a>';
//Module selector //Module selector
$table->data[2][0] = '<b>'.__('Modules').'</b>'; $table->data[2][0] = '<b>'.__('Modules').'</b>';
$table->data[2][0] .= ui_print_help_tip(__("No modules of type string. You can not calculate their average"),true); $table->data[2][0] .= ui_print_help_tip(__("No modules of type string. You can not calculate their average"),true);
if ($agent > 0) { if ($agent > 0) {
$modules = agents_get_modules ($agent); $modules = agents_get_modules ($agent);
} else { }
else {
$modules = array (); $modules = array ();
} }
if(!empty($modules)) { //remove modules of type string because you cant calculate their average. if(!empty($modules)) { //remove modules of type string because you cant calculate their average.
$i = 0; $i = 0;
foreach ($modules as $key=>$module) { foreach ($modules as $key=>$module) {
@ -351,40 +353,40 @@ if (empty($export_btn)) {
$i++; $i++;
} }
} }
$disabled_export_button = false; $disabled_export_button = false;
if (empty($modules)) { if (empty($modules)) {
$disabled_export_button = true; $disabled_export_button = true;
} }
$table->data[2][1] = html_print_select ($modules, "module_arr[]", array_keys ($modules), '', '', 0, true, true, true, 'w155', false); $table->data[2][1] = html_print_select ($modules, "module_arr[]", array_keys ($modules), '', '', 0, true, true, true, 'w155', false);
//Start date selector //Start date selector
$table->data[3][0] = '<b>'.__('Begin date').'</b>'; $table->data[3][0] = '<b>'.__('Begin date').'</b>';
$table->data[3][1] = html_print_input_text ('start_date', date ("Y-m-d", get_system_time () - 86400), false, 10, 10, true); $table->data[3][1] = html_print_input_text ('start_date', date ("Y-m-d", get_system_time () - 86400), false, 10, 10, true);
$table->data[3][1] .= html_print_image ("images/calendar_view_day.png", true, array ("alt" => "calendar", "onclick" => "scwShow(scwID('text-start_date'),this);")); $table->data[3][1] .= html_print_image ("images/calendar_view_day.png", true, array ("alt" => "calendar", "onclick" => "scwShow(scwID('text-start_date'),this);"));
$table->data[3][1] .= html_print_input_text ('start_time', date ("H:i", get_system_time () - 86400), false, 10, 5, true); $table->data[3][1] .= html_print_input_text ('start_time', date ("H:i", get_system_time () - 86400), false, 10, 5, true);
//End date selector //End date selector
$table->data[4][0] = '<b>'.__('End date').'</b>'; $table->data[4][0] = '<b>'.__('End date').'</b>';
$table->data[4][1] = html_print_input_text ('end_date', date ("Y-m-d", get_system_time ()), false, 10, 10, true); $table->data[4][1] = html_print_input_text ('end_date', date ("Y-m-d", get_system_time ()), false, 10, 10, true);
$table->data[4][1] .= html_print_image ("images/calendar_view_day.png", true, array ("alt" => "calendar", "onclick" => "scwShow(scwID('text-end_date'),this);")); $table->data[4][1] .= html_print_image ("images/calendar_view_day.png", true, array ("alt" => "calendar", "onclick" => "scwShow(scwID('text-end_date'),this);"));
$table->data[4][1] .= html_print_input_text ('end_time', date ("H:i", get_system_time ()), false, 10, 5, true); $table->data[4][1] .= html_print_input_text ('end_time', date ("H:i", get_system_time ()), false, 10, 5, true);
//Export type //Export type
$table->data[5][0] = '<b>'.__('Export type').'</b>'; $table->data[5][0] = '<b>'.__('Export type').'</b>';
$export_types = array (); $export_types = array ();
$export_types["data"] = __('Data table'); $export_types["data"] = __('Data table');
$export_types["csv"] = __('CSV'); $export_types["csv"] = __('CSV');
$export_types["excel"] = __('MS Excel'); $export_types["excel"] = __('MS Excel');
$export_types["avg"] = __('Average per hour/day'); $export_types["avg"] = __('Average per hour/day');
$table->data[5][1] = html_print_select ($export_types, "export_type", $export_type, '', '', 0, true, false, true, 'w130', false); $table->data[5][1] = html_print_select ($export_types, "export_type", $export_type, '', '', 0, true, false, true, 'w130', false);
html_print_table ($table); html_print_table ($table);
// Submit button // Submit button
echo '<div class="action-buttons" style="width:98%;">'; echo '<div class="action-buttons" style="width:98%;">';
html_print_button (__('Export'), 'export_btn', $disabled_export_button, 'change_action()', 'class="sub wand"'); html_print_button (__('Export'), 'export_btn', $disabled_export_button, 'change_action()', 'class="sub wand"');
@ -483,7 +485,7 @@ $(document).ready (function () {
function change_action() { function change_action() {
type = $("#export_type").val(); type = $("#export_type").val();
var f = document.forms.export_form; var f = document.forms.export_form;
switch (type) { switch (type) {
case 'csv': case 'csv':
f.action = "operation/agentes/exportdata.csv.php"; f.action = "operation/agentes/exportdata.csv.php";
@ -505,4 +507,4 @@ function submit_group() {
f.form.submit(); f.form.submit();
} }
/* ]]> */ /* ]]> */
</script> </script>

View File

@ -66,7 +66,8 @@ foreach($groups_full as $group) {
if ($config["realtimestats"] == 0){ if ($config["realtimestats"] == 0){
$updated_time = __('Last update'). " : ". ui_print_timestamp (db_get_sql ("SELECT min(utimestamp) FROM tgroup_stat"), true); $updated_time = __('Last update'). " : ". ui_print_timestamp (db_get_sql ("SELECT min(utimestamp) FROM tgroup_stat"), true);
} else { }
else {
$updated_time = __("Updated at realtime"); $updated_time = __("Updated at realtime");
} }
@ -81,32 +82,31 @@ $counter = 1;
$agents = agents_get_group_agents(array_keys($groups)); $agents = agents_get_group_agents(array_keys($groups));
if (count($agents) > 0) { if (count($agents) > 0) {
echo '<table cellpadding="0" style="margin-top:10px" cellspacing="0" border="0" width="98%">';
echo '<table cellpadding="0" style="margin-top:10px" cellspacing="0" border="0" width="98%">'; echo "<tr>";
echo "<th width='25%'>".__("Group")."</th>";
echo "<tr>"; echo "<th>";
echo "<th width='25%'>".__("Group")."</th>"; echo "<th width='10%'>".__("Agents")."</th>";
echo "<th>"; echo "<th width='10%'>".__("Agent unknown")."</th>";
echo "<th width='10%'>".__("Agents")."</th>"; echo "<th width='10%'>".__("Unknown")."</th>";
echo "<th width='10%'>".__("Agent unknown")."</th>"; echo "<th width='10%'>".__("Not Init")."</th>";
echo "<th width='10%'>".__("Unknown")."</th>"; echo "<th width='10%'>".__("Normal")."</th>";
echo "<th width='10%'>".__("Not Init")."</th>"; echo "<th width='10%'>".__("Warning")."</th>";
echo "<th width='10%'>".__("Normal")."</th>"; echo "<th width='10%'>".__("Critical")."</th>";
echo "<th width='10%'>".__("Warning")."</th>"; echo "<th width='10%'>".__("Alert fired")."</th>";
echo "<th width='10%'>".__("Critical")."</th>";
echo "<th width='10%'>".__("Alert fired")."</th>"; $printed_groups = array();
$printed_groups = array(); // For each valid group for this user, take data from agent and modules
foreach ($groups as $id_group => $group) {
// For each valid group for this user, take data from agent and modules groups_get_group_row($id_group, $groups, $group, $printed_groups);
foreach ($groups as $id_group => $group) { }
groups_get_group_row($id_group, $groups, $group, $printed_groups);
echo "</table>";
} }
else {
echo "</table>"; echo "<div class='nf'>" . __('There are no defined agents') .
"</div>";
} else {
echo "<div class='nf'>".__('There are no defined agents')."</div>";
} }
?> ?>

View File

@ -328,9 +328,9 @@ switch ($sortField) {
// Begin Build SQL sentences // Begin Build SQL sentences
$sql = " FROM tagente, tagente_modulo, tagente_estado $sql = " FROM tagente, tagente_modulo, tagente_estado
WHERE $sql_extra (tagente.id_agente = tagente_modulo.id_agente WHERE $sql_extra (tagente.id_agente = tagente_modulo.id_agente
AND tagente_modulo.disabled = 0 AND tagente_modulo.disabled = 0
AND tagente.disabled = 0 AND tagente.disabled = 0
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo"; AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo";
// Agent group selector // Agent group selector
if ($ag_group > 0 && check_acl ($config["id_user"], $ag_group, "AR")) { if ($ag_group > 0 && check_acl ($config["id_user"], $ag_group, "AR")) {
@ -453,7 +453,7 @@ switch ($config["dbtype"]) {
tagente_modulo.max_critical, tagente_modulo.max_critical,
tagente_modulo.str_critical, tagente_modulo.str_critical,
tagente_modulo.extended_info, tagente_modulo.extended_info,
tagente_estado.utimestamp AS utimestamp".$sql; tagente_estado.utimestamp AS utimestamp" . $sql;
$sql = oracle_recode_query ($sql, $set); $sql = oracle_recode_query ($sql, $set);
break; break;
} }
@ -469,7 +469,7 @@ if ($result === false) {
if (($config['dbtype'] == 'oracle') && ($result !== false)) { if (($config['dbtype'] == 'oracle') && ($result !== false)) {
for ($i=0; $i < count($result); $i++) { for ($i=0; $i < count($result); $i++) {
unset($result[$i]['rnum']); unset($result[$i]['rnum']);
} }
} }
@ -568,7 +568,7 @@ foreach ($result as $row) {
$title = __('(Unlinked) ') . $policyInfo['name_policy']; $title = __('(Unlinked) ') . $policyInfo['name_policy'];
} }
} }
$data[0] = '<a href="?sec=gpolicies&amp;sec2=enterprise/godmode/policies/policies&amp;id=' . $policyInfo['id_policy'] . '">' . $data[0] = '<a href="?sec=gpolicies&amp;sec2=enterprise/godmode/policies/policies&amp;id=' . $policyInfo['id_policy'] . '">' .
html_print_image($img,true, array('title' => $title)) . html_print_image($img,true, array('title' => $title)) .
'</a>'; '</a>';
@ -625,18 +625,18 @@ foreach ($result as $row) {
$handle = "stat".$nombre_tipo_modulo."_".$row["id_agente_modulo"]; $handle = "stat".$nombre_tipo_modulo."_".$row["id_agente_modulo"];
$url = 'include/procesos.php?agente='.$row["id_agente_modulo"]; $url = 'include/procesos.php?agente='.$row["id_agente_modulo"];
$win_handle=dechex(crc32($row["id_agente_modulo"].$row["module_name"])); $win_handle=dechex(crc32($row["id_agente_modulo"].$row["module_name"]));
$link ="winopeng('operation/agentes/stat_win.php?type=$graph_type&period=86400&id=".$row["id_agente_modulo"]."&label=".base64_encode($row["module_name"])."&refresh=600','day_".$win_handle."')"; $link ="winopeng('operation/agentes/stat_win.php?type=$graph_type&period=86400&id=".$row["id_agente_modulo"]."&label=".base64_encode($row["module_name"])."&refresh=600','day_".$win_handle."')";
$data[6] = '<a href="javascript:'.$link.'">' . html_print_image("images/chart_curve.png", true, array("border" => '0', "alt" => "")) . '</a>'; $data[6] = '<a href="javascript:'.$link.'">' . html_print_image("images/chart_curve.png", true, array("border" => '0', "alt" => "")) . '</a>';
$data[6] .= "&nbsp;<a href='index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente=".$row["id_agent"]."&amp;tab=data_view&period=86400&amp;id=".$row["id_agente_modulo"]."'>" . html_print_image('images/binary.png', true, array("style" => '0', "alt" => '')) . "</a>"; $data[6] .= "&nbsp;<a href='index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente=".$row["id_agent"]."&amp;tab=data_view&period=86400&amp;id=".$row["id_agente_modulo"]."'>" . html_print_image('images/binary.png', true, array("style" => '0', "alt" => '')) . "</a>";
} }
$data[7] = ui_print_module_warn_value($row['max_warning'], $row['min_warning'], $row['str_warning'], $row['max_critical'], $row['min_critical'], $row['str_critical']); $data[7] = ui_print_module_warn_value($row['max_warning'], $row['min_warning'], $row['str_warning'], $row['max_critical'], $row['min_critical'], $row['str_critical']);
if (is_numeric($row["datos"])){ if (is_numeric($row["datos"])){
$salida = format_numeric($row["datos"]); $salida = format_numeric($row["datos"]);
// Show units ONLY in numeric data types // Show units ONLY in numeric data types
if (isset($row["unit"])){ if (isset($row["unit"])){
$salida .= "&nbsp;" . '<i>'. io_safe_output($row["unit"]) . '</i>'; $salida .= "&nbsp;" . '<i>'. io_safe_output($row["unit"]) . '</i>';
@ -659,9 +659,9 @@ foreach ($result as $row) {
title='". $module_value ."' style='white-space: nowrap;'>" . title='". $module_value ."' style='white-space: nowrap;'>" .
'<span id="value_module_text_' . $row["id_agente_modulo"] . '">' . $sub_string . '</span> ' . '<span id="value_module_text_' . $row["id_agente_modulo"] . '">' . $sub_string . '</span> ' .
"<a href='javascript: toggle_full_value(" . $row["id_agente_modulo"] . ")'>" . html_print_image("images/rosette.png", true) . "" . "</span>"; "<a href='javascript: toggle_full_value(" . $row["id_agente_modulo"] . ")'>" . html_print_image("images/rosette.png", true) . "" . "</span>";
} }
} }
$data[8] = $salida; $data[8] = $salida;
if ($row["module_interval"] > 0) if ($row["module_interval"] > 0)
@ -671,7 +671,8 @@ foreach ($result as $row) {
if ($row['estado'] == 3){ if ($row['estado'] == 3){
$option = array ("html_attr" => 'class="redb"'); $option = array ("html_attr" => 'class="redb"');
} else { }
else {
$option = array (); $option = array ();
} }
$data[9] = ui_print_timestamp ($row["utimestamp"], true, $option); $data[9] = ui_print_timestamp ($row["utimestamp"], true, $option);
@ -680,8 +681,11 @@ foreach ($result as $row) {
} }
if (!empty ($table->data)) { if (!empty ($table->data)) {
html_print_table ($table); html_print_table ($table);
} else { }
echo '<div class="nf">'.__('This group doesn\'t have any monitor').'</div>'; else {
echo '<div class="nf">' .
__('This group doesn\'t have any monitor') .
'</div>';
} }
?> ?>
<script type="text/javascript"> <script type="text/javascript">
@ -692,4 +696,4 @@ function toggle_full_value(id) {
$("#value_module_text_" + id).html(value_title); $("#value_module_text_" + id).html(value_title);
} }
</script> </script>

View File

@ -156,7 +156,8 @@ $table->data[0][0] = __('Sender');
if (!empty($own_info['fullname'])) { if (!empty($own_info['fullname'])) {
$table->data[0][1] = $own_info['fullname']; $table->data[0][1] = $own_info['fullname'];
} else { }
else {
$table->data[0][1] = $config['id_user']; $table->data[0][1] = $config['id_user'];
} }
@ -170,9 +171,9 @@ foreach ($users_full as $user_id => $user_info) {
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM")) if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM"))
$return_all_groups = true; $return_all_groups = true;
else else
$return_all_groups = false; $return_all_groups = false;
$groups = users_get_groups ($config["id_user"], "AR"); //Get a list of all groups $groups = users_get_groups ($config["id_user"], "AR"); //Get a list of all groups
$table->data[1][1] = html_print_select ($users, "dst_user", $dst_user, '', __('Select user'), false, true, false, '', false); $table->data[1][1] = html_print_select ($users, "dst_user", $dst_user, '', __('Select user'), false, true, false, '', false);

View File

@ -158,7 +158,7 @@ if ($view_graph) {
$stackeds[2] = __('Line'); $stackeds[2] = __('Line');
$stackeds[3] = __('Stacked line'); $stackeds[3] = __('Stacked line');
html_print_select ($stackeds, 'stacked', $stacked , '', '', -1, false, false); html_print_select ($stackeds, 'stacked', $stacked , '', '', -1, false, false);
echo "</td>"; echo "</td>";
echo "<td class='datos'>"; echo "<td class='datos'>";
$zooms = array(); $zooms = array();
@ -167,21 +167,21 @@ if ($view_graph) {
$zooms[2] = __('Zoom x2'); $zooms[2] = __('Zoom x2');
$zooms[3] = __('Zoom x3'); $zooms[3] = __('Zoom x3');
html_print_select ($zooms, 'zoom', $zoom , '', '', 0); html_print_select ($zooms, 'zoom', $zoom , '', '', 0);
echo "</td>"; echo "</td>";
echo "<td class='datos'>"; echo "<td class='datos'>";
echo "<input type=submit value='".__('Update')."' class='sub upd'>"; echo "<input type=submit value='" . __('Update') . "' class='sub upd'>";
echo "</td>"; echo "</td>";
echo "</tr>"; echo "</tr>";
echo "</table>"; echo "</table>";
echo "</form>"; echo "</form>";
/* We must add javascript here. Otherwise, the date picker won't /* We must add javascript here. Otherwise, the date picker won't
work if the date is not correct because php is returning. */ work if the date is not correct because php is returning. */
ui_require_jquery_file ('timeentry'); ui_require_jquery_file ('timeentry');
?> ?>
<script language="javascript" type="text/javascript"> <script language="javascript" type="text/javascript">
$(document).ready (function () { $(document).ready (function () {
$("#loading").slideUp (); $("#loading").slideUp ();
$("#text-time").timeEntry ({spinnerImage: 'images/time-entry.png', spinnerSize: [20, 20, 0]}); $("#text-time").timeEntry ({spinnerImage: 'images/time-entry.png', spinnerSize: [20, 20, 0]});
@ -189,13 +189,14 @@ if ($view_graph) {
$("#text-date").datepicker ({changeMonth: true, changeYear: true, showAnim: "slideDown"}); $("#text-date").datepicker ({changeMonth: true, changeYear: true, showAnim: "slideDown"});
}); });
</script> </script>
<?php <?php
$datetime = strtotime ($date.' '.$time); $datetime = strtotime ($date.' '.$time);
$report["datetime"] = $datetime; $report["datetime"] = $datetime;
if ($datetime === false || $datetime == -1) { if ($datetime === false || $datetime == -1) {
echo '<h3 class="error">'.__('Invalid date selected').'</h3>'; echo '<h3 class="error">' . __('Invalid date selected') .
'</h3>';
return; return;
} }
return; return;
@ -226,8 +227,8 @@ if (! empty ($graphs)) {
array_push ($table->data, $data); array_push ($table->data, $data);
} }
html_print_table ($table); html_print_table ($table);
} else { }
else {
echo "<div class='nf'>".__('There are no defined reportings')."</div>"; echo "<div class='nf'>".__('There are no defined reportings')."</div>";
} }
?>
?>

View File

@ -22,13 +22,15 @@ function xml_array ($array) {
if (is_int ($name)) { if (is_int ($name)) {
echo "<object id=\"".$name."\">"; echo "<object id=\"".$name."\">";
$name = "object"; $name = "object";
} else { }
else {
echo "<".$name.">"; echo "<".$name.">";
} }
if (is_array ($value)) { if (is_array ($value)) {
xml_array ($value); xml_array ($value);
} else { }
else {
echo $value; echo $value;
} }
@ -46,7 +48,7 @@ if (isset ($_GET["direct"])) {
Although it's not recommended, you can put your login and password Although it's not recommended, you can put your login and password
in a GET request (append &nick=<yourlogin>&password=<password>). in a GET request (append &nick=<yourlogin>&password=<password>).
You SHOULD put it in a POST but some programs You SHOULD put it in a POST but some programs
might not be able to handle it without extensive re-programming might not be able to handle it without extensive re-programming
Either way, you should have a read-only user for getting reports Either way, you should have a read-only user for getting reports