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:
parent
7d9e591982
commit
440a1e9591
|
@ -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
|
||||
|
|
|
@ -164,7 +164,7 @@ $fields['recon_script'] = __("Custom script");
|
|||
$table->data[2][0] = "<b>".__('Mode')."</b>";
|
||||
$table->data[2][1] = html_print_select ($fields, "mode", $mode, '', '', 0, true);
|
||||
|
||||
|
||||
|
||||
// Network
|
||||
$table->data[3][0] = "<b>".__('Network');
|
||||
$table->data[3][1] = html_print_input_text ('network', $network, '', 25, 0, true);
|
||||
|
@ -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');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -322,4 +322,4 @@ function get_explanation_recon_script(id) {
|
|||
);
|
||||
}
|
||||
/* ]]> */
|
||||
</script>
|
||||
</script>
|
|
@ -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')." » ".__('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')." » ".__('Update alert'), "images/computer_error.png", false, "snmp_alert", true);
|
||||
} else if (isset ($_GET["submit"])) {
|
||||
ui_print_page_header (__('SNMP Console')." » ".__('Update alert'), "images/computer_error.png", false, "snmp_alert", true);
|
||||
ui_print_page_header (__('SNMP Console')." » ".__('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')." » ".__('Update alert'),
|
||||
"images/computer_error.png", false, "snmp_alert", true);
|
||||
}
|
||||
else if (isset ($_GET["submit"])) {
|
||||
ui_print_page_header (__('SNMP Console')." » ".__('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
|
||||
|
@ -81,7 +86,7 @@ if (isset ($_GET["update_alert"]) && $_GET["update_alert"] == "-1") {
|
|||
'_snmp_f6_' => $custom_oid_data_6,
|
||||
'trap_type' => $trap_type,
|
||||
'single_value' => $single_value);
|
||||
|
||||
|
||||
$result = db_process_sql_insert('talert_snmp', $values);
|
||||
|
||||
if (!$result) {
|
||||
|
@ -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')." » ".__('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 = "";
|
||||
|
@ -191,114 +199,114 @@ if (isset ($_GET["delete_alert"])) { // Delete alert
|
|||
if (isset ($_GET["update_alert"])) {
|
||||
//the update_alert means the form should be displayed. If update_alert > 1 then an existing alert is updated
|
||||
echo '<form name="agente" method="post" action="index.php?sec=estado&sec2=godmode/snmpconsole/snmp_alert&submit='.$id_as.'">';
|
||||
|
||||
|
||||
/* SNMP alert filters */
|
||||
|
||||
|
||||
echo '<table cellpadding="4" cellspacing="4" width="98%" class="databox_color">';
|
||||
|
||||
|
||||
// Description
|
||||
echo '<tr><td class="datos">'.__('Description').'</td><td class="datos">';
|
||||
html_print_input_text ("description", $description, '', 60);
|
||||
echo '</td></tr>';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//echo '<tr><td class="datos"><b>' . __('Alert filters') . ui_print_help_icon("snmp_alert_filters", true) . '</b></td></tr>';
|
||||
|
||||
|
||||
// OID
|
||||
echo '<tr id="tr-oid"><td class="datos2">'.__('OID').'</td><td class="datos2">';
|
||||
html_print_input_text ("oid", $oid, '', 50, 255);
|
||||
echo '</td></tr>';
|
||||
|
||||
|
||||
// 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 '</td><td class="datos">';
|
||||
html_print_textarea ("custom_value", $custom_value, 2, $custom_value, 'style="width:400px;"');
|
||||
|
||||
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></tr>';
|
||||
|
||||
|
||||
// SNMP Agent
|
||||
echo '<tr id="tr-source_ip"><td class="datos2">'.__('SNMP Agent').' (IP)</td><td class="datos2">';
|
||||
html_print_input_text ("source_ip", $source_ip, '', 20);
|
||||
echo '</td></tr>';
|
||||
|
||||
|
||||
// Trap type
|
||||
echo '<tr><td class="datos">'.__('Trap type').'</td><td class="datos">';
|
||||
$trap_types = array(-1 => __('None'), 0 => __('Cold start (0)'), 1 => __('Warm start (1)'), 2 => __('Link down (2)'), 3 => __('Link up (3)'), 4 => __('Authentication failure (4)'), 5 => __('Other'));
|
||||
echo html_print_select ($trap_types, 'trap_type', $trap_type, '', '', '', false, false, false);
|
||||
echo '</td></tr>';
|
||||
|
||||
|
||||
// Single value
|
||||
echo '<tr><td class="datos">'.__('Single value').'</td><td class="datos">';
|
||||
html_print_input_text ("single_value", $single_value, '', 20);
|
||||
echo '</td></tr>';
|
||||
|
||||
|
||||
// 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 '</td><td class="datos">';
|
||||
html_print_input_text ("custom_oid_data_1", $custom_oid_data_1, '', 60);
|
||||
echo '</td></tr>';
|
||||
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></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 '</td><td class="datos">';
|
||||
html_print_input_text ("custom_oid_data_2", $custom_oid_data_2, '', 60);
|
||||
//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></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 '</td><td class="datos">';
|
||||
html_print_input_text ("custom_oid_data_3", $custom_oid_data_3, '', 60);
|
||||
//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></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 '</td><td class="datos">';
|
||||
html_print_input_text ("custom_oid_data_4", $custom_oid_data_4, '', 60);
|
||||
//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></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 '</td><td class="datos">';
|
||||
html_print_input_text ("custom_oid_data_5", $custom_oid_data_5, '', 60);
|
||||
echo '</td></tr>';
|
||||
|
||||
//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></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 '</td><td class="datos">';
|
||||
html_print_input_text ("custom_oid_data_6", $custom_oid_data_6, '', 60);
|
||||
//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></tr>';
|
||||
|
||||
//Button
|
||||
//echo '<tr><td></td><td align="right">';
|
||||
|
||||
|
||||
// End table
|
||||
//echo "</td></tr></table>";
|
||||
|
||||
// Alert configuration
|
||||
|
||||
|
||||
//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>';
|
||||
|
||||
|
@ -317,29 +325,29 @@ if (isset ($_GET["update_alert"])) {
|
|||
echo '</td></tr><tr><td class="datos">'.__('Max. number of alerts').'</td><td class="datos">';
|
||||
html_print_input_text ("max_alerts", $max_alerts, '', 3);
|
||||
echo '</td></tr>';
|
||||
|
||||
|
||||
// Time Threshold
|
||||
echo '<tr><td class="datos2">'.__('Time threshold').'</td><td class="datos2">';
|
||||
|
||||
$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');
|
||||
echo '<div id="div-time_other" style="display:none">';
|
||||
html_print_input_text ("time_other", 0, '', 6);
|
||||
echo ' '.__('seconds').'</div></td></tr>';
|
||||
|
||||
|
||||
// Priority
|
||||
echo '<tr><td class="datos">'.__('Priority').'</td><td class="datos">';
|
||||
echo html_print_select (get_priorities (), "priority", $priority, '', '', '0', false, false, false);
|
||||
|
@ -353,7 +361,7 @@ if (isset ($_GET["update_alert"])) {
|
|||
if ($result === false) {
|
||||
$result = array ();
|
||||
}
|
||||
|
||||
|
||||
foreach ($result as $row) {
|
||||
$fields[$row["id"]] = $row["name"];
|
||||
}
|
||||
|
@ -369,21 +377,22 @@ if (isset ($_GET["update_alert"])) {
|
|||
"alert_type", $alert_type, '', '', 0, false, false, false);
|
||||
break;
|
||||
}
|
||||
echo '</td></tr>';
|
||||
echo '</td></tr>';
|
||||
|
||||
echo '</table>';
|
||||
|
||||
echo '</table>';
|
||||
|
||||
echo "<table style='width:98%'>";
|
||||
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
|
||||
|
@ -401,13 +410,13 @@ if (isset ($_GET["update_alert"])) {
|
|||
$table->width = "98%";
|
||||
$table->class= "databox";
|
||||
$table->align = array ();
|
||||
|
||||
|
||||
$table->head[0] = __('Alert action');
|
||||
|
||||
$table->head[1] = __('SNMP Agent');
|
||||
$table->size[1] = "90px";
|
||||
$table->align[1] = 'center';
|
||||
|
||||
|
||||
$table->head[2] = __('OID');
|
||||
$table->align[2] = 'center';
|
||||
|
||||
|
@ -421,41 +430,42 @@ if (isset ($_GET["update_alert"])) {
|
|||
|
||||
$table->head[6] = __('Last fired');
|
||||
$table->align[6] = 'center';
|
||||
|
||||
|
||||
$table->head[7] = __('Action');
|
||||
$table->size[7] = "50px";
|
||||
$table->align[7] = 'center';
|
||||
|
||||
|
||||
foreach ($result as $row) {
|
||||
$data = array ();
|
||||
$data[0] = '<a href="index.php?sec=estado&sec2=godmode/snmpconsole/snmp_alert&update_alert='.$row["id_as"].'">' . alerts_get_alert_action_name ($row["id_alert"]) . '</a>';
|
||||
|
||||
|
||||
$data[1] = __('SNMP Agent');
|
||||
$data[1] = $row["agent"];
|
||||
$data[1] = $row["agent"];
|
||||
$data[2] = __('OID');
|
||||
$data[2] = $row["oid"];
|
||||
$data[3] = __('Custom Value/OID');
|
||||
$data[3] = $row["custom_oid"];
|
||||
|
||||
|
||||
$data[4] = $row["description"];
|
||||
$data[5] = $row["times_fired"];
|
||||
|
||||
|
||||
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>' .
|
||||
' <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>' .
|
||||
' <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);
|
||||
|
||||
$table->rowclass[$idx] = get_priority_class ($row["priority"]);
|
||||
}
|
||||
|
||||
|
||||
if (!empty ($table->data)) {
|
||||
html_print_table ($table);
|
||||
}
|
||||
|
@ -466,7 +476,7 @@ if (isset ($_GET["update_alert"])) {
|
|||
echo '<form name="agente" method="post" action="index.php?sec=estado&sec2=godmode/snmpconsole/snmp_alert&update_alert=-1">';
|
||||
html_print_submit_button (__('Create'), "add_alert", false, 'class="sub next"');
|
||||
echo "</form></div>";
|
||||
|
||||
|
||||
echo '<div style="margin-left: 30px; line-height: 17px; vertical-align: top; width:120px;">';
|
||||
echo '<h3>'.__('Legend').'</h3>';
|
||||
foreach (get_priorities () as $num => $name) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -436,21 +436,21 @@ function filemanager_file_explorer($real_directory, $relative_directory, $url, $
|
|||
$("#main_buttons").css("display", "none");
|
||||
$("#create_folder").css("display", "");
|
||||
}
|
||||
|
||||
|
||||
function show_upload_file() {
|
||||
$("#table1-1").css('display', '');
|
||||
|
||||
$("#main_buttons").css("display", "none");
|
||||
$("#upload_file").css("display", "");
|
||||
}
|
||||
|
||||
|
||||
function show_create_text_file() {
|
||||
$("#table1-1").css('display', '');
|
||||
|
||||
$("#main_buttons").css("display", "none");
|
||||
$("#create_text_file").css("display", "");
|
||||
}
|
||||
|
||||
|
||||
function show_main_buttons_folder() {
|
||||
//$("#main_buttons").css("display", "");
|
||||
$("#table1-1").css('display', 'none');
|
||||
|
@ -609,13 +609,13 @@ function filemanager_file_explorer($real_directory, $relative_directory, $url, $
|
|||
$data[4] .= html_print_input_hidden ('filename', $fileinfo['realpath'], true);
|
||||
$data[4] .= html_print_input_hidden('hash', md5($fileinfo['realpath'] . $config['dbpass']), true);
|
||||
$data[4] .= html_print_input_hidden ('delete_file', 1, true);
|
||||
|
||||
|
||||
$relative_dir = str_replace($config['homedir'], '', dirname($fileinfo['realpath']));
|
||||
if ($relative_dir[0] == '/') {
|
||||
$relative_dir = substr($relative_dir, 1);
|
||||
}
|
||||
$hash2 = md5($relative_dir . $config['dbpass']);
|
||||
|
||||
|
||||
$data[4] .= html_print_input_hidden ('directory', $relative_dir, true);
|
||||
$data[4] .= html_print_input_hidden ('hash2', $hash2, true);
|
||||
$data[4] .= '</form>';
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -478,7 +478,7 @@ function networkmap_create_agent_node ($agent, $simple = 0, $font_size = 10, $cu
|
|||
// Returns a module node definition
|
||||
function networkmap_create_module_node ($module, $simple = 0, $font_size = 10) {
|
||||
$status = modules_get_agentmodule_status($module['id_agente_modulo']);
|
||||
|
||||
|
||||
// Set node status
|
||||
switch($status) {
|
||||
case 0:
|
||||
|
@ -497,7 +497,7 @@ function networkmap_create_module_node ($module, $simple = 0, $font_size = 10) {
|
|||
$status_color = '#BBBBBB'; // Unknown monitor
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($simple == 0){
|
||||
$node = $module['id_node'].' [ color="'.$status_color.'", fontsize='.$font_size.', style="filled", fixedsize=true, width=0.30, height=0.30, label=<<TABLE CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR><TD>' . ui_print_moduletype_icon ($module['id_tipo_modulo'], true, true, false). '</TD></TR>
|
||||
|
@ -524,7 +524,7 @@ function networkmap_create_pandora_node ($name, $font_size = 10, $simple = 0, $s
|
|||
|
||||
$node = '0 [ color="#364D1F", fontsize='.$font_size.', style="filled", fixedsize=true, width=0.8, height=0.6, label=<'.$label.'>,
|
||||
shape="ellipse", tooltip="ajax.php?page=include/ajax/networkmap.ajax&action=get_networkmap_summary&stats='.$stats_json.'", URL="index.php?sec=estado&sec2=operation/agentes/group_view" ];';
|
||||
|
||||
|
||||
return $node;
|
||||
}
|
||||
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
|
||||
|
@ -273,7 +273,7 @@ function gd_progress_bar ($width, $height, $progress, $title, $font, $out_of_lim
|
|||
function drawRating($rating, $width, $height, $font, $out_of_lim_str, $mode, $fontsize, $value_text, $color) {
|
||||
global $config;
|
||||
global $REMOTE_ADDR;
|
||||
|
||||
|
||||
// Round corners defined in global setup
|
||||
if ($config["round_corner"] != 0) {
|
||||
$radius = ($height > 18) ? 8 : 0;
|
||||
|
@ -281,7 +281,7 @@ function gd_progress_bar ($width, $height, $progress, $title, $font, $out_of_lim
|
|||
else {
|
||||
$radius = 0;
|
||||
}
|
||||
|
||||
|
||||
if ($width == 0) {
|
||||
$width = 150;
|
||||
}
|
||||
|
@ -352,7 +352,7 @@ function gd_progress_bar ($width, $height, $progress, $title, $font, $out_of_lim
|
|||
$x2 = $ratingbar30;
|
||||
}
|
||||
ImageRectangleWithRoundedCorners($image, $x1, $y1, $x2, $y2, $radius,$blue);
|
||||
}
|
||||
}
|
||||
|
||||
if ($rating > 50)
|
||||
if ($rating > 100)
|
||||
|
@ -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)
|
||||
|
@ -406,7 +404,7 @@ function gd_progress_bar ($width, $height, $progress, $title, $font, $out_of_lim
|
|||
// Draw rectangle without corners
|
||||
ImageFilledRectangle($im, $x1+$radius, $y1, $x2-$radius, $y2, $color);
|
||||
ImageFilledRectangle($im, $x1, $y1+$radius, $x2, $y2-$radius, $color);
|
||||
|
||||
|
||||
// Draw circled corners
|
||||
ImageFilledEllipse($im, $x1+$radius, $y1+$radius, $radius*2, $radius*2, $color);
|
||||
ImageFilledEllipse($im, $x2-$radius, $y1+$radius, $radius*2, $radius*2, $color);
|
||||
|
@ -427,7 +425,7 @@ function gd_progress_bar ($width, $height, $progress, $title, $font, $out_of_lim
|
|||
$imgPng = imageCreateFromPng($out_of_lim_image);
|
||||
imageAlphaBlending($imgPng, true);
|
||||
imageSaveAlpha($imgPng, true);
|
||||
imagePng($imgPng);
|
||||
imagePng($imgPng);
|
||||
}
|
||||
else
|
||||
drawRating($progress, $width, $height, $font, $out_of_lim_str, $mode, 6, $value_text, $color);
|
||||
|
|
|
@ -847,7 +847,7 @@ function pch_threshold_graph ($graph_type, $index, $data, $width, $height, $font
|
|||
$settings = array("Gradient"=>TRUE,"GradientMode"=>GRADIENT_EFFECT_CAN,"DisplayValues"=>$show_values,"DisplayZeroValues"=>FALSE,"DisplayR"=>100,"DisplayG"=>100,"DisplayB"=>100,"DisplayShadow"=>TRUE,"Surrounding"=>5,"AroundZero"=>FALSE);
|
||||
$myPicture->drawSplineChart($settings);
|
||||
$myPicture->setShadow(FALSE);
|
||||
|
||||
|
||||
if($show_legend) {
|
||||
/* Write the chart legend */
|
||||
$myPicture->drawLegend(643,210,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL));
|
||||
|
|
|
@ -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> ";
|
||||
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> ";
|
||||
|
||||
$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> ';
|
||||
|
||||
$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> ';
|
||||
|
||||
$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>';
|
||||
}
|
||||
|
||||
|
@ -484,7 +488,7 @@ foreach ($modules as $module) {
|
|||
else {
|
||||
echo "<td class=".$tdcolor."></td>";
|
||||
}
|
||||
|
||||
|
||||
echo "<td class='".$tdcolor."f9'>";
|
||||
if ($module["utimestamp"] != 0){
|
||||
$seconds = get_system_time () - $module["utimestamp"];
|
||||
|
|
|
@ -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", "");
|
||||
|
|
|
@ -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 <apache user> ".$config["attachment_store"];
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
|
@ -68,7 +68,7 @@ if ($add_networkmap) {
|
|||
$name = $activeTab;
|
||||
$check = db_get_value('name', 'tnetwork_map', 'name', $name);
|
||||
$sql = db_get_value_filter('COUNT(name)', 'tnetwork_map', array('name' => "%$name"));
|
||||
|
||||
|
||||
if ($check) {
|
||||
$id_networkmap = networkmap_create_networkmap("($sql) ".$name, $activeTab, $layout, $nooverlap, $simple, $regen, $font_size, $group, $module_group, $depth, $modwithalerts, $hidepolicymodules, $zoom, $ranksep, $center);
|
||||
$message = ui_print_result_message ($id_networkmap,
|
||||
|
@ -106,11 +106,11 @@ 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'),
|
||||
__('Could not save network map'), '', true);
|
||||
|
@ -169,26 +169,26 @@ if($recenter_networkmap) {
|
|||
if ($pure == 1) {
|
||||
$buttons['screen'] = array('active' => false,
|
||||
'text' => '<a href="index.php?sec=network&sec2=operation/agentes/networkmap&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&sec2=operation/agentes/networkmap&pure=1&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&sec2=operation/agentes/networkmap&tab=policies&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&sec2=operation/agentes/networkmap&tab=groups&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&sec2=operation/agentes/networkmap&tab=topology&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&sec2=operation/agentes/networkmap&add_networkmap=1&tab='.$activeTab.'&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&sec2=operation/agentes/networkmap&id_networkmap='.$id_networkmap.'&delete_networkmap=1&tab='.$activeTab.'&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&sec2=operation/agentes/networkmap&id_networkmap='.$id_networkmap.'&save_networkmap=1
|
||||
&tab='.$activeTab.'&save_networkmap=1&name='.$name.'&group='.$group.'
|
||||
&layout='.$layout.'&nooverlap='.$nooverlap.'&simple='.$simple.'&regen='.$regen.'
|
||||
&zoom='.$zoom.'&ranksep='.$ranksep.'&fontsize='.$font_size.'&depth='.$depth.'
|
||||
&modwithalerts='.$modwithalerts.'&hidepolicymodules='.$hidepolicymodules.'
|
||||
&module_group='.$module_group.'&pure='.$pure.'&hidden_options='.(int)$hidden_options.'
|
||||
&show_snmp_modules='.(int)$show_snmp_modules.'">' .
|
||||
html_print_image("images/file.png", true, array ("title" => __('Save map'))) .'</a>');
|
||||
&tab='.$activeTab.'&save_networkmap=1&name='.$name.'&group='.$group.'
|
||||
&layout='.$layout.'&nooverlap='.$nooverlap.'&simple='.$simple.'&regen='.$regen.'
|
||||
&zoom='.$zoom.'&ranksep='.$ranksep.'&fontsize='.$font_size.'&depth='.$depth.'
|
||||
&modwithalerts='.$modwithalerts.'&hidepolicymodules='.$hidepolicymodules.'
|
||||
&module_group='.$module_group.'&pure='.$pure.'&hidden_options='.(int)$hidden_options.'
|
||||
&show_snmp_modules='.(int)$show_snmp_modules.'">' .
|
||||
html_print_image("images/file.png", true, array ("title" => __('Save map'))) .'</a>');
|
||||
}
|
||||
|
||||
$title = '';
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)";
|
||||
}
|
||||
|
||||
|
|
|
@ -97,19 +97,19 @@ else {
|
|||
|
||||
if (check_acl ($config["id_user"], $map['group_id'], "IW"))
|
||||
$buttons [] = '<a href="index.php?sec=godgismaps&sec2=godmode/gis_maps/configure_gis_map&action=edit_map&map_id='. $idMap.'">'.html_print_image ("images/setup.png", true, array ("title" => __('Setup'))).'</a>';
|
||||
|
||||
|
||||
$buttonsString = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=3">' . html_print_image("images/bricks.png", true, array("class" => "top", "border" => '0')) . ' Agent - test_gis1</a></li></ul></div><div id="menu_tab"><ul class="mn"><li class="nomn"><a href="index.php?sec=estado&sec2=godmode/agentes/configurar_agente&id_agente=3">' . html_print_image("images/setup.png", true, array("class" => "top", "title" => "Manage", "border" => "0", "width" => "16", "title" => "Manage")) . ' </a></li><li class="nomn_high"><a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=3">' . html_print_image("images/monitor.png", true, array("class" => "top", "title" => "Main", "border" => "0")) . ' </a></li><li class="nomn"><a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=3&tab=data">' . html_print_image("images/lightbulb.png", true, array("class" => "top", "title" => "Data", "border" => "0")) . ' </a></li><li class="nomn"><a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=3&tab=alert">' . html_print_image("images/bell.png", true, array("class" => "top", "title" => "Alerts", "border" => "0")) . ' </a></li><li class="nomn"><a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=sla&id_agente=3">' . html_print_image("images/images.png", true, array("class" => "top", "title" => "S.L.A.", "border" => "0")) . ' </a></li><li class="nomn"><a href="index.php?sec=estado&sec2=operation/agentes/estado_agente&group_id=2">' . html_print_image("images/agents_group.png", true, array("class" => "top", "title" => "Group", "border" => "0")) . ' </a></li><li class="nomn"><a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=inventory&id_agente=3">' . html_print_image("images/page_white_text.png", true, array("class" => "top", "title" => "Inventory", "border" => "0", "width" => "16")) . ' </a></li><li class="nomn"><a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=gis&id_agente=3">' . html_print_image("images/world.png", array("class" => "top", "title" => "GIS data", "border" => "0")) . ' </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[] = ' ' . __('Refresh: ') . html_print_select($times, 'refresh_time', 60, 'changeRefreshTime(this.value);', '', 0, true, false, false) . " ";
|
||||
|
@ -148,7 +148,7 @@ if ($layers != false) {
|
|||
$agentNamesByLayer = gis_get_agents_layer($layer['id_tmap_layer'], array('nombre'));
|
||||
|
||||
$agentNames = array_unique($agentNamesByGroup + $agentNamesByLayer);
|
||||
|
||||
|
||||
foreach ($agentNames as $agentName) {
|
||||
$idAgent = agents_get_agent_id($agentName);
|
||||
$coords = gis_get_data_last_position_agent($idAgent);
|
||||
|
@ -172,7 +172,7 @@ if ($layers != false) {
|
|||
}
|
||||
}
|
||||
gis_add_parent_lines();
|
||||
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$timestampLastOperation = db_get_value_sql("SELECT UNIX_TIMESTAMP()");
|
||||
|
@ -191,29 +191,28 @@ if ($layers != false) {
|
|||
|
||||
// Resize GIS map on fullscreen
|
||||
if ($config["pure"] != 0) {
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$().ready(function(){
|
||||
|
||||
var new_height = $(document).height();
|
||||
$("#map").css("height", new_height - 60);
|
||||
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$().ready(function(){
|
||||
|
||||
var new_height = $(document).height();
|
||||
$("#map").css("height", new_height - 60);
|
||||
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
else {
|
||||
// Resize GIS map on normalview
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$().ready(function(){
|
||||
|
||||
var new_height = $("#menu").height();
|
||||
$("#map").css("height", new_height - 20);
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
<?php
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$().ready(function(){
|
||||
|
||||
var new_height = $("#menu").height();
|
||||
$("#map").css("height", new_height - 20);
|
||||
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue