#8769 Resolved conflict 2

This commit is contained in:
Daniel Maya 2022-07-14 13:02:39 +02:00
commit 4011ca99fe
57 changed files with 2086 additions and 101 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.763-220704
Version: 7.0NG.763-220714
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.763-220704"
pandora_version="7.0NG.763-220714"
echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -1015,7 +1015,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.763';
use constant AGENT_BUILD => '220704';
use constant AGENT_BUILD => '220714';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 7.0NG.763
%define release 220704
%define release 220714
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 7.0NG.763
%define release 220704
%define release 220714
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.763"
PI_BUILD="220704"
PI_BUILD="220714"
OS_NAME=`uname -s`
FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{220704}
{220714}
ViewReadme
{Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.763 Build 220704")
#define PANDORA_VERSION ("7.0NG.763 Build 220714")
string pandora_path;
string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.763(Build 220704))"
VALUE "ProductVersion", "(7.0NG.763(Build 220714))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.763-220704
Version: 7.0NG.763-220714
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.763-220704"
pandora_version="7.0NG.763-220714"
package_pear=0
package_pandora=1

View File

@ -1,5 +1,41 @@
START TRANSACTION;
CREATE TABLE IF NOT EXISTS `tuser_task` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`function_name` VARCHAR(80) NOT NULL DEFAULT '',
`parameters` TEXT ,
`name` VARCHAR(60) NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
CREATE TABLE IF NOT EXISTS `tuser_task_scheduled` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`id_usuario` VARCHAR(255) NOT NULL DEFAULT '0',
`id_user_task` INT UNSIGNED NOT NULL DEFAULT 0,
`args` TEXT,
`scheduled` ENUM('no','hourly','daily','weekly','monthly','yearly','custom') DEFAULT 'no',
`last_run` INT UNSIGNED DEFAULT 0,
`custom_data` INT NULL DEFAULT 0,
`flag_delete` TINYINT UNSIGNED NOT NULL DEFAULT 0,
`id_grupo` INT UNSIGNED NOT NULL DEFAULT 0,
`enabled` TINYINT UNSIGNED NOT NULL DEFAULT 1,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
ALTER TABLE `tautoconfig` ADD COLUMN `type_execution` VARCHAR(100) NOT NULL DEFAULT 'start';
ALTER TABLE `tautoconfig` ADD COLUMN `type_periodicity` VARCHAR(100) NOT NULL DEFAULT 'weekly';
ALTER TABLE `tautoconfig` ADD COLUMN `monday` TINYINT DEFAULT 0;
ALTER TABLE `tautoconfig` ADD COLUMN `tuesday` TINYINT DEFAULT 0;
ALTER TABLE `tautoconfig` ADD COLUMN `wednesday` TINYINT DEFAULT 0;
ALTER TABLE `tautoconfig` ADD COLUMN `thursday` TINYINT DEFAULT 0;
ALTER TABLE `tautoconfig` ADD COLUMN `friday` TINYINT DEFAULT 0;
ALTER TABLE `tautoconfig` ADD COLUMN `saturday` TINYINT DEFAULT 0;
ALTER TABLE `tautoconfig` ADD COLUMN `sunday` TINYINT DEFAULT 0;
ALTER TABLE `tautoconfig` ADD COLUMN `periodically_day_from` INT UNSIGNED DEFAULT NULL;
ALTER TABLE `tautoconfig` ADD COLUMN `periodically_time_from` time NULL DEFAULT NULL;
ALTER TABLE `tautoconfig` ADD COLUMN `executed` TINYINT UNSIGNED NOT NULL DEFAULT 0;
ALTER TABLE `tusuario` DROP COLUMN `metaconsole_assigned_server`;
COMMIT;

Binary file not shown.

After

Width:  |  Height:  |  Size: 419 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 712 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 465 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 463 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 284 B

View File

@ -55,6 +55,7 @@ if (! check_acl($config['id_user'], 0, 'ER')
return;
}
$drawConsoleSound = (bool) get_parameter('drawConsoleSound', false);
$process_buffers = (bool) get_parameter('process_buffers', false);
$get_extended_event = (bool) get_parameter('get_extended_event');
$change_status = (bool) get_parameter('change_status');
@ -2225,6 +2226,228 @@ if ($process_buffers === true) {
return;
}
if ($drawConsoleSound === true) {
echo ui_require_css_file('wizard', 'include/styles/', true);
echo ui_require_css_file('discovery', 'include/styles/', true);
echo ui_require_css_file('sound_events', 'include/styles/', true);
$output = '<div id="tabs-sound-modal">';
// Header tabs.
$output .= '<ul class="tabs-sound-modal-options">';
$output .= '<li>';
$output .= '<a href="#tabs-sound-modal-1">';
$output .= html_print_image(
'images/gear.png',
true,
[
'title' => __('Options'),
'class' => 'invert_filter',
]
);
$output .= '</a>';
$output .= '</li>';
$output .= '<li>';
$output .= '<a href="#tabs-sound-modal-2">';
$output .= html_print_image(
'images/list.png',
true,
[
'title' => __('Events list'),
'class' => 'invert_filter',
]
);
$output .= '</a>';
$output .= '</li>';
$output .= '</ul>';
// Content tabs.
$output .= '<div id="tabs-sound-modal-1">';
$output .= '<h3 class="console-configuration">';
$output .= __('Console configuration');
$output .= '</h3>';
$inputs = [];
// Load filter.
$fields = \events_get_event_filter_select();
$inputs[] = [
'label' => \__('Set condition'),
'arguments' => [
'type' => 'select',
'fields' => $fields,
'name' => 'filter_id',
'selected' => 0,
'return' => true,
'nothing' => \__('All new events'),
'nothing_value' => 0,
'class' => 'fullwidth',
],
];
$times_interval = [
10 => '10 '.__('seconds'),
15 => '15 '.__('seconds'),
30 => '30 '.__('seconds'),
60 => '60 '.__('seconds'),
];
$times_sound = [
2 => '2 '.__('seconds'),
5 => '5 '.__('seconds'),
10 => '10 '.__('seconds'),
15 => '15 '.__('seconds'),
30 => '30 '.__('seconds'),
60 => '60 '.__('seconds'),
];
$inputs[] = [
'class' => 'interval-sounds',
'direct' => 1,
'block_content' => [
[
'label' => __('Interval'),
'arguments' => [
'type' => 'select',
'fields' => $times_interval,
'name' => 'interval',
'selected' => 10,
'return' => true,
],
],
[
'label' => __('Time Sound'),
'arguments' => [
'type' => 'select',
'fields' => $times_sound,
'name' => 'time_sound',
'selected' => 10,
'return' => true,
],
],
],
];
$sounds = [
'aircraftalarm.wav' => 'Air craft alarm',
'air_shock_alarm.wav' => 'Air shock alarm',
'alien_alarm.wav' => 'Alien alarm',
'alien_beacon.wav' => 'Alien beacon',
'bell_school_ringing.wav' => 'Bell school ringing',
'Door_Alarm.wav' => 'Door alarm',
'EAS_beep.wav' => 'EAS beep',
'Firewarner.wav' => 'Fire warner',
'HardPCMAlarm.wav' => 'Hard PCM Alarm',
'negativebeep.wav' => 'Negative beep',
'Star_Trek_emergency_simulation.wav' => 'StarTrek emergency simulation',
];
$inputs[] = [
'class' => 'test-sounds',
'direct' => 1,
'block_content' => [
[
'label' => \__('Sound melody'),
'arguments' => [
'type' => 'select',
'fields' => $sounds,
'name' => 'sound_id',
'selected' => 'Star_Trek_emergency_simulation.wav',
'return' => true,
'class' => 'fullwidth',
],
],
[
'arguments' => [
'type' => 'button',
'name' => 'melody_sound',
'label' => __('Test sound'),
'attributes' => 'class="sub upd"',
'return' => true,
],
],
],
];
// Print form.
$output .= HTML::printForm(
[
'form' => [
'action' => '',
'method' => 'POST',
],
'inputs' => $inputs,
],
true,
false
);
$output .= '</div>';
$output .= '<div id="tabs-sound-modal-2">';
$output .= '<h3 class="title-discovered-alerts">';
$output .= __('Discovered alerts');
$output .= '</h3>';
$output .= '<div class="empty-discovered-alerts">';
$output .= html_print_image(
'images/no-alerts-discovered.png',
true,
[
'title' => __('No alerts discovered'),
'class' => 'invert_filter',
]
);
$output .= '<span class="text-discovered-alerts">';
$output .= __('Congrats! theres nothing to show');
$output .= '</span>';
$output .= '</div>';
$output .= '<div class="elements-discovered-alerts"><ul></ul></div>';
$output .= '</div>';
$output .= '</div>';
$output .= '<div class="actions-sound-modal">';
$output .= '<div id="progressbar_time"></div>';
$output .= '<div class="buttons-sound-modal">';
$output .= '<div class="container-button-play">';
$output .= html_print_input(
[
'label' => __('Start'),
'type' => 'button',
'name' => 'start-search',
'attributes' => 'class="sub play"',
'return' => true,
],
'div',
true
);
$output .= '</div>';
$output .= '<div class="container-button-alert">';
$output .= html_print_input(
[
'type' => 'button',
'name' => 'no-alerts',
'label' => __('No alerts'),
'attributes' => 'class="sub alerts"',
'return' => true,
],
'div',
true
);
$output .= '</div>';
$output .= html_print_input(
[
'type' => 'hidden',
'name' => 'mode_alert',
'value' => 0,
'return' => true,
],
'div',
true
);
$output .= '</div>';
$output .= '</div>';
echo $output;
return;
}
if ($get_events_fired) {
global $config;
$filter_id = (int) get_parameter('filter_id', 0);

View File

@ -20,7 +20,7 @@
/**
* Pandora build version and version
*/
$build_version = 'PC220704';
$build_version = 'PC220714';
$pandora_version = 'v7.0NG.763';
// Do not overwrite default timezone set if defined.

View File

@ -2263,7 +2263,14 @@ function check_login($output=true)
|| (isset($_SESSION['merge-request-user-trick']) === true
&& $_SESSION['merge-request-user-trick'] === $_SESSION['id_usuario'])
) {
$config['id_user'] = $_SESSION['id_usuario'];
if (isset($config['auth']) === true && $config['auth'] === 'ad' && is_user($_SESSION['id_usuario'])) {
// User name in active directory is case insensitive.
// Get the user name from database.
$user_info = get_user_info($_SESSION['id_usuario']);
$config['id_user'] = $user_info['id_user'];
} else {
$config['id_user'] = $_SESSION['id_usuario'];
}
return true;
}

View File

@ -4294,3 +4294,140 @@ function agents_get_offspring(int $id_agent)
return $return;
}
function agents_get_starmap(int $id_agent, float $width=0, float $height=0)
{
ui_require_css_file('heatmap');
$all_modules = agents_get_modules($id_agent);
if (empty($all_modules)) {
return null;
}
$total_modules = count($all_modules);
// Best square.
$high = (float) max($width, $height);
$low = 0.0;
while (abs($high - $low) > 0.000001) {
$mid = (($high + $low) / 2.0);
$midval = (floor($width / $mid) * floor($height / $mid));
if ($midval >= $total_modules) {
$low = $mid;
} else {
$high = $mid;
}
}
$square_length = min(($width / floor($width / $low)), ($height / floor($height / $low)));
// Print starmap.
$html = sprintf(
'<svg id="svg_%s" style="width: %spx; height: %spx;">',
$id_agent,
$width,
$height
);
$html .= '<g>';
$row = 0;
$column = 0;
$x = 0;
$y = 0;
$cont = 1;
foreach ($all_modules as $key => $value) {
// Colour by status.
$status = modules_get_agentmodule_status($key);
switch ($status) {
case 0:
case 4:
case 300:
$status = 'normal';
break;
case 1:
case 100:
$status = 'critical';
break;
case 2:
case 200:
$status = 'warning';
break;
case 3:
$status = 'unknown';
break;
case 5:
$status = 'notinit';
break;
}
$html .= sprintf(
'<rect id="%s" x="%s" y="%s" row="%s" col="%s" width="%s" height="%s" class="%s_%s"></rect>',
'rect_'.$cont,
$x,
$y,
$row,
$column,
$square_length,
$square_length,
$status,
random_int(1, 10)
);
$y += $square_length;
$row++;
if ((int) ($y + $square_length) > (int) $height) {
$y = 0;
$x += $square_length;
$row = 0;
$column++;
}
if ((int) ($x + $square_length) > (int) $width) {
$x = 0;
$y += $square_length;
$column = 0;
$row++;
}
$cont++;
}
?>
<script type="text/javascript">
$(document).ready(function() {
const total_modules = '<?php echo $total_modules; ?>';
function getRandomInteger(min, max) {
return Math.floor(Math.random() * max) + min;
}
function oneSquare(solid, time) {
var randomPoint = getRandomInteger(1, total_modules);
let target = $(`#rect_${randomPoint}`);
let class_name = target.attr('class');
class_name = class_name.split('_')[0];
setTimeout(function() {
target.removeClass();
target.addClass(`${class_name}_${solid}`);
oneSquare(getRandomInteger(1, 10), getRandomInteger(100, 900));
}, time);
}
let cont = 0;
while (cont < Math.ceil(total_modules / 3)) {
oneSquare(getRandomInteger(1, 10), getRandomInteger(100, 900));
cont ++;
}
});
</script>
<?php
$html .= '</g>';
$html .= '</svg>';
return $html;
}

View File

@ -1424,16 +1424,19 @@ function events_get_all(
$group_selects = '';
if ($group_by != '') {
if ($count === false) {
$group_selects = ',COUNT(id_evento) AS event_rep,
GROUP_CONCAT(DISTINCT user_comment SEPARATOR "<br>") AS comments,
MAX(utimestamp) as timestamp_last,
MIN(utimestamp) as timestamp_first,
MAX(id_evento) as max_id_evento';
$idx = array_search('te.user_comment', $fields);
if ($idx !== false) {
unset($fields[$idx]);
}
$group_selects = sprintf(
',COUNT(id_evento) AS event_rep,
%s
MAX(utimestamp) as timestamp_last,
MIN(utimestamp) as timestamp_first,
MAX(id_evento) as max_id_evento',
($idx !== false) ? 'GROUP_CONCAT(DISTINCT user_comment SEPARATOR "<br>") AS comments,' : ''
);
}
} else {
$idx = array_search('te.user_comment', $fields);

View File

@ -2558,7 +2558,8 @@ function combined_graph_summatory_average(
function graphic_agentaccess(
int $id_agent,
int $period=0,
?bool $return=false
?bool $return=false,
?bool $agent_view=false
) {
global $config;
@ -2599,6 +2600,10 @@ function graphic_agentaccess(
$options = [];
$options['grid']['hoverable'] = true;
if ($agent_view === true) {
$options['agent_view'] = true;
}
if ($return === true) {
return vbar_graph($data_array, $options, 1);
} else {

View File

@ -1,5 +1,7 @@
<?php
global $config;
global $pandora_version;
global $build_version;
require_once __DIR__.'/config.php';

View File

@ -494,7 +494,7 @@ function vbar_graph(
'weight' => $options['x']['font']['weight'],
'family' => $options['x']['font']['family'],
'variant' => $options['x']['font']['variant'],
'color' => $options['x']['font']['color'],
'color' => ($options['agent_view'] === true) ? 'black' : $options['x']['font']['color'],
],
'show' => $options['x']['show'],
'position' => $options['x']['position'],
@ -516,7 +516,7 @@ function vbar_graph(
'weight' => $options['y']['font']['weight'],
'family' => $options['y']['font']['family'],
'variant' => $options['y']['font']['variant'],
'color' => $options['y']['font']['color'],
'color' => ($options['agent_view'] === true) ? 'black' : $options['y']['font']['color'],
],
'show' => $options['y']['show'],
'position' => $options['y']['position'],
@ -534,8 +534,8 @@ function vbar_graph(
'aboveData' => $options['grid']['aboveData'],
'color' => $options['grid']['color'],
'backgroundColor' => $options['grid']['backgroundColor'],
'margin' => $options['grid']['margin'],
'labelMargin' => $options['grid']['labelMargin'],
'margin' => ($options['agent_view'] === true) ? 6 : $options['grid']['margin'],
'labelMargin' => ($options['agent_view'] === true) ? 12 : $options['grid']['labelMargin'],
'axisMargin' => $options['grid']['axisMargin'],
'markings' => $options['grid']['markings'],
'borderWidth' => $options['grid']['borderWidth'],
@ -561,6 +561,10 @@ function vbar_graph(
],
];
if ($options['agent_view'] === true) {
$params['agent_view'] = true;
}
if (empty($params['data']) === true) {
return graph_nodata_image(
0,

View File

@ -670,6 +670,10 @@ function flot_vcolumn_chart(array $options)
$style .= 'height:'.$options['generals']['pdf']['height'].'px;';
}
if ($options['agent_view'] === true) {
$style = 'width: 95%; height: 85px';
}
$class = '';
if ($options['generals']['rotate'] === true) {
$class = 'bars-graph-rotate';

View File

@ -2869,7 +2869,7 @@ function donutNarrowGraph(
arc = d3.svg
.arc()
.outerRadius(radius)
.innerRadius(radius - radius / 6);
.innerRadius(radius - radius / 4);
svg = donutbody
.append("svg")

View File

@ -1,4 +1,4 @@
/*global jQuery, $, forced_title_callback, confirmDialog*/
/*global jQuery, $, forced_title_callback, confirmDialog, progressTimeBar*/
// Show the modal window of an event
function show_event_dialog(event, dialog_page) {
@ -1028,3 +1028,256 @@ function process_buffers(buffers) {
});
}
}
function openSoundEventModal(settings) {
settings = JSON.parse(atob(settings));
// Check modal exists and is open.
if (
$("#modal-sound").hasClass("ui-dialog-content") &&
$("#modal-sound").dialog("isOpen")
) {
return;
}
// Initialize modal.
$("#modal-sound")
.empty()
.dialog({
title: settings.title,
resizable: false,
modal: true,
position: { my: "right top", at: "right bottom", of: window },
overlay: {
opacity: 0.5,
background: "black"
},
width: 600,
height: 600,
open: function() {
$.ajax({
method: "post",
url: settings.url,
data: {
page: settings.page,
drawConsoleSound: 1
},
dataType: "html",
success: function(data) {
$("#modal-sound").append(data);
$("#tabs-sound-modal").tabs({
disabled: [1]
});
// Test sound.
$("#button-melody_sound").click(function() {
var sound = false;
if ($("#id_sound_event").length == 0) {
sound = true;
}
test_sound_button(sound);
});
// Play Stop.
$("#button-start-search").click(function() {
var mode = $("#hidden-mode_alert").val();
var action = false;
if (mode == 0) {
action = true;
}
action_events_sound(action, settings);
});
// Silence Alert.
$("#button-no-alerts").click(function() {
if ($("#button-no-alerts").hasClass("silence-alerts") === true) {
// Remove audio.
remove_audio();
// Clean events.
$("#tabs-sound-modal .elements-discovered-alerts ul").empty();
$("#tabs-sound-modal .empty-discovered-alerts").removeClass(
"invisible_important"
);
// Clean progress.
$("#progressbar_time").empty();
// Change img button.
$("#button-no-alerts")
.removeClass("silence-alerts")
.addClass("alerts");
// Change value button.
$("#button-no-alerts").val(settings.noAlert);
// Background button.
$(".container-button-alert").removeClass("fired");
// New progress.
listen_event_sound(settings);
}
});
},
error: function(error) {
console.error(error);
}
});
},
close: function() {
remove_audio();
$(this).dialog("destroy");
}
})
.show();
}
function test_sound_button(test_sound) {
if (test_sound === true) {
add_audio();
} else {
remove_audio();
}
}
function action_events_sound(mode, settings) {
if (mode === true) {
// Enable tabs.
$("#tabs-sound-modal").tabs("option", "disabled", [0]);
// Active tabs.
$("#tabs-sound-modal").tabs("option", "active", 1);
// Change mode.
$("#hidden-mode_alert").val(1);
// Change img button.
$("#button-start-search")
.removeClass("play")
.addClass("stop");
// Change value button.
$("#button-start-search").val(settings.stop);
// Add Progress bar.
listen_event_sound(settings);
} else {
// Enable tabs.
$("#tabs-sound-modal").tabs("option", "disabled", [1]);
// Active tabs.
$("#tabs-sound-modal").tabs("option", "active", 0);
// Change mode.
$("#hidden-mode_alert").val(0);
// Change img button.
$("#button-start-search")
.removeClass("stop")
.addClass("play");
// Change value button.
$("#button-start-search").val(settings.start);
// Remove progress bar.
$("#progressbar_time").empty();
// Remove audio.
remove_audio();
// Clean events.
$("#tabs-sound-modal .elements-discovered-alerts ul").empty();
$("#tabs-sound-modal .empty-discovered-alerts").removeClass(
"invisible_important"
);
// Change img button.
$("#button-no-alerts")
.removeClass("silence-alerts")
.addClass("alerts");
// Change value button.
$("#button-no-alerts").val(settings.noAlert);
// Background button.
$(".container-button-alert").removeClass("fired");
}
}
function add_audio() {
var sound = "./include/sounds/" + $("#tabs-sound-modal #sound_id").val();
$(".actions-sound-modal").append(
"<audio id='id_sound_event' src='" +
sound +
"' autoplay='true' hidden='true' loop='false'>"
);
}
function remove_audio() {
$(".actions-sound-modal audio").remove();
}
function listen_event_sound(settings) {
progressTimeBar(
"progressbar_time",
$("#interval").val(),
"infinite",
function() {
// Search events.
check_event_sound(settings);
}
);
}
function check_event_sound(settings) {
jQuery.post(
"./ajax.php",
{
page: "include/ajax/events",
get_events_fired: 1,
filter_id: $("#tabs-sound-modal #filter_id").val(),
interval: $("#tabs-sound-modal #interval").val(),
time_sound: $("#tabs-sound-modal #time_sound").val()
},
function(data) {
if (data != false) {
// Hide empty.
$("#tabs-sound-modal .empty-discovered-alerts").addClass(
"invisible_important"
);
// Change img button.
$("#button-no-alerts")
.removeClass("alerts")
.addClass("silence-alerts");
// Change value button.
$("#button-no-alerts").val(settings.silenceAlarm);
// Background button.
$(".container-button-alert").addClass("fired");
// Remove audio.
remove_audio();
// Apend audio.
add_audio();
// Add elements.
data.forEach(function(element) {
var li = document.createElement("li");
li.insertAdjacentHTML(
"beforeend",
'<div class="li-priority">' + element.priority + "</div>"
);
li.insertAdjacentHTML(
"beforeend",
'<div class="li-type">' + element.type + "</div>"
);
li.insertAdjacentHTML(
"beforeend",
'<div class="li-title">' + element.message + "</div>"
);
li.insertAdjacentHTML(
"beforeend",
'<div class="li-time">' + element.timestamp + "</div>"
);
$("#tabs-sound-modal .elements-discovered-alerts ul").append(li);
});
// -100 delay sound.
setTimeout(
remove_audio,
parseInt($("#tabs-sound-modal #time_sound").val()) * 1000 - 100
);
}
},
"json"
);
}

View File

@ -615,6 +615,10 @@ class EventsListWidget extends Widget
$fields = $default_fields;
}
if (empty($filter['search']) === false || empty($filter['user_comment']) === false) {
$fields[] = 'user_comment';
}
// Get column names.
$column_names = events_get_column_names($fields, true);

View File

@ -146,7 +146,7 @@ class Event extends Entity
* @param boolean $return_sql Return sql or execute it.
* @param string $having Having.
*
* @return array|string|false Found events or SQL query or error.
* @return array Found events or SQL query or error.
* @throws \Exception On error.
*/
public static function search(
@ -160,7 +160,7 @@ class Event extends Entity
bool $return_sql=false,
string $having=''
):array {
return \events_get_all(
$result = \events_get_all(
$fields,
$filter,
$offset,
@ -171,6 +171,13 @@ class Event extends Entity
$return_sql,
$having
);
// Always return an array.
if (empty($result) === true) {
$result = [];
}
return $result;
}

View File

@ -159,10 +159,26 @@
fill: #cccccc;
}
.notinit_10,
.notinit_9,
.notinit_8,
.notinit {
fill: #4a83f3;
}
.notinit_7,
.notinit_6,
.notinit_5,
.notinit_4 {
fill: #6695f5;
}
.notinit_3,
.notinit_2,
.notinit_1 {
fill: #79a3f6;
}
.hover {
cursor: pointer;
}

View File

@ -5614,12 +5614,12 @@ div#bullets_modules div {
}
.agent_details_col_left {
width: 40%;
min-width: 300px;
width: 49%;
min-width: 450px;
}
.agent_details_col_right {
width: 59%;
min-width: 480px;
width: 49%;
min-width: 450px;
}
.agent_access_rate_events {
@ -5630,14 +5630,15 @@ div#bullets_modules div {
}
.white_table_graph#table_access_rate {
flex: 1 1 auto;
min-width: 450px;
margin-right: 1%;
margin-left: 1px;
margin-right: 1px;
width: 49%;
}
.white_table_graph#table_events {
flex: 1 1 auto;
min-width: 450px;
margin-left: 1px;
margin-right: 1px;
width: 49%;
}
@media screen and (max-width: 1150px) {
@ -5676,7 +5677,7 @@ div#status_pie {
justify-content: flex-end;
align-items: center;
border-bottom: 1px solid #e2e2e2;
padding: 6px 20px;
padding: 8px 20px;
}
.agent_details_content {

View File

@ -0,0 +1,300 @@
/*
* Css Modal Sound events.
*/
#modal-sound {
display: flex;
flex-direction: column;
justify-content: space-between;
padding: 0px 20px !important;
}
#tabs-sound-modal {
margin-top: 20px;
}
.actions-sound-modal {
margin-bottom: 20px;
}
#tabs-sound-modal h3.console-configuration {
color: #000000;
font-size: 16px;
line-height: 19px;
text-align: left;
text-transform: none;
margin: 0px;
}
#tabs-sound-modal ul.tabs-sound-modal-options {
display: flex;
justify-content: flex-end;
background-color: transparent;
border: 0px;
border-bottom: 1px solid #eaeaea;
height: 45px;
}
#tabs-sound-modal ul.tabs-sound-modal-options li {
margin: 0px;
padding: 0px;
border: 0px;
background: transparent;
}
#tabs-sound-modal ul.tabs-sound-modal-options li.ui-tabs-active {
border-bottom: 2px solid #82b92e;
}
#tabs-sound-modal ul.wizard li label {
color: #95a3bf;
font-size: 13px;
line-height: 16px;
text-align: left;
}
#tabs-sound-modal ul.wizard li.interval-sounds,
#tabs-sound-modal ul.wizard li.test-sounds {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
margin-top: 18px;
}
#tabs-sound-modal ul.wizard li.interval-sounds label,
#tabs-sound-modal ul.wizard li.test-sounds label {
flex: 0;
width: inherit;
position: absolute;
top: -12px;
left: 50%;
}
#tabs-sound-modal ul.wizard li.interval-sounds label:first-of-type,
#tabs-sound-modal ul.wizard li.test-sounds label:first-of-type {
left: 0;
}
#tabs-sound-modal ul.wizard li.interval-sounds .select2 {
width: 48% !important;
max-width: 100% !important;
}
#tabs-sound-modal ul.wizard li.test-sounds .select2 {
width: 70% !important;
max-width: 100% !important;
}
#tabs-sound-modal ul.wizard li.test-sounds input[type="button"] {
border: 1px solid #dddddd;
border-radius: 4px;
width: 131px;
height: 38px;
color: #95a3bf;
font-size: 14px;
padding: 0px;
padding-right: 40px;
}
#tabs-sound-modal button.upd,
input.upd {
background-image: url(../../images/sound_wave.png);
background-position: 90px 8px;
}
#tabs-sound-modal ul.wizard .select2 {
max-width: 100% !important;
}
#tabs-sound-modal .select2-selection {
border: 0px;
border-radius: 0px;
border-bottom: 1px solid #aaa;
}
#tabs-sound-modal .select2-container,
#tabs-sound-modal .select2-selection__rendered {
padding-left: 0px;
color: #555555;
font-size: 15px;
line-height: 25px;
text-align: left;
}
#tabs-sound-modal div h3.title-discovered-alerts {
margin: 0px;
color: #000000;
font-size: 16px;
line-height: 19px;
text-align: left;
text-transform: none;
margin-bottom: 10px;
}
#tabs-sound-modal div span.text-discovered-alerts {
color: #95a3bf;
font-size: 13px;
line-height: 16px;
text-align: center;
}
#tabs-sound-modal div .empty-discovered-alerts {
display: flex;
flex-direction: column;
justify-content: space-evenly;
align-items: center;
height: 250px;
}
#tabs-sound-modal div .elements-discovered-alerts {
overflow: auto;
max-height: 300px;
}
#tabs-sound-modal div .elements-discovered-alerts ul {
width: 99%;
}
#tabs-sound-modal div .elements-discovered-alerts ul li {
border: 1px solid #eaeaea;
height: 46px;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
width: 100%;
color: #555555;
font-size: 12px;
line-height: 20px;
text-align: left;
}
#tabs-sound-modal div .elements-discovered-alerts ul li div.li-priority {
flex: 0;
padding: 10px;
}
#tabs-sound-modal
div
.elements-discovered-alerts
ul
li
div.li-priority
.mini-criticity {
border-radius: 5px;
width: 6px;
height: 30px;
}
#tabs-sound-modal div .elements-discovered-alerts ul li div.li-type {
flex: 0;
padding-right: 10px;
}
#tabs-sound-modal div .elements-discovered-alerts ul li div.li-time {
flex: 0 1 100px;
text-align: end;
padding-right: 10px;
}
#tabs-sound-modal div .elements-discovered-alerts ul li div.li-title {
width: 100%;
}
.actions-sound-modal .buttons-sound-modal {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
}
.actions-sound-modal .buttons-sound-modal input[type="button"] {
border: 1px solid #dddddd;
border-radius: 4px;
width: 107px;
height: 50px;
font-size: 18px;
line-height: 24px;
text-align: left;
}
.actions-sound-modal .buttons-sound-modal button.play,
.actions-sound-modal .buttons-sound-modal input[type="button"].play {
background: url(../../images/play-white.png), transparent;
background-repeat: no-repeat;
background-position: 70px 17px;
color: #ffffff;
padding-left: 20px;
}
.actions-sound-modal .buttons-sound-modal button.stop,
.actions-sound-modal .buttons-sound-modal input[type="button"].stop {
background: url(../../images/stop.png), transparent;
background-repeat: no-repeat;
background-position: 70px 17px;
color: #ffffff;
padding-left: 20px;
}
.actions-sound-modal .buttons-sound-modal button.alerts,
.actions-sound-modal .buttons-sound-modal input[type="button"].alerts {
width: 154px;
color: #95a3bf;
background: url(../../images/alarm-off.png), transparent;
background-repeat: no-repeat;
background-position: 108px 9px;
padding-left: 20px;
}
.actions-sound-modal .buttons-sound-modal button.silence-alerts,
.actions-sound-modal .buttons-sound-modal input[type="button"].silence-alerts {
width: 184px;
color: #ffffff;
background: url(../../images/silence-alerts.png), transparent;
background-repeat: no-repeat;
background-position: 138px 9px;
padding-left: 20px;
}
.actions-sound-modal .container-button-play {
background: radial-gradient(118.26% 33.15%, #82b92e 0%, #1d4e4a 100%);
border-radius: 4px;
}
.actions-sound-modal .container-button-alert.fired {
background: #ee2132;
border-radius: 4px;
}
.actions-sound-modal .progressbar {
width: 100%;
margin: 4px 2px;
border-radius: 4px;
}
.actions-sound-modal .progressbar .inner {
height: 10px;
border-radius: 4px;
animation: progressbar-countdown;
/* Placeholder, this will be updated using javascript */
animation-duration: 40s;
/* We stop in the end */
animation-iteration-count: 1;
/* Stay on pause when the animation is finished finished */
animation-fill-mode: forwards;
/* We start paused, we start the animation using javascript */
animation-play-state: paused;
/* We want a linear animation, ease-out is standard */
animation-timing-function: linear;
}
@keyframes progressbar-countdown {
0% {
width: 100%;
background: #82b92e;
}
100% {
width: 0%;
background: #e63c52;
}
}

View File

@ -129,7 +129,7 @@
<div style='height: 10px'>
<?php
$version = '7.0NG.763';
$build = '220704';
$build = '220714';
$banner = "v$version Build $build";
error_reporting(0);

View File

@ -74,9 +74,7 @@ if (! check_acl_one_of_groups($config['id_user'], $all_groups, 'AR')
return;
}
$alive_animation = agents_get_status_animation(
agents_get_interval_status($agent, false)
);
$alive_animation = agents_get_starmap($id_agente, 200, 50);
/*
* START: TABLE AGENT BUILD.
@ -170,10 +168,10 @@ $status_img = agents_detail_view_status_img(
$table_agent_header .= '<div class="icono_right">'.$status_img.'</div>';
// Fixed width non interactive charts.
$status_chart_width = 180;
$graph_width = 180;
$status_chart_width = 150;
$graph_width = 150;
$table_agent_graph = '<div id="status_pie" style="width: '.$status_chart_width.'px;">';
$table_agent_graph = '<div id="status_pie" style="width: '.$graph_width.'px;">';
$table_agent_graph .= graph_agent_status(
$id_agente,
$graph_width,
@ -604,6 +602,7 @@ if ($config['agentaccess'] && $access_agent > 0) {
$table_access_rate .= graphic_agentaccess(
$id_agente,
SECONDS_1DAY,
true,
true
);
$table_access_rate .= '</div>';

View File

@ -284,7 +284,6 @@ if (is_ajax() === true) {
'te.event_type',
'te.id_alert_am',
'te.criticity',
'te.user_comment',
'te.tags',
'te.source',
'te.id_extra',
@ -301,6 +300,13 @@ if (is_ajax() === true) {
'ta.direccion',
];
if (strpos($config['event_fields'], 'user_comment') !== false
|| empty($user_comment) === false
|| empty($search) === false
) {
$fields[] = 'te.user_comment';
}
$order = get_datatable_order(true);
if (is_array($order) === true && $order['field'] === 'mini_severity') {
@ -388,14 +394,23 @@ if (is_ajax() === true) {
$tmp->meta = is_metaconsole();
// phpcs:disable Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps
$server_url = '';
$hashdata = '';
if ($tmp->meta === true) {
if ($tmp->server_name !== null) {
$data_server = metaconsole_get_servers(
$tmp->server_id
);
$tmp->server_url_hash = metaconsole_get_servers_url_hash(
$data_server
);
// Url to go to node from meta.
if (isset($data_server) === true
&& $data_server !== false
) {
$server_url = $data_server['server_url'];
$hashdata = metaconsole_get_servers_url_hash(
$data_server
);
}
}
}
@ -888,19 +903,6 @@ if (is_ajax() === true) {
$tmp->m .= 'class="candeleted chk_val">';
// Url to go to node from meta.
$server_url = '';
$hashdata = '';
if ($tmp->meta === true) {
if (isset($data_server) === true
&& $data_server !== false
&& isset($tmp->server_url_hash) === true
) {
$server_url = $data_server['server_url'];
$hashdata = $tmp->server_url_hash;
}
}
// Url to agent view.
$url_link = ui_get_full_url(
'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='

View File

@ -342,7 +342,8 @@ var test_sound = false;
function test_sound_button() {
if (!test_sound) {
$("#button_try").attr('src', '../../images/icono_test.png');
$('body').append("<audio src='../../include/sounds/Star_Trek_emergency_simulation.wav' autoplay='true' hidden='true' loop='false'>");
var sound = '../../include/sounds/' + $('#sound_id').val();
$('body').append("<audio src='"+sound+"' autoplay='true' hidden='true' loop='false'>");
test_sound = true;
} else {
$("#button_try").attr('src', '../../images/icono_test.png');

View File

@ -419,12 +419,34 @@ if (check_acl($config['id_user'], 0, 'ER')
}
// Sound Events.
$javascript = "javascript: window.open('operation/events/sound_events.php');";
$javascript = 'javascript: openSoundEventWindow();';
// $javascript = 'javascript: openSoundEventWindow();';
// $sub[$javascript]['text'] = __('Sound Events');
// $sub[$javascript]['id'] = 'Sound Events';
// $sub[$javascript]['type'] = 'direct';
$data_sound = base64_encode(
json_encode(
[
'title' => __('Sound Console'),
'start' => __('Start'),
'stop' => __('Stop'),
'noAlert' => __('No alert'),
'silenceAlarm' => __('Silence alarm'),
'url' => ui_get_full_url('ajax.php'),
'page' => 'include/ajax/events',
]
)
);
$javascript = 'javascript: openSoundEventModal(\''.$data_sound.'\');';
$sub[$javascript]['text'] = __('Sound Events');
$sub[$javascript]['id'] = 'Sound Events';
$sub[$javascript]['id'] = 'Sound Events Modal';
$sub[$javascript]['type'] = 'direct';
echo '<div id="modal-sound" style="display:none;"></div>';
ui_require_javascript_file('pandora_events');
?>
<script type="text/javascript">
function openSoundEventWindow() {

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.763
%define release 220704
%define release 220714
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.763
%define release 220704
%define release 220714
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.763
%define release 220704
%define release 220714
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2

View File

@ -3574,6 +3574,18 @@ CREATE TABLE IF NOT EXISTS `tautoconfig` (
`order` INT NOT NULL DEFAULT 0,
`description` TEXT,
`disabled` TINYINT DEFAULT 0,
`type_execution` VARCHAR(100) NOT NULL DEFAULT 'start',
`type_periodicity` VARCHAR(100) NOT NULL DEFAULT 'weekly',
`monday` TINYINT DEFAULT 0,
`tuesday` TINYINT DEFAULT 0,
`wednesday` TINYINT DEFAULT 0,
`thursday` TINYINT DEFAULT 0,
`friday` TINYINT DEFAULT 0,
`saturday` TINYINT DEFAULT 0,
`sunday` TINYINT DEFAULT 0,
`periodically_day_from` INT UNSIGNED DEFAULT NULL,
`periodically_time_from` time NULL DEFAULT NULL,
`executed` TINYINT UNSIGNED NOT NULL DEFAULT 0,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;

View File

@ -0,0 +1,112 @@
################################################################################
# get Event
################################################################################
# Copyright (c) 2020 Artica Soluciones Tecnologicas S.L
# Jose Antonio Almendros
################################################################################
#
# usage: getEvent.exe -command "get_event.exe [event_source] [log_name] [interval] [*nodatalist] [*sendlog]"
#
################################################################################
param (
[switch]$h = $false,
[switch]$nodatalist = $false,
[switch]$sendlog = $false
)
if (($h -eq $true) -or ($($Args.Count) -le 2)){
echo "Plugin to get events from the last N minutes"
echo "Usage:"
echo "getEvent.exe [event_source] [log_name] [interval] *[-nodatalist] *[-sendlog]`n"
echo "event_source:`t`tfield Source of the Event"
echo "log_name:`t`tfield Log Name of the Event"
echo "interval:`t`ttime interval from events will be extracted (in minutes)"
echo "nodatalist [optional]:`tshows all output in same module data"
echo "sendlog [optional]:`tsends logs to log server"
echo "Artica ST @ 2020"
exit
}
$source = $args[0]
$logname = $args[1]
$interval = $args[2]
if (($nodatalist -eq $false) -and ($sendlog -eq $false))
{
$Logs = get-EventLog -Source $source -LogName $logname -After $((get-date).AddMinutes(-$interval)) | ft -HideTableHeaders
$result = foreach ($Log in $Logs)
{
if ($Log)
{
echo "<data><value><![CDATA["
echo $Log
echo "]]></value></data>"
echo "`r`n"
}
}
echo "<module>"
echo "<name>$source Events</name>"
echo "<type>async_string</type>"
echo "<datalist>"
echo $result
echo "</datalist>"
echo "<description>Logs with log name $logname in source $source</description>"
echo "</module>"
}
else
{
if ($sendlog -eq $false)
{
$Logs = get-EventLog -Source $source -LogName $logname -After $((get-date).AddMinutes(-$interval)) | ft -HideTableHeaders | Out-String
$result = foreach ($Log in $Logs)
{
echo $Log
echo "`r`n"
}
echo "<module>"
echo "<name>$source Events</name>"
echo "<type>async_string</type>"
echo "<data><![CDATA["
echo $result
echo "]]></data>"
echo "<description>Logs with log name $logname in source $source</description>"
echo "</module>"
}
}
if ($sendlog -eq $true)
{
$Logs = get-EventLog -Source $source -LogName $logname -After $((get-date).AddMinutes(-$interval)) | ft -HideTableHeaders | Out-String
$result = foreach ($Log in $Logs)
{
if ($Log)
{
echo "<![CDATA["
echo $Log
echo "]]>"
echo "`n"
}
}
echo "<log_module>"
echo "<source>$source Events</source>"
echo "<data>"
echo $result
echo "</data>"
echo "</log_module>"
}

View File

@ -0,0 +1,779 @@
#!/bin/bash
# IPSLA remote Plugin for Pandora FMS
# (c) ArticaST 2014
# Default values
COMMUNITY="public"
TAG_TABLE_CACHE="/tmp/ipsla_cache"
function help {
echo -e "Cisco IP SLA Server Plugin for Pandora FMS. http://pandorafms.com"
echo -e "Syntax:\n\n-c <community> -t <target> -v <version> [other options]\n"
echo -e "\t\t-c community"
echo -e "\t\t-t target"
echo -e "\t\t-v version"
echo -e "Other options\n";
echo -e "\t\t-s show defined tags for cisco ipsla device and exit"
echo -e "\t\t-l <auth-type> "
echo -e "\t\t-u <user> "
echo -e "\t\t-a <authentication> "
echo -e "\t\t-A <authenticacion-password> "
echo -e "\t\t-x <encryption> "
echo -e "\t\t-X <encryption-pass> "
echo -e "\t\t-g <id> "
echo -e "\t\t-m <module>\n"
echo -e "Available Modules list: \n"
echo -e "\tICPIF - Calculated Planning Impairment Factor for specified tag"
echo -e "\tMOS - Mean Opinion Score"
echo -e "\tPacket_Out_of_Sequence - Packets arriving out of sequence "
echo -e "\tPacket_Late_Arrival - Packets arriving late"
echo -e "\tAverage_Jitter - Average jitter is the estimated average jitter observed in the last XX RTP packets"
echo -e "\tPacketLossSD - Packet loss from source to destination"
echo -e "\tPacketLossDS - Packet loss from destination to source"
echo -e "\tPacketLost - The number of packets that are lost for which we cannot determine the direction "
echo -e "\tNegativesSD - The sum of number of all negative jitter values from packets sent from source to destination "
echo -e "\tNegativesDS - The sum of number of all negative jitter values from packets sent from destination to source"
echo -e "\tPositivesSD - The sum of number of all positive jitter values from packets sent from source to destination"
echo -e "\tPositivesDS - The sum of number of all positive jitter values from packets sent from source to destination"
echo -e "\tRTTMax - Max Round Trip Time"
echo -e "\tRTTMin - Min Round Trip Time"
echo -e "\tOperNumOfRTT - The number of successful round trips"
echo -e "\tOperPacketLossSD - Packet loss from source to destination for jitter tests"
echo -e "\tOperPacketLossDS - Packet loss from destination to source for jitter tests"
echo -e "\tRttOperSense - A sense code for the completion status of the latest RTT operation."
echo -e "\tRttOperCompletionTime - The completion time of the latest RTT operation successfully completed."
echo -e "\tRttOperTime - The value of the agent system time at the time of the latest RTT operation."
echo -e "\tRttOperAddress - A string which specifies the address of the target."
echo -e "\tHTTPOperRTT - Round Trip Time taken to perform HTTP operation. This value is the sum of DNSRTT, TCPConnectRTT and TransactionRTT."
echo -e "\tHTTPOperDNSRTT Round Trip Time taken to perform DNS query within the HTTP operation."
echo -e "\tHTTPOperTCPConnectRTT - Round Trip Time taken to connect to the HTTP server."
echo -e "\tIcmpJitterAvgJitter The average of positive and negative jitter values in Source-to-Destionation and Destination-to-Source direction."
echo -e "\tHTTPOperTransactionRTT - Round Trip Time taken to download the object specified by the URL."
echo -e ""
echo -e " Example execution"
echo -e " snmp version 3: ./pandora_ipsla.sh -t <ip_target> -v 3 -l authPriv -u pandorafms -a MD5 -A pandorafms -x AES -X pandorafms -g jitter -m Average_Jitter"
echo -e " snmp version 2c: ./pandora_ipsla.sh -t <ip_target> -v 2c -c public -g jitter -m Average_Jitter"
echo ""
exit
}
function show_tags {
local TAG_TABLE_CACHE=$TAG_TABLE_CACHE.$TARGET
if [ $version != "3" ]
then
snmpwalk -v 1 -Onq -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.1.1.3 > $TAG_TABLE_CACHE
fi
if [ $version == "3" ]
#if snmp v3 snmpget with v3
then
if [ $auth == "authPriv" ]
# if authpriv snmpget with all parameters
then
snmpwalk -v 3 -Onq -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass $TARGET 1.3.6.1.4.1.9.9.42.1.2.1.1.3 > $TAG_TABLE_CACHE
fi
if [ $auth == "authNoPriv" ]
then
snmpget -v 3 -Onq -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.1.1.3 > $TAG_TABLE_CACHE
fi
fi
cat $TAG_TABLE_CACHE
exit
}
function update_tags {
local TAG_TABLE_CACHE=$TAG_TABLE_CACHE.$TARGET
if [ $version != "3" ]
then
snmpwalk -v 1 -Onq -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.1.1.3 > $TAG_TABLE_CACHE
fi
if [ $version == "3" ]
#if snmp v3 snmpget with v3
then
if [ $auth == "authPriv" ]
# if authpriv snmpget with all parameters
then
snmpwalk -v 3 -Onq -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass $TARGET 1.3.6.1.4.1.9.9.42.1.2.1.1.3 > $TAG_TABLE_CACHE
fi
if [ $auth == "authNoPriv" ]
then
snmpget -v 3 -Onq -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.1.1.3 > $TAG_TABLE_CACHE
fi
fi
}
function get_index {
cat $TAG_TABLE_CACHE.$TARGET | grep "\"$1\"" | grep -o "[0-9]*\s"
}
# This function requires two arguments. MODULE_TYPE TAG
function get_module {
MODULE_TYPE=$1
update_tags
INDICE=$2
if [ $version != "3" ]
then
if [ "$MODULE_TYPE" == "ICPIF" ]
then
VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.43.$INDICE`
fi
if [ "$MODULE_TYPE" == "MOS" ]
then
VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.42.$INDICE`
fi
if [ "$MODULE_TYPE" == "Packet_Out_of_Sequence" ]
then
VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.28.$INDICE`
fi
if [ "$MODULE_TYPE" == "Packet_Late_Arrival" ]
then
VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.30.$INDICE`
fi
if [ "$MODULE_TYPE" == "Average_Jitter" ]
then
VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.46.$INDICE`
fi
if [ "$MODULE_TYPE" == "PacketLossSD" ]
then
VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.26.$INDICE`
fi
if [ "$MODULE_TYPE" == "PacketLossDS" ]
then
VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.27.$INDICE`
fi
if [ "$MODULE_TYPE" == "PacketLost" ]
then
VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.29.$INDICE`
fi
if [ "$MODULE_TYPE" == "NegativesSD" ]
then
VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.12.$INDICE`
fi
if [ "$MODULE_TYPE" == "NegativesDS" ]
then
VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.22.$INDICE`
fi
if [ "$MODULE_TYPE" == "PositivesSD" ]
then
VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.7.$INDICE`
fi
if [ "$MODULE_TYPE" == "PositivesDS" ]
then
VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.17.$INDICE`
fi
if [ "$MODULE_TYPE" == "RTTMax" ]
then
VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.5.$INDICE`
fi
if [ "$MODULE_TYPE" == "RTTMin" ]
then
VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.4.$INDICE`
fi
if [ "$MODULE_TYPE" == "OperNumOfRTT" ]
then
VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.1.$INDICE`
fi
if [ "$MODULE_TYPE" == "OperPacketLossSD" ]
then
VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.26.$INDICE`
fi
if [ "$MODULE_TYPE" == "OperPacketLossDS" ]
then
VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.27.$INDICE`
fi
if [ "$MODULE_TYPE" == "RttOperCompletionTime" ]
then
VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.10.1.1.$INDICE`
fi
if [ "$MODULE_TYPE" == "RttOperSense" ]
then
VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.10.1.2.$INDICE`
fi
if [ "$MODULE_TYPE" == "RttOperTime" ]
then
VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.10.1.5.$INDICE`
fi
if [ "$MODULE_TYPE" == "RttOperAddress" ]
then
VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.10.1.6.$INDICE`
fi
if [ "$MODULE_TYPE" == "HTTPOperRTT" ]
then
VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.1.1.1.$INDICE`
fi
if [ "$MODULE_TYPE" == "HTTPOperDNSRTT" ]
then
VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.1.1.2.$INDICE`
fi
if [ "$MODULE_TYPE" == "HTTPOperTCPConnectRTT" ]
then
VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.1.1.3.$INDICE`
fi
if [ "$MODULE_TYPE" == "IcmpJitterAvgJitter" ]
then
VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.4.1.44.$INDICE`
fi
if [ "$MODULE_TYPE" == "HTTPOperTransactionRTT" ]
then
VALOR=`snmpget -v $version -Oqv -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.1.1.4.$INDICE`
fi
fi
if [ $version == "3" ]
#if snmp v3 snmpget with v3
then
if [ $auth == "authPriv" ]
# if authpriv snmpget with all parameters
then
if [ "$MODULE_TYPE" == "ICPIF" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.43.$INDICE`
fi
if [ "$MODULE_TYPE" == "MOS" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.42.$INDICE`
fi
if [ "$MODULE_TYPE" == "Packet_Out_of_Sequence" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.28.$INDICE`
fi
if [ "$MODULE_TYPE" == "Packet_Late_Arrival" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.30.$INDICE`
fi
if [ "$MODULE_TYPE" == "Average_Jitter" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.46.$INDICE`
fi
if [ "$MODULE_TYPE" == "PacketLossSD" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.26.$INDICE`
fi
if [ "$MODULE_TYPE" == "PacketLossDS" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.27.$INDICE`
fi
if [ "$MODULE_TYPE" == "PacketLost" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.29.$INDICE`
fi
if [ "$MODULE_TYPE" == "NegativesSD" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.12.$INDICE`
fi
if [ "$MODULE_TYPE" == "NegativesDS" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.22.$INDICE`
fi
if [ "$MODULE_TYPE" == "PositivesSD" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.7.$INDICE`
fi
if [ "$MODULE_TYPE" == "PositivesDS" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.17.$INDICE`
fi
if [ "$MODULE_TYPE" == "RTTMax" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.5.$INDICE`
fi
if [ "$MODULE_TYPE" == "RTTMin" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.4.$INDICE`
fi
if [ "$MODULE_TYPE" == "OperNumOfRTT" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.1.$INDICE`
fi
if [ "$MODULE_TYPE" == "OperPacketLossSD" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.26.$INDICE`
fi
if [ "$MODULE_TYPE" == "OperPacketLossDS" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.27.$INDICE`
fi
if [ "$MODULE_TYPE" == "RttOperCompletionTime" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.10.1.1.$INDICE`
fi
if [ "$MODULE_TYPE" == "RttOperSense" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.10.1.2.$INDICE`
fi
if [ "$MODULE_TYPE" == "RttOperTime" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.10.1.5.$INDICE`
fi
if [ "$MODULE_TYPE" == "RttOperAddress" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.10.1.6.$INDICE`
fi
if [ "$MODULE_TYPE" == "HTTPOperRTT" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.1.1.1.$INDICE`
fi
if [ "$MODULE_TYPE" == "HTTPOperDNSRTT" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.1.1.2.$INDICE`
fi
if [ "$MODULE_TYPE" == "HTTPOperTCPConnectRTT" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.1.1.3.$INDICE`
fi
if [ "$MODULE_TYPE" == "IcmpJitterAvgJitter" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.4.1.44.$INDICE`
fi
if [ "$MODULE_TYPE" == "HTTPOperTransactionRTT" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -x $hash2 -X $hash2pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.1.1.4.$INDICE`
fi
fi
if [ $auth == "authNoPriv" ]
then
if [ "$hash1" ]
then
if [ "$MODULE_TYPE" == "ICPIF" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.43.$INDICE`
fi
if [ "$MODULE_TYPE" == "MOS" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.42.$INDICE`
fi
if [ "$MODULE_TYPE" == "Packet_Out_of_Sequence" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.28.$INDICE`
fi
if [ "$MODULE_TYPE" == "Packet_Late_Arrival" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.30.$INDICE`
fi
if [ "$MODULE_TYPE" == "Average_Jitter" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.46.$INDICE`
fi
if [ "$MODULE_TYPE" == "PacketLossSD" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.26.$INDICE`
fi
if [ "$MODULE_TYPE" == "PacketLossDS" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.27.$INDICE`
fi
if [ "$MODULE_TYPE" == "PacketLost" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.29.$INDICE`
fi
if [ "$MODULE_TYPE" == "NegativesSD" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.12.$INDICE`
fi
if [ "$MODULE_TYPE" == "NegativesDS" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.22.$INDICE`
fi
if [ "$MODULE_TYPE" == "PositivesSD" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.7.$INDICE`
fi
if [ "$MODULE_TYPE" == "PositivesDS" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.17.$INDICE`
fi
if [ "$MODULE_TYPE" == "RTTMax" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.5.$INDICE`
fi
if [ "$MODULE_TYPE" == "RTTMin" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.4.$INDICE`
fi
if [ "$MODULE_TYPE" == "OperNumOfRTT" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.1.$INDICE`
fi
if [ "$MODULE_TYPE" == "OperPacketLossSD" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.26.$INDICE`
fi
if [ "$MODULE_TYPE" == "OperPacketLossDS" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.27.$INDICE`
fi
if [ "$MODULE_TYPE" == "RttOperCompletionTime" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.10.1.1.$INDICE`
fi
if [ "$MODULE_TYPE" == "RttOperSense" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.10.1.2.$INDICE`
fi
if [ "$MODULE_TYPE" == "RttOperTime" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.10.1.5.$INDICE`
fi
if [ "$MODULE_TYPE" == "RttOperAddress" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.10.1.6.$INDICE`
fi
if [ "$MODULE_TYPE" == "HTTPOperRTT" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.1.1.1.$INDICE`
fi
if [ "$MODULE_TYPE" == "HTTPOperDNSRTT" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.1.1.2.$INDICE`
fi
if [ "$MODULE_TYPE" == "HTTPOperTCPConnectRTT" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.1.1.3.$INDICE`
fi
if [ "$MODULE_TYPE" == "IcmpJitterAvgJitter" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.4.1.44.$INDICE`
fi
if [ "$MODULE_TYPE" == "HTTPOperTransactionRTT" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -a $hash1 -A $hash1pass -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.1.1.4.$INDICE`
fi
else
if [ "$MODULE_TYPE" == "ICPIF" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.43.$INDICE`
fi
if [ "$MODULE_TYPE" == "MOS" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.42.$INDICE`
fi
if [ "$MODULE_TYPE" == "Packet_Out_of_Sequence" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.28.$INDICE`
fi
if [ "$MODULE_TYPE" == "Packet_Late_Arrival" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.30.$INDICE`
fi
if [ "$MODULE_TYPE" == "Average_Jitter" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.46.$INDICE`
fi
if [ "$MODULE_TYPE" == "PacketLossSD" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.26.$INDICE`
fi
if [ "$MODULE_TYPE" == "PacketLossDS" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.27.$INDICE`
fi
if [ "$MODULE_TYPE" == "PacketLost" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.29.$INDICE`
fi
if [ "$MODULE_TYPE" == "NegativesSD" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.12.$INDICE`
fi
if [ "$MODULE_TYPE" == "NegativesDS" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.22.$INDICE`
fi
if [ "$MODULE_TYPE" == "PositivesSD" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.7.$INDICE`
fi
if [ "$MODULE_TYPE" == "PositivesDS" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.17.$INDICE`
fi
if [ "$MODULE_TYPE" == "RTTMax" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.5.$INDICE`
fi
if [ "$MODULE_TYPE" == "RTTMin" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.4.$INDICE`
fi
if [ "$MODULE_TYPE" == "OperNumOfRTT" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.1.$INDICE`
fi
if [ "$MODULE_TYPE" == "OperPacketLossSD" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.26.$INDICE`
fi
if [ "$MODULE_TYPE" == "OperPacketLossDS" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.2.1.27.$INDICE`
fi
if [ "$MODULE_TYPE" == "RttOperCompletionTime" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.10.1.1.$INDICE`
fi
if [ "$MODULE_TYPE" == "RttOperSense" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.10.1.2.$INDICE`
fi
if [ "$MODULE_TYPE" == "RttOperTime" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.10.1.5.$INDICE`
fi
if [ "$MODULE_TYPE" == "RttOperAddress" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.2.10.1.6.$INDICE`
fi
if [ "$MODULE_TYPE" == "HTTPOperRTT" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.1.1.1.$INDICE`
fi
if [ "$MODULE_TYPE" == "HTTPOperDNSRTT" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.1.1.2.$INDICE`
fi
if [ "$MODULE_TYPE" == "HTTPOperTCPConnectRTT" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.1.1.3.$INDICE`
fi
if [ "$MODULE_TYPE" == "IcmpJitterAvgJitter" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.4.1.44.$INDICE`
fi
if [ "$MODULE_TYPE" == "HTTPOperTransactionRTT" ]
then
VALOR=`snmpget -v 3 -l $auth -u $user -c $COMMUNITY $TARGET 1.3.6.1.4.1.9.9.42.1.5.1.1.4.$INDICE`
fi
fi
fi
fi
echo -n $VALOR | awk '{print $NF}'
exit 0
}
if [ -z "`which snmpwalk`" ]
then
echo "ERROR: snmpwalk is not in the path. Exiting..."
exit -1
fi
if [ $# -eq 0 ]
then
help
fi
# Main parsing code
while getopts ":hc:t:v:l:u:a:A:x:X:sm:g:" optname
do
case "$optname" in
"h")
help
;;
"c")
COMMUNITY=$OPTARG
;;
"t")
TARGET=$OPTARG
;;
"v")
version=$OPTARG
;;
"l")
auth=$OPTARG
;;
"u")
user=$OPTARG
;;
"a")
hash1=$OPTARG
;;
"A")
hash1pass=$OPTARG
;;
"x")
hash2=$OPTARG
;;
"X")
hash2pass=$OPTARG
;;
"g")
TAG=$OPTARG
;;
"s")
SHOWTAGS=1
;;
"m")
MODULE=$OPTARG
;;
?)
help
;;
default)
help
;;
esac
done
# Execution
[ "$SHOWTAGS" ] && echo "Showing avaliables ipsla tags for the device $TARGET and OID 1.3.6.1.4.1.9.9.42.1.2.1.1.3" && show_tags
[ -z "$TARGET" ] && echo "Error missing target ip definition please use -t to difine it or -h to see help" && exit 1
[ -z "$MODULE" ] && echo "Error missing module definition please use -m to difine it or -h to see help" && exit 1
[ -z "$TAG" ] && echo "Error missing id definition please use -g to difine it or -h to see help" && exit 1
[ -z "$version" ] && echo "Error missing snmp version definition please use -v to difine it or -h to see help" && exit 1
get_module $MODULE $TAG
echo "DEBUG"
exit 0
#RttOperSense
# 0:other
# 1:ok
# 2:disconnected
# 3:overThreshold
# 4:timeout
# 5:busy
# 6:notConnected
# 7:dropped
# 8:sequenceError
# 9:verifyError
# 10:applicationSpecific
# 11:dnsServerTimeout
# 12:tcpConnectTimeout
# 13:httpTransactionTimeout
# 14:dnsQueryError
# 15:httpError
# 16:error
# 17:mplsLspEchoTxError
# 18:mplsLspUnreachable
# 19:mplsLspMalformedReq
# 20:mplsLspReachButNotFEC
# 21:enableOk
# 22:enableNoConnect
# 23:enableVersionFail
# 24:enableInternalError
# 25:enableAbort
# 26:enableFail
# 27:enableAuthFail
# 28:enableFormatError
# 29:enablePortInUse
# 30:statsRetrieveOk
# 31:statsRetrieveNoConnect
# 32:statsRetrieveVersionFail
# 33:statsRetrieveInternalError
# 34:statsRetrieveAbort
# 35:statsRetrieveFail
# 36:statsRetrieveAuthFail
# 37:statsRetrieveFormatError
# 38:statsRetrievePortInUse

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 7.0NG.763-220704
Version: 7.0NG.763-220714
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.763-220704"
pandora_version="7.0NG.763-220714"
package_cpan=0
package_pandora=1

View File

@ -139,9 +139,12 @@ sub pandora_startup () {
# Start the policy queue thread.
start_server_thread(\&pandora_process_policy_queue, [\%Config]) if ($Config{'__enterprise_enabled'} == 1 && $Config{'policy_manager'} == 1);
# Start agent autoconfiguration thread.
start_server_thread(\&pandora_agent_autoconfiguration_scheduled, [\%Config]) if ($Config{'__enterprise_enabled'} == 1 && $Config{'autoconfigure_agents'} == 1);
pandora_audit (\%Config, $Config{'rb_product_name'} . ' Server Daemon starting', 'SYSTEM', 'System', $DBH);
# Load servers
if (!is_metaconsole(\%Config)) {
pandora_reset_server (\%Config, $DBH);
@ -308,6 +311,67 @@ sub pandora_stop_netflow_daemon () {
return 0;
}
sub pandora_agent_autoconfiguration_scheduled($) {
my $pa_config = shift;
my %pa_config = %{$pa_config};
my $dbh = db_connect ($pa_config{'dbengine'}, $pa_config{'dbname'}, $pa_config{'dbhost'}, $pa_config{'dbport'},
$pa_config{'dbuser'}, $pa_config{'dbpass'});
while ($THRRUN == 1) {
eval {{
local $SIG{__DIE__};
my @autoconfig = get_db_rows (
$dbh,
'SELECT *, DATE_FORMAT(DATE_ADD(periodically_time_from, INTERVAL ' . $pa_config->{'autoconfigure_agents_threshold'} . ' SECOND), "%H:%i:%S") AS time_minutes
FROM tautoconfig WHERE executed = 0 AND type_execution LIKE "scheduled" AND disabled = 0'
);
# Get current time.
my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime(time());
my $time = sprintf ("%.2d:%.2d:%.2d", $hour, $min, $sec);
foreach my $conf (@autoconfig) {
if (($conf->{'type_periodicity'} eq 'daily') ||
($conf->{'type_periodicity'} eq 'monthly' && $conf->{'periodically_day_from'} eq $mday) ||
($conf->{'type_periodicity'} eq 'weekly' && (($conf->{'sunday'} eq 1 && $wday eq 0) ||
($conf->{'monday'} eq 1 && $wday eq 1) || ($conf->{'tuesday'} eq 1 && $wday eq 2) ||
($conf->{'wednesday'} eq 1 && $wday eq 3) || ($conf->{'thursday'} eq 1 && $wday eq 4) ||
($conf->{'friday'} eq 1 && $wday eq 5) || ($conf->{'saturday'} eq 1 && $wday eq 6)))
) {
if ($time ge $conf->{'periodically_time_from'} && $time le $conf->{'time_minutes'}) {
# Update executed.
db_process_update ($dbh, 'tautoconfig', {'executed' => 1}, {'id' => $conf->{'id'}});
# Get agents.
my @agents = get_db_rows(
$dbh,
'SELECT id_agente, alias, id_grupo, id_os, os_version, direccion, nombre AS agent_name FROM tagente
WHERE `disabled` = 0'
);
foreach my $agent (@agents) {
# Check if the agent matches the rules.
my $match = enterprise_hook('autoconf_evaluate_rules', [$pa_config, $dbh, $agent, $conf->{'id'}, $agent->{'id_agente'}, 1]);
if (defined($match) && $match > 0) {
enterprise_hook('autoconf_execute_actions', [$pa_config, $dbh, $agent->{'id_agente'}, $agent, $conf->{'id'}]);
}
}
# Update executed.
db_process_update ($dbh, 'tautoconfig', {'executed' => 0}, {'id' => $conf->{'id'}});
}
}
}
}};
sleep ($pa_config->{'autoconfigure_agents_threshold'});
}
db_disconnect($dbh);
}
########################################################################################
# Additional tasks executed periodically by the Pandora FMS Server
########################################################################################

View File

@ -46,7 +46,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.763";
my $pandora_build = "220704";
my $pandora_build = "220714";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash
@ -539,6 +539,7 @@ sub pandora_load_config {
$pa_config->{"provisioning_cache_interval"} = 300; # 7.0 720
$pa_config->{"autoconfigure_agents"} = 1; # 7.0 725
$pa_config->{"autoconfigure_agents_threshold"} = 300; #7.0 764
$pa_config->{'snmp_extlog'} = ""; # 7.0 726
@ -1265,6 +1266,9 @@ sub pandora_load_config {
elsif ($parametro =~ m/^autoconfigure_agents\s+([0-1])/i){
$pa_config->{'autoconfigure_agents'}= clean_blank($1);
}
elsif ($parametro =~ m/^autoconfigure_agents_threshold\s+([0-1])/i){
$pa_config->{'autoconfigure_agents_threshold'}= clean_blank($1);
}
elsif ($parametro =~ m/^snmp_extlog\s(.*)/i) {
$pa_config->{'snmp_extlog'} = clean_blank($1);
}

View File

@ -5788,30 +5788,18 @@ sub pandora_self_monitoring ($$) {
}
my $queued_modules = get_db_value ($dbh, "SELECT SUM(queued_modules) FROM tserver WHERE BINARY name = '".$pa_config->{"servername"}."'");
if (!defined($queued_modules)) {
$queued_modules = 0;
}
my $dbmaintance;
if ($RDBMS eq 'postgresql') {
$dbmaintance = get_db_value ($dbh,
"SELECT COUNT(*)
FROM tconfig
WHERE token = 'db_maintance'
AND NULLIF(value, '')::int > UNIX_TIMESTAMP() - 86400");
}
elsif ($RDBMS eq 'oracle') {
$dbmaintance = get_db_value ($dbh,
"SELECT COUNT(*)
FROM tconfig
WHERE token = 'db_maintance' AND DBMS_LOB.substr(value, 100, 1) > UNIX_TIMESTAMP() - 86400");
}
else {
$dbmaintance = get_db_value ($dbh,
"SELECT COUNT(*)
FROM tconfig
WHERE token = 'db_maintance' AND value > UNIX_TIMESTAMP() - 86400");
my $pandoradb = 0;
my $pandoradb_tstamp = get_db_value ($dbh, "SELECT `value` FROM tconfig WHERE token = 'db_maintance'");
if (!defined($pandoradb_tstamp) || $pandoradb_tstamp == 0) {
pandora_event ($pa_config, "Pandora DB maintenance tool has never been run.", 0, 0, 4, 0, 0, 'system', 0, $dbh);
} elsif ($pandoradb_tstamp < time() - 86400) {
pandora_event ($pa_config, "Pandora DB maintenance tool has not been run since " . strftime("%Y-%m-%d %H:%M:%S", localtime($pandoradb_tstamp)) . ".", 0, 0, 4, 0, 0, 'system', 0, $dbh);
} else {
$pandoradb = 1;
}
my $start_performance = time;
@ -5825,7 +5813,7 @@ sub pandora_self_monitoring ($$) {
$xml_output .=" <module>";
$xml_output .=" <name>Database Maintenance</name>";
$xml_output .=" <type>generic_proc</type>";
$xml_output .=" <data>$dbmaintance</data>";
$xml_output .=" <data>$pandoradb</data>";
$xml_output .=" </module>";
$xml_output .=" <module>";

View File

@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.763";
my $pandora_build = "220704";
my $pandora_build = "220714";
our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] );

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0NG.763
%define release 220704
%define release 220714
Summary: Pandora FMS Server
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0NG.763
%define release 220704
%define release 220714
Summary: Pandora FMS Server
Name: %{name}

View File

@ -9,7 +9,7 @@
# **********************************************************************
PI_VERSION="7.0NG.763"
PI_BUILD="220704"
PI_BUILD="220714"
MODE=$1
if [ $# -gt 1 ]; then

View File

@ -35,7 +35,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB;
# version: define current version
my $version = "7.0NG.763 Build 220704";
my $version = "7.0NG.763 Build 220714";
# Pandora server configuration
my %conf;

View File

@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv;
# version: define current version
my $version = "7.0NG.763 Build 220704";
my $version = "7.0NG.763 Build 220714";
# save program name for logging
my $progname = basename($0);