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>
* godmode/agentes/agent_template.php: Add tags creation

View File

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

View File

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

View File

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

View File

@ -36,7 +36,7 @@ function getPandoraDiagnostic(&$systemInfo) {
$systemInfo['talert_commands'] = db_get_sql("SELECT COUNT(*) FROM tagente");
$systemInfo['talert_template_modules'] = db_get_sql("SELECT COUNT(*) FROM talert_template_modules");
$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['tserver'] = db_get_sql("SELECT COUNT(*) FROM tserver");
$systemInfo['treport'] = db_get_sql("SELECT COUNT(*) FROM treport");
@ -324,10 +324,10 @@ function mainSystemInfo() {
@unlink($zipArchive);
$url_zip = ui_get_full_url(false);
$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>' . __('Location:') . '</b> ' . $zipArchive;
}
@ -488,7 +488,7 @@ function consoleMode() {
fclose($file);
}
}
if ($pandoraSystemInfo) {
$systemInfo = array();
getSystemInfo($systemInfo, true);

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 . '
ORDER BY id DESC LIMIT 1');
if($result === false) {
if ($result === false) {
echo '<strong>Error reading latest package with status ' . $status . '</strong><br />';
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);
if($result === false) {
if ($result === false) {
echo '<strong>Error updating package</strong><br />';
return false;
}

View File

@ -87,9 +87,9 @@ function um_db_get_orphan_updates () {
$cont = 0;
$updates = array();
while(true) {
while (true) {
$update = um_std_from_result($result, $cont);
if($update === false) {
if ($update === false) {
break;
}
$updates[$update['id']] = $update;
@ -101,7 +101,7 @@ function um_db_get_orphan_updates () {
function um_db_get_update ($id_update) {
$result = db_process_sql('SELECT * FROM '.DB_PREFIX.'tupdate WHERE id = "'.$id_update.'" LIMIT 1');
if ($result === false) {
echo '<strong>Error getting update</strong> <br />';
return NULL;

View File

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

View File

@ -27,7 +27,7 @@ $id_agente = get_parameter ("id_agente");
// This extension is usefull only if the agent has associated IP
$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");
}
?>

View File

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

View File

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