Fixed interfaces snmp, because dont show icon of open graphs and problems with show graphs when click in icons. Gitlab: #541

This commit is contained in:
m-lopez-f 2017-03-17 10:13:57 +01:00
parent 25fb6bd894
commit 26b3754ee8
4 changed files with 38 additions and 21 deletions

View File

@ -2459,27 +2459,27 @@ function agents_get_network_interfaces ($agents = false, $agents_filter = false)
else{ else{
$interface_traffic_modules = agents_get_modules($agent_id, $columns, "nombre LIKE 'if%Octets_$interface_name'"); $interface_traffic_modules = agents_get_modules($agent_id, $columns, "nombre LIKE 'if%Octets_$interface_name'");
} }
if (!empty($interface_traffic_modules) && count($interface_traffic_modules) >= 2) { if (!empty($interface_traffic_modules) && count($interface_traffic_modules) >= 2) {
$interface_traffic_modules_aux = array('in' => '', 'out' => ''); $interface_traffic_modules_aux = array('in' => '', 'out' => '');
foreach ($interface_traffic_modules as $interface_traffic_module) { foreach ($interface_traffic_modules as $interface_traffic_module) {
$interface_name_escaped = str_replace("/", "\/", $interface_name); $interface_name_escaped = str_replace("/", "\/", $interface_name);
if($type_interface){ if ($type_interface) {
if (preg_match ("/^" . $interface_name_escaped . "_if(.+)Octets$/i", $interface_traffic_module['nombre'], $matches)) { if (preg_match ("/^" . $interface_name_escaped . "_if(.+)Octets$/i", $interface_traffic_module['nombre'], $matches)) {
if (strtolower($matches[1]) == 'in') { if (strtolower($matches[1]) == 'in' || strtolower($matches[1]) == 'hcin') {
$interface_traffic_modules_aux['in'] = $interface_traffic_module['id_agente_modulo']; $interface_traffic_modules_aux['in'] = $interface_traffic_module['id_agente_modulo'];
} }
elseif (strtolower($matches[1]) == 'out') { elseif (strtolower($matches[1]) == 'out' || strtolower($matches[1]) == 'hcout') {
$interface_traffic_modules_aux['out'] = $interface_traffic_module['id_agente_modulo']; $interface_traffic_modules_aux['out'] = $interface_traffic_module['id_agente_modulo'];
} }
} }
} }
else{ else{
if (preg_match ("/^if(.+)Octets_$interface_name_escaped$/i", $interface_traffic_module['nombre'], $matches)) { if (preg_match ("/^if(.+)Octets_$interface_name_escaped$/i", $interface_traffic_module['nombre'], $matches)) {
if (strtolower($matches[1]) == 'in') { if (strtolower($matches[1]) == 'in' || strtolower($matches[1]) == 'hcin') {
$interface_traffic_modules_aux['in'] = $interface_traffic_module['id_agente_modulo']; $interface_traffic_modules_aux['in'] = $interface_traffic_module['id_agente_modulo'];
} }
elseif (strtolower($matches[1]) == 'out') { elseif (strtolower($matches[1]) == 'out' || strtolower($matches[1]) == 'hcout') {
$interface_traffic_modules_aux['out'] = $interface_traffic_module['id_agente_modulo']; $interface_traffic_modules_aux['out'] = $interface_traffic_module['id_agente_modulo'];
} }
} }

View File

@ -1720,20 +1720,10 @@ function db_check_minor_relase_available () {
* *
* @return bool Return if minor release is available or not * @return bool Return if minor release is available or not
*/ */
function db_check_minor_relase_available_to_um ($package, $ent, $offline) { function db_check_minor_relase_available_to_um ($package) {
global $config; global $config;
if (!$ent) { $dir = sys_get_temp_dir() . "/pandora_oum/" . $package . "/extras/mr";
$dir = $config['attachment_store'] . "/last_package/downloads/extras/mr";
}
else {
if ($offline) {
$dir = $package . "/extras/mr";
}
else {
$dir = sys_get_temp_dir() . "/pandora_oum/" . $package . "/extras/mr";
}
}
$have_minor_release = false; $have_minor_release = false;

View File

@ -450,6 +450,7 @@ if (!empty($network_interfaces)) {
$table_interface->head_colspan[0] = 8; $table_interface->head_colspan[0] = 8;
$table_interface->data = array(); $table_interface->data = array();
$event_text_cont = 0; $event_text_cont = 0;
foreach ($network_interfaces as $interface_name => $interface) { foreach ($network_interfaces as $interface_name => $interface) {
if (!empty($interface['traffic'])) { if (!empty($interface['traffic'])) {
$permission = false; $permission = false;

View File

@ -82,11 +82,12 @@ $interface_traffic_modules = array(
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Pandora FMS Graph (<?php echo agents_get_alias($agent_id) . ' - ' . $interface_name; ?>)</title> <title>Pandora FMS Graph (<?php echo agents_get_alias($agent_id) . ' - ' . $interface_name; ?>)</title>
<link rel="stylesheet" href="../../include/styles/pandora_minimal.css" type="text/css" /> <link rel="stylesheet" href="../../include/styles/pandora_minimal.css" type="text/css" />
<script type='text/javaScript' src='../../include/javascript/calendar.js'></script> <link rel="stylesheet" href="../../include/styles/jquery-ui-1.10.0.custom.css" type="text/css" />
<script type='text/javascript' src='../../include/javascript/pandora.js'></script> <script type='text/javascript' src='../../include/javascript/pandora.js'></script>
<script type='text/javascript' src='../../include/javascript/jquery-1.9.0.js'></script> <script type='text/javascript' src='../../include/javascript/jquery-1.9.0.js'></script>
<script type='text/javascript' src='../../include/javascript/jquery.pandora.js'></script> <script type='text/javascript' src='../../include/javascript/jquery.pandora.js'></script>
<script type='text/javascript'> <script type='text/javascript' src='../../include/javascript/jquery.jquery-ui-1.10.0.custom.js'></script>
<script type='text/javascript'>
<!-- <!--
window.onload = function() { window.onload = function() {
// Hack to repeat the init process to period select // Hack to repeat the init process to period select
@ -103,7 +104,7 @@ $interface_traffic_modules = array(
$("#hidden-show_other").val(0); $("#hidden-show_other").val(0);
} }
} }
//--> -->
</script> </script>
</head> </head>
<body bgcolor="#ffffff" style='background:#ffffff;'> <body bgcolor="#ffffff" style='background:#ffffff;'>
@ -295,6 +296,13 @@ $interface_traffic_modules = array(
</body> </body>
</html> </html>
<?php
// Echo the script tags of the datepicker and the timepicker
// Modify the user language cause the ui.datepicker language files use - instead _
$custom_user_language = str_replace('_', '-', $user_language);
ui_require_jquery_file("ui.datepicker-" . $custom_user_language, "include/javascript/i18n/", true);
ui_include_time_picker(true);
?>
<script> <script>
<?php <?php
@ -321,5 +329,23 @@ $interface_traffic_modules = array(
} }
?> ?>
// Add datepicker and timepicker
$("#text-start_date").datepicker({
dateFormat: "<?php echo DATE_FORMAT_JS; ?>"
});
$("#text-start_time").timepicker({
showSecond: true,
timeFormat: '<?php echo TIME_FORMAT_JS; ?>',
timeOnlyTitle: '<?php echo __('Choose time');?>',
timeText: '<?php echo __('Time');?>',
hourText: '<?php echo __('Hour');?>',
minuteText: '<?php echo __('Minute');?>',
secondText: '<?php echo __('Second');?>',
currentText: '<?php echo __('Now');?>',
closeText: '<?php echo __('Close');?>'
});
$.datepicker.setDefaults($.datepicker.regional["<?php echo $custom_user_language; ?>"]);
forced_title_callback(); forced_title_callback();
</script> </script>