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

* godmode/snmpconsole/snmp_alert.php,
	godmode/servers/manage_recontask_form.php,
	include/functions_filemanager.php, include/functions_networkmap.php,
	include/constants.php, include/graphs/functions_gd.php,
	include/graphs/functions_pchart.php,
	operation/events/events_list.php, operation/agentes/graphs.php,
	operation/agentes/networkmap.php, operation/agentes/stat_win.php,
	operation/agentes/estado_ultimopaquete.php,
	operation/agentes/networkmap.topology.php,
	operation/agentes/networkmap.groups.php,
	operation/gis_maps/render_view.php: cleaned source code style and
	change magic numbers for time constants.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6769 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2012-07-13 10:59:40 +00:00
parent f078f74d2a
commit f704670749
16 changed files with 262 additions and 223 deletions

View File

@ -1,3 +1,18 @@
2012-07-13 Miguel de Dios <miguel.dedios@artica.es>
* godmode/snmpconsole/snmp_alert.php,
godmode/servers/manage_recontask_form.php,
include/functions_filemanager.php, include/functions_networkmap.php,
include/constants.php, include/graphs/functions_gd.php,
include/graphs/functions_pchart.php,
operation/events/events_list.php, operation/agentes/graphs.php,
operation/agentes/networkmap.php, operation/agentes/stat_win.php,
operation/agentes/estado_ultimopaquete.php,
operation/agentes/networkmap.topology.php,
operation/agentes/networkmap.groups.php,
operation/gis_maps/render_view.php: cleaned source code style and
change magic numbers for time constants.
2012-07-13 Sergio Martin <sergio.martin@artica.es>
* pandoradb_data.sql: Fixed missed column name change

View File

@ -172,15 +172,15 @@ $table->data[3][1] = html_print_input_text ('network', $network, '', 25, 0, true
// Interval
$values = array ();
$values[0] = __('Manual');
$values[3600] = __('%d hour', 1);
$values[7200] = __('%d hours', 2);
$values[21600] = __('%d hours', 6);
$values[43200] = __('%d hours', 12);
$values[86400] = __('%d day', 1);
$values[432000] = __('%d days', 5);
$values[604800] = __('%d week', 1);
$values[1209600] = __('%d weeks', 2);
$values[2592000] = __('%d month', 1);
$values[SECONDS_1HOUR] = __('%d hour', 1);
$values[SECONDS_2HOUR] = __('%d hours', 2);
$values[SECONDS_6HOURS] = __('%d hours', 6);
$values[SECONDS_12HOURS] = __('%d hours', 12);
$values[SECONDS_1DAY] = __('%d day', 1);
$values[SECONDS_5DAY] = __('%d days', 5);
$values[SECONDS_1WEEK] = __('%d week', 1);
$values[SECONDS_2WEEK] = __('%d weeks', 2);
$values[SECONDS_1MONTH] = __('%d month', 1);
$table->data[4][0] = "<b>".__('Interval');
$table->data[4][1] = html_print_select ($values, "interval", $interval, '', '', '', true);
@ -285,25 +285,25 @@ echo "</form>";
/* <![CDATA[ */
$(document).ready (function () {
if($('#mode').val() == 'recon_script') {
$(".recon_script").attr ('style', '');
$(".network_sweep").attr ('style', 'display:none');
$(".recon_script").attr ('style', '');
$(".network_sweep").attr ('style', 'display:none');
}
else if($('#mode').val() == 'network_sweep') {
$(".network_sweep").attr ('style', '');
$(".recon_script").attr ('style', 'display:none');
$(".network_sweep").attr ('style', '');
$(".recon_script").attr ('style', 'display:none');
}
$('#mode').change(function() {
if(this.value == 'recon_script') {
$(".recon_script").attr ('style', '');
$(".network_sweep").attr ('style', 'display:none');
$("#textarea_explanation").css('display', 'none');
$("#spinner_layour").css('display', '');
get_explanation_recon_script($("#id_recon_script").val());
$(".recon_script").attr ('style', '');
$(".network_sweep").attr ('style', 'display:none');
$("#textarea_explanation").css('display', 'none');
$("#spinner_layour").css('display', '');
get_explanation_recon_script($("#id_recon_script").val());
}
else if(this.value == 'network_sweep') {
$(".network_sweep").attr ('style', '');
$(".recon_script").attr ('style', 'display:none');
$(".network_sweep").attr ('style', '');
$(".recon_script").attr ('style', 'display:none');
}
});
});

View File

@ -27,11 +27,16 @@ if (! check_acl ($config['id_user'], 0, "LW")) {
// =============
if (isset ($_GET["update_alert"]) && $_GET["update_alert"] == "-1") {
ui_print_page_header (__('SNMP Console')." &raquo; ".__('Create alert'), "images/computer_error.png", false, "snmp_alert", true);
} else if (isset ($_GET["update_alert"]) && $_GET["update_alert"] != "-1") {
ui_print_page_header (__('SNMP Console')." &raquo; ".__('Update alert'), "images/computer_error.png", false, "snmp_alert", true);
} else if (isset ($_GET["submit"])) {
ui_print_page_header (__('SNMP Console')." &raquo; ".__('Update alert'), "images/computer_error.png", false, "snmp_alert", true);
ui_print_page_header (__('SNMP Console')." &raquo; ".__('Create alert'),
"images/computer_error.png", false, "snmp_alert", true);
}
else if (isset ($_GET["update_alert"]) && $_GET["update_alert"] != "-1") {
ui_print_page_header (__('SNMP Console')." &raquo; ".__('Update alert'),
"images/computer_error.png", false, "snmp_alert", true);
}
else if (isset ($_GET["submit"])) {
ui_print_page_header (__('SNMP Console')." &raquo; ".__('Update alert'),
"images/computer_error.png", false, "snmp_alert", true);
$id_as = (int) get_parameter_get ("submit", -1);
$source_ip = (string) get_parameter_post ("source_ip");
$alert_type = (int) get_parameter_post ("alert_type"); //Event, e-mail
@ -93,28 +98,30 @@ if (isset ($_GET["update_alert"]) && $_GET["update_alert"] == "-1") {
echo '<h3 class="suc">'.__('Successfully created').'</h3>';
}
} else {
}
else {
$sql = sprintf ("UPDATE talert_snmp SET
priority = %d, id_alert = %d, al_field1 = '%s', al_field2 = '%s', al_field3 = '%s', description = '%s', agent = '%s', custom_oid = '%s',
oid = '%s', time_threshold = %d, max_alerts = %d, min_alerts = %d, _snmp_f1_ = '%s', _snmp_f2_ = '%s', _snmp_f3_ = '%s', _snmp_f4_ = '%s',
_snmp_f5_ = '%s', _snmp_f6_ = '%s', trap_type = %d, single_value = '%s'
WHERE id_as = %d",
$priority, $alert_type, $al_field1, $al_field2, $al_field3, $description, $source_ip, $custom_value,
$oid, $time_threshold, $max_alerts, $min_alerts, $custom_oid_data_1, $custom_oid_data_2, $custom_oid_data_3,
$custom_oid_data_4, $custom_oid_data_5, $custom_oid_data_6, $trap_type, $single_value, $id_as);
priority = %d, id_alert = %d, al_field1 = '%s', al_field2 = '%s', al_field3 = '%s', description = '%s', agent = '%s', custom_oid = '%s',
oid = '%s', time_threshold = %d, max_alerts = %d, min_alerts = %d, _snmp_f1_ = '%s', _snmp_f2_ = '%s', _snmp_f3_ = '%s', _snmp_f4_ = '%s',
_snmp_f5_ = '%s', _snmp_f6_ = '%s', trap_type = %d, single_value = '%s'
WHERE id_as = %d",
$priority, $alert_type, $al_field1, $al_field2, $al_field3, $description, $source_ip, $custom_value,
$oid, $time_threshold, $max_alerts, $min_alerts, $custom_oid_data_1, $custom_oid_data_2, $custom_oid_data_3,
$custom_oid_data_4, $custom_oid_data_5, $custom_oid_data_6, $trap_type, $single_value, $id_as);
$result = db_process_sql ($sql);
if (!$result) {
db_pandora_audit("SNMP management", "Fail try to update snmp alert #$id_as");
echo '<h3 class="error">'.__('There was a problem updating the alert').'</h3>';
} else {
}
else {
db_pandora_audit("SNMP management", "Update snmp alert #$id_as");
echo '<h3 class="suc">'.__('Successfully updated').'</h3>';
}
}
} else {
}
else {
ui_print_page_header (__('SNMP Console')." &raquo; ".__('Alert overview'), "images/computer_error.png", false, "snmp_alert", true);
}
@ -144,7 +151,8 @@ if ((isset ($_GET["update_alert"])) && ($_GET["update_alert"] != -1)) {
$custom_oid_data_6 = $alert["_snmp_f6_"];
$trap_type = $alert["trap_type"];
$single_value = $alert["single_value"];
} elseif (isset ($_GET["update_alert"])) {
}
elseif (isset ($_GET["update_alert"])) {
// Variable init
$id_as = -1;
$source_ip = "";
@ -212,10 +220,10 @@ if (isset ($_GET["update_alert"])) {
// Custom
echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Custom Value/OID');
echo ui_print_help_icon ("snmp_alert_custom", true);
echo ui_print_help_icon ("snmp_alert_custom", true);
echo '</td><td class="datos">';
html_print_textarea ("custom_value", $custom_value, 2, $custom_value, 'style="width:400px;"');
echo '</td><td class="datos">';
html_print_textarea ("custom_value", $custom_value, 2, $custom_value, 'style="width:400px;"');
echo '</td></tr>';
@ -237,50 +245,50 @@ if (isset ($_GET["update_alert"])) {
// Custom OID/Data #1
echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Custom OID/Data #1');
echo ui_print_help_icon ("field_match_snmp", true);
echo ui_print_help_icon ("field_match_snmp", true);
echo '</td><td class="datos">';
html_print_input_text ("custom_oid_data_1", $custom_oid_data_1, '', 60);
echo '</td><td class="datos">';
html_print_input_text ("custom_oid_data_1", $custom_oid_data_1, '', 60);
echo '</td></tr>';
// Custom OID/Data #2
echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Custom OID/Data #2');
//echo ui_print_help_icon ("snmp_alert_custom", true);
//echo ui_print_help_icon ("snmp_alert_custom", true);
echo '</td><td class="datos">';
html_print_input_text ("custom_oid_data_2", $custom_oid_data_2, '', 60);
echo '</td><td class="datos">';
html_print_input_text ("custom_oid_data_2", $custom_oid_data_2, '', 60);
echo '</td></tr>';
// Custom OID/Data #3
echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Custom OID/Data #3');
//echo ui_print_help_icon ("snmp_alert_custom", true);
//echo ui_print_help_icon ("snmp_alert_custom", true);
echo '</td><td class="datos">';
html_print_input_text ("custom_oid_data_3", $custom_oid_data_3, '', 60);
echo '</td><td class="datos">';
html_print_input_text ("custom_oid_data_3", $custom_oid_data_3, '', 60);
echo '</td></tr>';
// Custom OID/Data #4
echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Custom OID/Data #4');
//echo ui_print_help_icon ("snmp_alert_custom", true);
//echo ui_print_help_icon ("snmp_alert_custom", true);
echo '</td><td class="datos">';
html_print_input_text ("custom_oid_data_4", $custom_oid_data_4, '', 60);
echo '</td><td class="datos">';
html_print_input_text ("custom_oid_data_4", $custom_oid_data_4, '', 60);
echo '</td></tr>';
// Custom OID/Data #5
echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Custom OID/Data #5');
//echo ui_print_help_icon ("snmp_alert_custom", true);
//echo ui_print_help_icon ("snmp_alert_custom", true);
echo '</td><td class="datos">';
html_print_input_text ("custom_oid_data_5", $custom_oid_data_5, '', 60);
echo '</td><td class="datos">';
html_print_input_text ("custom_oid_data_5", $custom_oid_data_5, '', 60);
echo '</td></tr>';
// Custom OID/Data #6
echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Custom OID/Data #6');
//echo ui_print_help_icon ("snmp_alert_custom", true);
//echo ui_print_help_icon ("snmp_alert_custom", true);
echo '</td><td class="datos">';
html_print_input_text ("custom_oid_data_6", $custom_oid_data_6, '', 60);
echo '</td><td class="datos">';
html_print_input_text ("custom_oid_data_6", $custom_oid_data_6, '', 60);
echo '</td></tr>';
//Button
@ -293,12 +301,12 @@ if (isset ($_GET["update_alert"])) {
//echo '<table cellpadding="4" cellspacing="4" width="98%" class="databox_color" style="border:1px solid #A9A9A9;">';
// echo '<tr><td class="datos"><b>' . __('Alert configuration') . ui_print_help_icon("snmp_alert_configuration", true) . '</b></td></tr>';
//echo '<tr><td class="datos"><b>' . __('Alert configuration') . ui_print_help_icon("snmp_alert_configuration", true) . '</b></td></tr>';
// Alert fields
echo '<tr><td class="datos">'.__('Field #1 (Alias, name)');
echo ui_print_help_icon ("snmp_alert_field1", true);
echo '</td><td class="datos">';
echo ui_print_help_icon ("snmp_alert_field1", true);
echo '</td><td class="datos">';
html_print_input_text ("al_field1", $al_field1, '', 60);
echo '</td></tr>';
@ -323,16 +331,16 @@ if (isset ($_GET["update_alert"])) {
$fields = array ();
$fields[$time_threshold] = human_time_description_raw ($time_threshold);
$fields[300] = human_time_description_raw (300);
$fields[600] = human_time_description_raw (600);
$fields[900] = human_time_description_raw (900);
$fields[1800] = human_time_description_raw (1800);
$fields[3600] = human_time_description_raw (3600);
$fields[7200] = human_time_description_raw (7200);
$fields[18000] = human_time_description_raw (18000);
$fields[43200] = human_time_description_raw (43200);
$fields[86400] = human_time_description_raw (86400);
$fields[604800] = human_time_description_raw (604800);
$fields[SECONDS_5MINUTES] = human_time_description_raw (SECONDS_5MINUTES);
$fields[SECONDS_10MINUTES] = human_time_description_raw (SECONDS_10MINUTES);
$fields[SECONDS_15MINUTES] = human_time_description_raw (SECONDS_15MINUTES);
$fields[SECONDS_30MINUTES] = human_time_description_raw (SECONDS_30MINUTES);
$fields[SECONDS_1HOUR] = human_time_description_raw (SECONDS_1HOUR);
$fields[SECONDS_2HOUR] = human_time_description_raw (SECONDS_2HOUR);
$fields[SECONDS_5HOUR] = human_time_description_raw (SECONDS_5HOUR);
$fields[SECONDS_12HOURS] = human_time_description_raw (SECONDS_12HOURS);
$fields[SECONDS_1DAY] = human_time_description_raw (SECONDS_1DAY);
$fields[SECONDS_1WEEK] = human_time_description_raw (SECONDS_1WEEK);
$fields[-1] = __('Other value');
html_print_select ($fields, "time_threshold", $time_threshold, '', '', '0', false, false, false, '" style="margin-right:60px');
@ -377,13 +385,14 @@ if (isset ($_GET["update_alert"])) {
echo '<tr><td></td><td align="right">';
if ($id_as > 0) {
html_print_submit_button (__('Update'), "submit", false, 'class="sub upd"', false);
} else {
}
else {
html_print_submit_button (__('Create'), "submit", false, 'class="sub wand"', false);
}
echo '</td></tr></table>';
echo "</table>";
} else {
}
else {
require_once ('include/functions_alerts.php');
//Overview
@ -442,14 +451,15 @@ if (isset ($_GET["update_alert"])) {
if (($row["last_fired"] != "1970-01-01 00:00:00") and ($row["last_fired"] != "01-01-1970 00:00:00")) {
$data[6] = ui_print_timestamp($row["last_fired"], true);
} else {
}
else {
$data[6] = __('Never');
}
$data[7] = '<a href="index.php?sec=estado&sec2=godmode/snmpconsole/snmp_alert&update_alert='.$row["id_as"].'">' .
html_print_image("images/config.png", true, array("border" => '0', "alt" => __('Update'))) . '</a>' .
'&nbsp;&nbsp;<a href="index.php?sec=estado&sec2=godmode/snmpconsole/snmp_alert&delete_alert='.$row["id_as"].'">' .
html_print_image("images/cross.png", true, array("border" => '0', "alt" => __('Delete'))) . '</a>';
html_print_image("images/config.png", true, array("border" => '0', "alt" => __('Update'))) . '</a>' .
'&nbsp;&nbsp;<a href="index.php?sec=estado&sec2=godmode/snmpconsole/snmp_alert&delete_alert='.$row["id_as"].'">' .
html_print_image("images/cross.png", true, array("border" => '0', "alt" => __('Delete'))) . '</a>';
$idx = count ($table->data); //The current index of the table is 1 less than the count of table data so we count before adding to table->data
array_push ($table->data, $data);

View File

@ -53,6 +53,7 @@ define ('ERR_CONNECTION', -80000);
/* Seconds in a time unit constants */
define('SECONDS_1MINUTE', 60);
define('SECONDS_2MINUTES', 120);
define('SECONDS_5MINUTES', 300);
define('SECONDS_10MINUTES', 600);
define('SECONDS_15MINUTES', 900);

View File

@ -672,7 +672,8 @@ function filemanager_box_upload_file_complex($real_directory, $relative_director
echo '<p>';
echo __('Please check that current directory has write rights for HTTP server');
echo '</p>';
} else {
}
else {
$table->data[1][0] = __('Upload') . ui_print_help_tip (__("The zip upload in this dir, easy to upload multiple files."), true);
$table->data[1][1] = html_print_input_file ('file', true, false);
$table->data[1][2] = html_print_radio_button('zip_or_file', 'zip', __('Multiple files zipped'), false, true);
@ -709,7 +710,8 @@ function filemanager_box_upload_file_explorer($real_directory, $relative_directo
echo '<p>';
echo __('Please check that current directory has write rights for HTTP server');
echo '</p>';
} else {
}
else {
$table->data[1][0] = __('Upload file');
$table->data[1][1] = html_print_input_file ('file', true, false);
$table->data[1][2] = html_print_submit_button (__('Go'), 'go', false,
@ -744,7 +746,8 @@ function filemanager_box_upload_zip_explorer($real_directory, $relative_director
echo '<p>';
echo __('Please check that current directory has write rights for HTTP server');
echo '</p>';
} else {
}
else {
$table->data[1][0] = __('Upload zip file: ') . ui_print_help_tip (__("The zip upload in this dir, easy to upload multiple files."), true);
$table->data[1][1] = html_print_input_file ('file', true, false);
$table->data[1][2] = html_print_submit_button (__('Go'), 'go', false,
@ -779,7 +782,8 @@ function filemanager_box_create_text_explorer($real_directory, $relative_directo
echo '<p>';
echo __('Please check that current directory has write rights for HTTP server');
echo '</p>';
} else {
}
else {
$table->data[1][0] = __('Create text file: ');
$table->data[1][1] = html_print_input_text('name_file', '', '', 30, 50, true);
$table->data[1][2] = html_print_submit_button (__('Create'), 'create', false,
@ -854,7 +858,7 @@ function filemanager_is_writable_dir ($dirpath, $force = false) {
if (filemanager_is_writable_dir (realpath ($dirpath.'/..')))
return true;
else if (! $force)
return is_writable ($dirpath);
return is_writable ($dirpath);
return (is_writable ($dirpath) || @chmod ($dirpath, 0755));
}
@ -891,11 +895,14 @@ function filemanager_get_file_info ($filepath) {
$info['mime'] = MIME_DIR;
$info['is_dir'] = true;
$info['size'] = 0;
} else if (strpos ($info['mime_extend'], 'image') !== false) {
}
else if (strpos ($info['mime_extend'], 'image') !== false) {
$info['mime'] = MIME_IMAGE;
} else if (in_array ($info['mime_extend'], $zip_mimes)) {
}
else if (in_array ($info['mime_extend'], $zip_mimes)) {
$info['mime'] = MIME_ZIP;
} else if (strpos ($info['mime_extend'], 'text') !== false) {
}
else if (strpos ($info['mime_extend'], 'text') !== false) {
$info['mime'] = MIME_TEXT;
}
@ -921,7 +928,8 @@ function filemanager_list_dir ($dirpath) {
$info = filemanager_get_file_info ($dirpath.'/'.$file);
if ($info['is_dir']) {
$dirs[$file] = $info;
} else {
}
else {
$files[$file] = $info;
}
}

View File

@ -253,11 +253,11 @@ function gd_progress_bubble ($width, $height, $progress, $title, $font, $out_of_
// ***************************************************************************
function gd_progress_bar ($width, $height, $progress, $title, $font, $out_of_lim_str, $out_of_lim_image, $mode = 1, $fontsize=10, $value_text = '', $colorRGB = '') {
if($out_of_lim_str === false) {
if ($out_of_lim_str === false) {
$out_of_lim_str = "Out of limits";
}
if($out_of_lim_image === false) {
if ($out_of_lim_image === false) {
$out_of_lim_image = "images_graphs/outlimits.png";
}
@ -397,8 +397,6 @@ function gd_progress_bar ($width, $height, $progress, $title, $font, $out_of_lim
imagePNG($image);
imagedestroy($image);
}
function ImageRectangleWithRoundedCorners(&$im, $x1, $y1, $x2, $y2, $radius, $color)

View File

@ -461,15 +461,19 @@ foreach ($modules as $module) {
echo "<td class=".$tdcolor." width='78'>";
$graph_label = io_safe_output($module["nombre"]);
echo "<a href='javascript:winopeng(\"operation/agentes/stat_win.php?type=$graph_type&period=2419200&id=".$module["id_agente_modulo"]."&label=".base64_encode($graph_label)."&refresh=180000\", \"month_".$win_handle."\")'>" . html_print_image('images/grafica_m.png' , true, array("border" => '0', "alt" => '')) . "</a>&nbsp;";
echo "<a href='javascript:" .
"winopeng(\"operation/agentes/stat_win.php?type=$graph_type&period=" . (28 * SECONDS_1DAY) . "&id=".$module["id_agente_modulo"]."&label=".base64_encode($graph_label)."&refresh=180000\", \"month_".$win_handle."\")'>" . html_print_image('images/grafica_m.png' , true, array("border" => '0', "alt" => '')) . "</a>&nbsp;";
$link ="winopeng('operation/agentes/stat_win.php?type=$graph_type&period=604800&id=".$module["id_agente_modulo"]."&label=".base64_encode($graph_label)."&refresh=6000','week_".$win_handle."')";
$link ="winopeng(" .
"'operation/agentes/stat_win.php?type=$graph_type&period=" . SECONDS_1WEEK . "&id=".$module["id_agente_modulo"]."&label=".base64_encode($graph_label)."&refresh=6000','week_".$win_handle."')";
echo '<a href="javascript:'.$link.'">' . html_print_image("images/grafica_w.png", true, array("border" => '0', "alt" => '')) . '</a>&nbsp;';
$link ="winopeng('operation/agentes/stat_win.php?type=$graph_type&period=86400&id=".$module["id_agente_modulo"]."&label=".base64_encode($graph_label)."&refresh=600','day_".$win_handle."')";
$link ="winopeng(" .
"'operation/agentes/stat_win.php?type=$graph_type&period=" . SECONDS_1DAY . "&id=".$module["id_agente_modulo"]."&label=".base64_encode($graph_label)."&refresh=600','day_".$win_handle."')";
echo '<a href="javascript:'.$link.'">' . html_print_image("images/grafica_d.png", true, array("border" => '0', "alt" => '')) . '</a>&nbsp;';
$link ="winopeng('operation/agentes/stat_win.php?type=$graph_type&period=3600&id=".$module["id_agente_modulo"]."&label=".base64_encode($graph_label)."&refresh=60','hour_".$win_handle."')";
$link ="winopeng(" .
"'operation/agentes/stat_win.php?type=$graph_type&period=" . SECONDS_1HOUR . "&id=".$module["id_agente_modulo"]."&label=".base64_encode($graph_label)."&refresh=60','hour_".$win_handle."')";
echo '<a href="javascript:'.$link.'">' . html_print_image("images/grafica_h.png", true, array("border" => '0', "alt" => "")) . '</a>';
}

View File

@ -27,10 +27,9 @@ if (! check_acl ($config['id_user'], $id_grupo, "AR")) {
require_once ($config["homedir"] . '/include/functions_graph.php');
$period = get_parameter ( "period", 3600);
$draw_alerts = get_parameter("draw_alerts", 0);
$avg_only = get_parameter ("avg_only", 1);
$period = get_parameter ("period", 3600);
$period = get_parameter ("period", SECONDS_1HOUR);
$width = get_parameter ("width", 555);
$height = get_parameter ("height", 245);
$label = get_parameter ("label", "");

View File

@ -61,11 +61,13 @@ $filename_dot .= "_".$id_networkmap.".dot";
if ($regen != 1 && file_exists ($filename_img) && filemtime ($filename_img) > get_system_time () - 300) {
$result = true;
} else {
}
else {
$fh = @fopen ($filename_dot, 'w');
if ($fh === false) {
$result = false;
} else {
}
else {
fwrite ($fh, $graph);
$cmd = "$filter -Tcmapx -o".$filename_map." -Tpng -o".$filename_img." ".$filename_dot;
$result = system ($cmd);
@ -81,18 +83,20 @@ if ($result !== false) {
echo "<div class='warn'>Apparently something went wrong reading the output.</div>";
echo "<br />Is ".$config["attachment_store"]." readable by the webserver process?";
echo "<br /><br /> Is ".$filter." (usually part of GraphViz) and echo installed and able to be executed by the webserver process?";
return;
}
html_print_image ($filename_img, false, array ("alt" => __('Network map'), "usemap" => "#networkmap"));
require ($filename_map);
} else {
}
else {
ui_print_error_message (__('Map could not be generated'));
echo $result;
echo "<div class='warn'>Apparently something went wrong executing the command or writing the output.</div>";
echo "<br />Is ".$filter." (usually part of GraphViz) and echo installed and able to be executed by the webserver process?";
echo "<br /><br /> Is your webserver restricted from executing command line tools through the <code>system()</code> call (PHP Safe Mode or SELinux)";
echo "<br /><br /> Is ".$config["attachment_store"]." writeable by the webserver process? To change this do the following (POSIX-based systems): chown &lt;apache user&gt; ".$config["attachment_store"];
return;
}
?>

View File

@ -106,10 +106,10 @@ if($save_networkmap || $update_networkmap) {
if($save_networkmap) {
if (!$check || $subcheck == $name) {
$result = networkmap_update_networkmap($id_networkmap, array('name' => $name, 'type' => $activeTab, 'layout' => $layout,
'nooverlap' => $nooverlap, 'simple' => $simple, 'regenerate' => $regen, 'font_size' => $font_size,
'id_group' => $group, 'id_module_group' => $module_group, 'depth' => $depth, 'only_modules_with_alerts' => $modwithalerts,
'hide_policy_modules' => $hidepolicymodules, 'zoom' => $zoom, 'distance_nodes' => $ranksep, 'center' => $center,
'show_snmp_modules' => (int)$show_snmp_modules));
'nooverlap' => $nooverlap, 'simple' => $simple, 'regenerate' => $regen, 'font_size' => $font_size,
'id_group' => $group, 'id_module_group' => $module_group, 'depth' => $depth, 'only_modules_with_alerts' => $modwithalerts,
'hide_policy_modules' => $hidepolicymodules, 'zoom' => $zoom, 'distance_nodes' => $ranksep, 'center' => $center,
'show_snmp_modules' => (int)$show_snmp_modules));
$message = ui_print_result_message ($result,
__('Network map saved successfully'),
@ -169,26 +169,26 @@ if($recenter_networkmap) {
if ($pure == 1) {
$buttons['screen'] = array('active' => false,
'text' => '<a href="index.php?sec=network&amp;sec2=operation/agentes/networkmap&amp;tab='.$activeTab.'">' .
html_print_image("images/normalscreen.png", true, array ('title' => __('Normal screen'))) .'</a>');
} else {
html_print_image("images/normalscreen.png", true, array ('title' => __('Normal screen'))) .'</a>');
}
else {
$buttons['screen'] = array('active' => false,
'text' => '<a href="index.php?sec=network&amp;sec2=operation/agentes/networkmap&amp;pure=1&amp;tab='.$activeTab.'">' .
html_print_image("images/fullscreen.png", true, array ('title' => __('Full screen'))) .'</a>');
html_print_image("images/fullscreen.png", true, array ('title' => __('Full screen'))) .'</a>');
}
if($config['enterprise_installed']) {
if ($config['enterprise_installed']) {
$buttons['policies'] = array('active' => $activeTab == 'policies',
'text' => '<a href="index.php?sec=network&amp;sec2=operation/agentes/networkmap&amp;tab=policies&amp;pure='.$pure.'">' .
html_print_image("images/policies.png", true, array ("title" => __('Policies view'))) .'</a>');
html_print_image("images/policies.png", true, array ("title" => __('Policies view'))) .'</a>');
}
$buttons['groups'] = array('active' => $activeTab == 'groups',
'text' => '<a href="index.php?sec=network&amp;sec2=operation/agentes/networkmap&amp;tab=groups&amp;pure='.$pure.'">' .
html_print_image("images/group.png", true, array ("title" => __('Groups view'))) .'</a>');
html_print_image("images/group.png", true, array ("title" => __('Groups view'))) .'</a>');
$buttons['topology'] = array('active' => $activeTab == 'topology',
'text' => '<a href="index.php?sec=network&amp;sec2=operation/agentes/networkmap&amp;tab=topology&amp;pure='.$pure.'">' .
html_print_image("images/recon.png", true, array ("title" => __('Topology view'))) .'</a>');
html_print_image("images/recon.png", true, array ("title" => __('Topology view'))) .'</a>');
$buttons['separator'] = array('separator' => '');
@ -204,22 +204,22 @@ $buttons['combolist'] = $combolist;
$buttons['addmap'] = array('active' => $activeTab == false,
'text' => '<a href="index.php?sec=network&amp;sec2=operation/agentes/networkmap&amp;add_networkmap=1&amp;tab='.$activeTab.'&amp;pure='.$pure.'">' .
html_print_image("images/add.png", true, array ("title" => __('Add map'))) .'</a>');
html_print_image("images/add.png", true, array ("title" => __('Add map'))) .'</a>');
if (!$nomaps && $id_networkmap != 0) {
$buttons['deletemap'] = array('active' => $activeTab == false,
'text' => '<a href="index.php?sec=network&amp;sec2=operation/agentes/networkmap&amp;id_networkmap='.$id_networkmap.'&amp;delete_networkmap=1&amp;tab='.$activeTab.'&amp;pure='.$pure.'">' .
html_print_image("images/cross.png", true, array ("title" => __('Delete map'))) .'</a>');
html_print_image("images/cross.png", true, array ("title" => __('Delete map'))) .'</a>');
$buttons['savemap'] = array('active' => $activeTab == false,
'text' => '<a href="index.php?sec=network&amp;sec2=operation/agentes/networkmap&amp;id_networkmap='.$id_networkmap.'&amp;save_networkmap=1
&amp;tab='.$activeTab.'&amp;save_networkmap=1&amp;name='.$name.'&amp;group='.$group.'
&amp;layout='.$layout.'&amp;nooverlap='.$nooverlap.'&amp;simple='.$simple.'&amp;regen='.$regen.'
&amp;zoom='.$zoom.'&amp;ranksep='.$ranksep.'&amp;fontsize='.$font_size.'&amp;depth='.$depth.'
&amp;modwithalerts='.$modwithalerts.'&amp;hidepolicymodules='.$hidepolicymodules.'
&amp;module_group='.$module_group.'&amp;pure='.$pure.'&amp;hidden_options='.(int)$hidden_options.'
&amp;show_snmp_modules='.(int)$show_snmp_modules.'">' .
html_print_image("images/file.png", true, array ("title" => __('Save map'))) .'</a>');
&amp;tab='.$activeTab.'&amp;save_networkmap=1&amp;name='.$name.'&amp;group='.$group.'
&amp;layout='.$layout.'&amp;nooverlap='.$nooverlap.'&amp;simple='.$simple.'&amp;regen='.$regen.'
&amp;zoom='.$zoom.'&amp;ranksep='.$ranksep.'&amp;fontsize='.$font_size.'&amp;depth='.$depth.'
&amp;modwithalerts='.$modwithalerts.'&amp;hidepolicymodules='.$hidepolicymodules.'
&amp;module_group='.$module_group.'&amp;pure='.$pure.'&amp;hidden_options='.(int)$hidden_options.'
&amp;show_snmp_modules='.(int)$show_snmp_modules.'">' .
html_print_image("images/file.png", true, array ("title" => __('Save map'))) .'</a>');
}
$title = '';

View File

@ -66,7 +66,8 @@ else {
$fh = @fopen ($filename_dot, 'w');
if ($fh === false) {
$result = false;
} else {
}
else {
fwrite ($fh, $graph);
$cmd = "$filter -Tcmapx -o".$filename_map." -Tpng -o".$filename_img." ".$filename_dot;
$result = system ($cmd);

View File

@ -167,7 +167,7 @@ if (!isset($_GET["period"]) OR (!isset($_GET["id"]))) {
exit;
}
$period = get_parameter ( "period", 3600);
$period = get_parameter ( "period", SECONDS_1HOUR);
$draw_alerts = get_parameter("draw_alerts", 0);
$avg_only = get_parameter ("avg_only", 1);
$show_other = (bool)get_parameter('show_other', false);

View File

@ -220,7 +220,7 @@ if ($id_user_ack != "0")
if ($event_view_hr > 0) {
$unixtime = get_system_time () - ($event_view_hr * 3600); //Put hours in seconds
$unixtime = get_system_time () - ($event_view_hr * SECONDS_1HOUR);
$sql_post .= " AND (utimestamp > ".$unixtime . " OR estado = 2)";
}

View File

@ -101,15 +101,15 @@ if (check_acl ($config["id_user"], $map['group_id'], "IW"))
$buttonsString = '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente=3">' . html_print_image("images/bricks.png", true, array("class" => "top", "border" => '0')) . '&nbsp; Agent&nbsp;-&nbsp;test_gis1</a></li></ul></div><div id="menu_tab"><ul class="mn"><li class="nomn"><a href="index.php?sec=estado&amp;sec2=godmode/agentes/configurar_agente&amp;id_agente=3">' . html_print_image("images/setup.png", true, array("class" => "top", "title" => "Manage", "border" => "0", "width" => "16", "title" => "Manage")) . '&nbsp;</a></li><li class="nomn_high"><a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente=3">' . html_print_image("images/monitor.png", true, array("class" => "top", "title" => "Main", "border" => "0")) . '&nbsp;</a></li><li class="nomn"><a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente=3&amp;tab=data">' . html_print_image("images/lightbulb.png", true, array("class" => "top", "title" => "Data", "border" => "0")) . '&nbsp;</a></li><li class="nomn"><a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente=3&amp;tab=alert">' . html_print_image("images/bell.png", true, array("class" => "top", "title" => "Alerts", "border" => "0")) . '&nbsp;</a></li><li class="nomn"><a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;tab=sla&amp;id_agente=3">' . html_print_image("images/images.png", true, array("class" => "top", "title" => "S.L.A.", "border" => "0")) . '&nbsp;</a></li><li class="nomn"><a href="index.php?sec=estado&amp;sec2=operation/agentes/estado_agente&amp;group_id=2">' . html_print_image("images/agents_group.png", true, array("class" => "top", "title" => "Group", "border" => "0")) . '&nbsp;</a></li><li class="nomn"><a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;tab=inventory&amp;id_agente=3">' . html_print_image("images/page_white_text.png", true, array("class" => "top", "title" => "Inventory", "border" => "0", "width" => "16")) . '&nbsp;</a></li><li class="nomn"><a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;tab=gis&amp;id_agente=3">' . html_print_image("images/world.png", array("class" => "top", "title" => "GIS data", "border" => "0")) . '&nbsp;</a>';
$times = array(
5 => 5 . ' ' . __('seconds'),
10 => 10 . ' ' . __('seconds'),
30 => 30 . ' ' . __('seconds'),
60 => 1 . ' ' . __('minute'),
120 => 2 . ' ' . __('minutes'),
300 => 5 . ' ' . __('minutes'),
600 => 10 . ' ' . __('minutes'),
3600 => 1 . ' ' . __('hour'),
7200 => 2 . ' ' . __('hours')
5 => __('5 seconds'),
10 => __('10 seconds'),
30 => __('30 seconds'),
SECONDS_1MINUTE => __('1 minute'),
SECONDS_2MINUTE => __('2 minutes'),
SECONDS_5MINUTES => __('5 minutes'),
SECONDS_10MINUTES => __('10 minutes'),
SECONDS_1HOUR => __('1 hour'),
SECONDS_2HOUR => __('2 hours')
);
$buttons[] = '&nbsp;' . __('Refresh: ') . html_print_select($times, 'refresh_time', 60, 'changeRefreshTime(this.value);', '', 0, true, false, false) . "&nbsp;";
@ -191,29 +191,28 @@ if ($layers != false) {
// Resize GIS map on fullscreen
if ($config["pure"] != 0) {
?>
<script type="text/javascript">
$().ready(function(){
?>
<script type="text/javascript">
$().ready(function(){
var new_height = $(document).height();
$("#map").css("height", new_height - 60);
var new_height = $(document).height();
$("#map").css("height", new_height - 60);
});
</script>
<?php
});
</script>
<?php
}
else {
// Resize GIS map on normalview
?>
<script type="text/javascript">
$().ready(function(){
?>
<script type="text/javascript">
$().ready(function(){
var new_height = $("#menu").height();
$("#map").css("height", new_height - 20);
var new_height = $("#menu").height();
$("#map").css("height", new_height - 20);
});
</script>
<?php
});
</script>
<?php
}
?>