2013-05-01 Miguel de Dios <miguel.dedios@artica.es>

* extensions/system_info.php, extensions/agents_modules.php,
	extensions/vnc_view.php, extensions/users_connected.php,
	extensions/update_manager/lib/libupdate_manager.php,
	extensions/update_manager/lib/libupdate_manager_updates.php,
	extensions/snmp_explorer.php, extensions/insert_data.php,
	operation/agentes/tactical.php: improved the source code.
	
	* include/functions_reporting.php: fixed the links of list modules.
	
	Fixes: #3612243




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8091 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-04-30 22:20:22 +00:00
parent b94fa68180
commit cae521f4ab
11 changed files with 65 additions and 40 deletions

View File

@ -1,3 +1,16 @@
2013-05-01 Miguel de Dios <miguel.dedios@artica.es>
* extensions/system_info.php, extensions/agents_modules.php,
extensions/vnc_view.php, extensions/users_connected.php,
extensions/update_manager/lib/libupdate_manager.php,
extensions/update_manager/lib/libupdate_manager_updates.php,
extensions/snmp_explorer.php, extensions/insert_data.php,
operation/agentes/tactical.php: improved the source code.
* include/functions_reporting.php: fixed the links of list modules.
Fixes: #3612243
2013-04-30 Sergio Martin <sergio.martin@artica.es> 2013-04-30 Sergio Martin <sergio.martin@artica.es>
* godmode/agentes/agent_template.php: Add tags creation * godmode/agentes/agent_template.php: Add tags creation

View File

@ -248,10 +248,10 @@ function mainAgentsModules() {
$nmodules = 0; $nmodules = 0;
foreach($modules_by_name as $module) { foreach ($modules_by_name as $module) {
$nmodules++; $nmodules++;
if($nmodules <= $hor_offset || $nmodules > ($hor_offset+$block)) { if ($nmodules <= $hor_offset || $nmodules > ($hor_offset+$block)) {
continue; continue;
} }
@ -288,7 +288,7 @@ function mainAgentsModules() {
} }
} }
if(!$match) { if (!$match) {
echo "<td></td>"; echo "<td></td>";
} }
} }

View File

@ -100,7 +100,7 @@ function mainInsertData() {
$result = createXMLData($agent, $agentModule, trim($tokens[0]), trim($tokens[1])); $result = createXMLData($agent, $agentModule, trim($tokens[0]), trim($tokens[1]));
if($result) { if ($result) {
$done++; $done++;
} }
else { else {
@ -111,7 +111,7 @@ function mainInsertData() {
else { else {
$result = createXMLData($agent, $agentModule, $date_xml, $data); $result = createXMLData($agent, $agentModule, $date_xml, $data);
if($result) { if ($result) {
$done++; $done++;
} }
else { else {
@ -120,16 +120,16 @@ function mainInsertData() {
} }
} }
if($errors > 0) { if ($errors > 0) {
$msg = sprintf(__('Can\'t save agent (%s), module (%s) data xml.'), $agent['nombre'], $agentModule['nombre']); $msg = sprintf(__('Can\'t save agent (%s), module (%s) data xml.'), $agent['nombre'], $agentModule['nombre']);
if($errors > 1) { if ($errors > 1) {
$msg .= " ($errors)"; $msg .= " ($errors)";
} }
ui_print_error_message($msg); ui_print_error_message($msg);
} }
if ($done > 0) { if ($done > 0) {
$msg = sprintf(__('Save agent (%s), module (%s) data xml.'), $agent['nombre'], $agentModule['nombre']); $msg = sprintf(__('Save agent (%s), module (%s) data xml.'), $agent['nombre'], $agentModule['nombre']);
if($done > 1) { if ($done > 1) {
$msg .= " ($done)"; $msg .= " ($done)";
} }
ui_print_success_message($msg); ui_print_success_message($msg);

View File

@ -71,11 +71,11 @@ function snmp_explorer() {
$keydata = explode('::',$key); $keydata = explode('::',$key);
$keydata2 = explode('.',$keydata[1]); $keydata2 = explode('.',$keydata[1]);
if(!isset($keydata2[1])) { if (!isset($keydata2[1])) {
continue; continue;
} }
if(array_key_exists(1,$data)) { if (array_key_exists(1,$data)) {
$interfaces[$keydata2[1]][$keydata2[0]]['type'] = $data[0]; $interfaces[$keydata2[1]][$keydata2[0]]['type'] = $data[0];
$interfaces[$keydata2[1]][$keydata2[0]]['value'] = $data[1]; $interfaces[$keydata2[1]][$keydata2[0]]['value'] = $data[1];
} }
@ -95,20 +95,20 @@ function snmp_explorer() {
$id_snmp_serialize = get_parameter_post('id_snmp_serialize'); $id_snmp_serialize = get_parameter_post('id_snmp_serialize');
$interfaces = unserialize_in_temp($id_snmp_serialize); $interfaces = unserialize_in_temp($id_snmp_serialize);
if(!$interfaces) { if (!$interfaces) {
$interfaces = array(); $interfaces = array();
} }
$values = array(); $values = array();
if($tcp_port != '') { if ($tcp_port != '') {
$values['tcp_port'] = $tcp_port; $values['tcp_port'] = $tcp_port;
} }
$values['snmp_community'] = $snmp_community; $values['snmp_community'] = $snmp_community;
$values['ip_target'] = $ip_target; $values['ip_target'] = $ip_target;
$values['tcp_send'] = $snmp_version; $values['tcp_send'] = $snmp_version;
if($snmp_version == '3') { if ($snmp_version == '3') {
$values['plugin_user'] = $snmp3_auth_user; $values['plugin_user'] = $snmp3_auth_user;
$values['plugin_pass'] = $snmp3_auth_pass; $values['plugin_pass'] = $snmp3_auth_pass;
$values['plugin_parameter'] = $snmp3_auth_method; $values['plugin_parameter'] = $snmp3_auth_method;
@ -118,10 +118,10 @@ function snmp_explorer() {
} }
$oids = array(); $oids = array();
foreach($interfaces as $key => $interface) { foreach ($interfaces as $key => $interface) {
foreach($interface as $key2 => $module) { foreach ($interface as $key2 => $module) {
$oid = get_parameter($key."-".$key2, ''); $oid = get_parameter($key."-".$key2, '');
if($oid != '') { if ($oid != '') {
$interfaces[$key][$key2]['checked'] = 1; $interfaces[$key][$key2]['checked'] = 1;
$oids[$key][] = $interfaces[$key][$key2]['oid']; $oids[$key][] = $interfaces[$key][$key2]['oid'];
} }
@ -133,12 +133,12 @@ function snmp_explorer() {
$modules = get_parameter('module', array()); $modules = get_parameter('module', array());
$id_snmp = get_parameter('id_snmp'); $id_snmp = get_parameter('id_snmp');
if($id_snmp == false) { if ($id_snmp == false) {
ui_print_error_message (__('No modules selected')); ui_print_error_message (__('No modules selected'));
$id_snmp = array(); $id_snmp = array();
} }
if(agents_get_name($id_agent) == false) { if (agents_get_name($id_agent) == false) {
ui_print_error_message (__('No agent selected or the agent does not exist')); ui_print_error_message (__('No agent selected or the agent does not exist'));
$id_snmp = array(); $id_snmp = array();
} }
@ -210,7 +210,7 @@ function snmp_explorer() {
$result = modules_create_agent_module ($id_agent, io_safe_input($name), $values); $result = modules_create_agent_module ($id_agent, io_safe_input($name), $values);
if (is_error($result)) { if (is_error($result)) {
if(!isset($errors[$result])) { if (!isset($errors[$result])) {
$errors[$result] = 0; $errors[$result] = 0;
} }
$errors[$result]++; $errors[$result]++;

View File

@ -36,7 +36,7 @@ function getPandoraDiagnostic(&$systemInfo) {
$systemInfo['talert_commands'] = db_get_sql("SELECT COUNT(*) FROM tagente"); $systemInfo['talert_commands'] = db_get_sql("SELECT COUNT(*) FROM tagente");
$systemInfo['talert_template_modules'] = db_get_sql("SELECT COUNT(*) FROM talert_template_modules"); $systemInfo['talert_template_modules'] = db_get_sql("SELECT COUNT(*) FROM talert_template_modules");
$systemInfo['tlayout'] = db_get_sql("SELECT COUNT(*) FROM tlayout"); $systemInfo['tlayout'] = db_get_sql("SELECT COUNT(*) FROM tlayout");
if($config['enterprise_installed']) if ($config['enterprise_installed'])
$systemInfo['tlocal_component'] = db_get_sql("SELECT COUNT(*) FROM tlocal_component"); $systemInfo['tlocal_component'] = db_get_sql("SELECT COUNT(*) FROM tlocal_component");
$systemInfo['tserver'] = db_get_sql("SELECT COUNT(*) FROM tserver"); $systemInfo['tserver'] = db_get_sql("SELECT COUNT(*) FROM tserver");
$systemInfo['treport'] = db_get_sql("SELECT COUNT(*) FROM treport"); $systemInfo['treport'] = db_get_sql("SELECT COUNT(*) FROM treport");
@ -327,7 +327,7 @@ function mainSystemInfo() {
$url = '<a href="' .$url_zip . 'attachment/last_info.zip">' . __('download here') . '</a>'; $url = '<a href="' .$url_zip . 'attachment/last_info.zip">' . __('download here') . '</a>';
if($log_info || $system_info || $pandora_diag) { if ($log_info || $system_info || $pandora_diag) {
echo '<b>' . __('File:') . '</b> ' . $url . '<br />'; echo '<b>' . __('File:') . '</b> ' . $url . '<br />';
echo '<b>' . __('Location:') . '</b> ' . $zipArchive; echo '<b>' . __('Location:') . '</b> ' . $zipArchive;
} }

View File

@ -106,7 +106,7 @@ function um_db_get_latest_package_by_status ($id_package = '0', $status = 'publi
WHERE status = "'.$status.'" AND id > ' . $id_package . ' WHERE status = "'.$status.'" AND id > ' . $id_package . '
ORDER BY id DESC LIMIT 1'); ORDER BY id DESC LIMIT 1');
if($result === false) { if ($result === false) {
echo '<strong>Error reading latest package with status ' . $status . '</strong><br />'; echo '<strong>Error reading latest package with status ' . $status . '</strong><br />';
return false; return false;
} }
@ -145,7 +145,7 @@ function um_db_update_package ($id_package, $description = '', $status = 'disabl
$result = db_process_sql_update(DB_PREFIX.'tupdate_package', $values, $where); $result = db_process_sql_update(DB_PREFIX.'tupdate_package', $values, $where);
if($result === false) { if ($result === false) {
echo '<strong>Error updating package</strong><br />'; echo '<strong>Error updating package</strong><br />';
return false; return false;
} }

View File

@ -87,9 +87,9 @@ function um_db_get_orphan_updates () {
$cont = 0; $cont = 0;
$updates = array(); $updates = array();
while(true) { while (true) {
$update = um_std_from_result($result, $cont); $update = um_std_from_result($result, $cont);
if($update === false) { if ($update === false) {
break; break;
} }
$updates[$update['id']] = $update; $updates[$update['id']] = $update;

View File

@ -27,7 +27,7 @@ function users_extension_main_god ($god = true) {
} }
} }
if($god) { if ($god) {
$image = "images/gm_users.png"; $image = "images/gm_users.png";
} }
else { else {

View File

@ -27,7 +27,7 @@ $id_agente = get_parameter ("id_agente");
// This extension is usefull only if the agent has associated IP // This extension is usefull only if the agent has associated IP
$address = agents_get_address($id_agente); $address = agents_get_address($id_agente);
if(!empty($address) || empty($id_agente)) { if (!empty($address) || empty($id_agente)) {
extensions_add_opemode_tab_agent('vnc_view', __('VNC view'), 'images/vnc.png', 'vnc_view', "v1r1"); extensions_add_opemode_tab_agent('vnc_view', __('VNC view'), 'images/vnc.png', 'vnc_view', "v1r1");
} }
?> ?>

View File

@ -990,11 +990,21 @@ function reporting_get_stats_modules_status($data, $graph_width = 250, $graph_he
// Link URLS // Link URLS
if ($links === false) { if ($links === false) {
$urls = array(); $urls = array();
$urls['monitor_critical'] = "index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;refr=60&amp;status=2"; $urls['monitor_critical'] = "index.php?" .
$urls['monitor_warning'] = "index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;refr=60&amp;status=1"; "sec=estado&amp;sec2=operation/agentes/status_monitor&amp;" .
$urls['monitor_ok'] = "index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;refr=60&amp;status=0"; "refr=60&amp;status=" . AGENT_MODULE_STATUS_CRITICAL_BAD;
$urls['monitor_unknown'] = "index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;refr=60&amp;status=3"; $urls['monitor_warning'] = "index.php?" .
$urls['monitor_not_init'] = "index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;refr=60&amp;status=5"; "sec=estado&amp;sec2=operation/agentes/status_monitor&amp;" .
"refr=60&amp;status=" . AGENT_MODULE_STATUS_WARNING;
$urls['monitor_ok'] = "index.php?" .
"sec=estado&amp;sec2=operation/agentes/status_monitor&amp;" .
"refr=60&amp;status=" . AGENT_MODULE_STATUS_NORMAL;
$urls['monitor_unknown'] = "index.php?" .
"sec=estado&amp;sec2=operation/agentes/status_monitor&amp;" .
"refr=60&amp;status=" . AGENT_MODULE_STATUS_UNKNOW;
$urls['monitor_not_init'] = "index.php?" .
"sec=estado&amp;sec2=operation/agentes/status_monitor&amp;" .
"refr=60&amp;status=" . AGENT_MODULE_STATUS_NOT_INIT;
} }
else { else {
$urls = array(); $urls = array();

View File

@ -51,7 +51,7 @@ else {
ui_print_page_header (__("Tactical view"), "images/op_monitoring.png", false, "", false, $updated_time); ui_print_page_header (__("Tactical view"), "images/op_monitoring.png", false, "", false, $updated_time);
$data = reporting_get_group_stats(); $data = reporting_get_group_stats();
if(tags_has_user_acl_tags()) { if (tags_has_user_acl_tags()) {
ui_print_tags_warning(); ui_print_tags_warning();
} }
@ -74,7 +74,7 @@ $table->rowclass[] = '';
html_print_table ($table); html_print_table ($table);
unset ($table); unset($table);
// --------------------------------------------------------------------- // ---------------------------------------------------------------------
// Monitor checks // Monitor checks
@ -94,6 +94,8 @@ $table->data[0][0] .= reporting_get_stats_agents_monitors($data);
$table->rowclass[] = ''; $table->rowclass[] = '';
html_print_table($table); html_print_table($table);
// --------------------------------------------------------------------- // ---------------------------------------------------------------------
// Server performance // Server performance
// --------------------------------------------------------------------- // ---------------------------------------------------------------------