diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control
index a0036b2d74..1a02500bd0 100644
--- a/pandora_agents/unix/DEBIAN/control
+++ b/pandora_agents/unix/DEBIAN/control
@@ -1,5 +1,5 @@
package: pandorafms-agent-unix
-Version: 7.0NG.762-220621
+Version: 7.0NG.762-220622
Architecture: all
Priority: optional
Section: admin
diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh
index 120963407c..3fac5de5e7 100644
--- a/pandora_agents/unix/DEBIAN/make_deb_package.sh
+++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh
@@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-pandora_version="7.0NG.762-220621"
+pandora_version="7.0NG.762-220622"
echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent
index 08c1d4b6eb..ef3d2faf48 100755
--- a/pandora_agents/unix/pandora_agent
+++ b/pandora_agents/unix/pandora_agent
@@ -1015,7 +1015,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.762';
-use constant AGENT_BUILD => '220621';
+use constant AGENT_BUILD => '220622';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;
diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec
index baea70960f..5d1af6a611 100644
--- a/pandora_agents/unix/pandora_agent.redhat.spec
+++ b/pandora_agents/unix/pandora_agent.redhat.spec
@@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 7.0NG.762
-%define release 220621
+%define release 220622
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}
diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec
index af0f1b3595..f011c51882 100644
--- a/pandora_agents/unix/pandora_agent.spec
+++ b/pandora_agents/unix/pandora_agent.spec
@@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 7.0NG.762
-%define release 220621
+%define release 220622
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}
diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer
index bfb6150270..bfaf8db641 100755
--- a/pandora_agents/unix/pandora_agent_installer
+++ b/pandora_agents/unix/pandora_agent_installer
@@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.762"
-PI_BUILD="220621"
+PI_BUILD="220622"
OS_NAME=`uname -s`
FORCE=0
diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi
index fef7490e41..ae2c75d8c4 100644
--- a/pandora_agents/win32/installer/pandora.mpi
+++ b/pandora_agents/win32/installer/pandora.mpi
@@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
-{220621}
+{220622}
ViewReadme
{Yes}
diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc
index ddc0746f56..2288f2e39d 100644
--- a/pandora_agents/win32/pandora.cc
+++ b/pandora_agents/win32/pandora.cc
@@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
-#define PANDORA_VERSION ("7.0NG.762 Build 220621")
+#define PANDORA_VERSION ("7.0NG.762 Build 220622")
string pandora_path;
string pandora_dir;
diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc
index bc78bf9669..16bfe37607 100644
--- a/pandora_agents/win32/versioninfo.rc
+++ b/pandora_agents/win32/versioninfo.rc
@@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
- VALUE "ProductVersion", "(7.0NG.762(Build 220621))"
+ VALUE "ProductVersion", "(7.0NG.762(Build 220622))"
VALUE "FileVersion", "1.0.0.0"
END
END
diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control
index 20416c9a6a..d21e572e52 100644
--- a/pandora_console/DEBIAN/control
+++ b/pandora_console/DEBIAN/control
@@ -1,5 +1,5 @@
package: pandorafms-console
-Version: 7.0NG.762-220621
+Version: 7.0NG.762-220622
Architecture: all
Priority: optional
Section: admin
diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh
index d76894ce29..7813227a37 100644
--- a/pandora_console/DEBIAN/make_deb_package.sh
+++ b/pandora_console/DEBIAN/make_deb_package.sh
@@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-pandora_version="7.0NG.762-220621"
+pandora_version="7.0NG.762-220622"
package_pear=0
package_pandora=1
diff --git a/pandora_console/godmode/servers/plugin.php b/pandora_console/godmode/servers/plugin.php
index fa5b9d98b4..856ab5f68f 100644
--- a/pandora_console/godmode/servers/plugin.php
+++ b/pandora_console/godmode/servers/plugin.php
@@ -337,7 +337,7 @@ if (($create != '') || ($view != '')) {
$data = [];
$data[0] = __('Name');
- $data[1] = '';
+ $data[1] = '';
$table->colspan['plugin_name'][1] = 3;
$table->data['plugin_name'] = $data;
@@ -399,7 +399,7 @@ if (($create != '') || ($view != '')) {
$data = [];
$data[0] = __('Plugin command').ui_print_help_tip(__('Specify interpreter and plugin path. The server needs permissions to run it.'), true);
- $data[1] = '';
+ $data[1] = '';
if ($locked) {
$data[1] .= html_print_image('images/lock_mc.png', true, ['class' => 'command_advanced_conf lock', 'class' => 'invert_filter']);
}
@@ -411,7 +411,7 @@ if (($create != '') || ($view != '')) {
$data = [];
$data[0] = __('Plug-in parameters');
- $data[1] = '';
+ $data[1] = '';
if ($locked) {
$data[1] .= html_print_image('images/lock_mc.png', true, ['class' => 'command_advanced_conf lock', 'class' => 'invert_filter']);
}
@@ -484,13 +484,13 @@ if (($create != '') || ($view != '')) {
$datam = [];
$datam[0] = __('Description')." ($macro_name)";
$datam[0] .= html_print_input_hidden($macro_name_name, $macro_name, true);
- $datam[1] = html_print_input_text_extended($macro_desc_name, $macro_desc_value, 'text-'.$macro_desc_name, '', 30, 255, $locked, '', "class='command_macro'", true);
+ $datam[1] = html_print_input_text_extended($macro_desc_name, $macro_desc_value, 'text-'.$macro_desc_name, '', 30, 255, $locked, '', "class='command_macro text_input'", true);
if ($locked) {
$datam[1] .= html_print_image('images/lock_mc.png', true, ['class' => 'command_macro lock', 'class' => 'invert_filter']);
}
$datam[2] = __('Default value')." ($macro_name)";
- $datam[3] = html_print_input_text_extended($macro_value_name, $macro_value_value, 'text-'.$macro_value_name, '', 30, 255, $locked, '', "class='command_component command_macro'", true);
+ $datam[3] = html_print_input_text_extended($macro_value_name, $macro_value_value, 'text-'.$macro_value_name, '', 30, 255, $locked, '', "class='command_component command_macro text_input'", true);
if ($locked) {
$datam[3] .= html_print_image('images/lock_mc.png', true, ['class' => 'command_macro lock', 'class' => 'invert_filter']);
}
diff --git a/pandora_console/godmode/setup/links.php b/pandora_console/godmode/setup/links.php
index 61781d2e57..7135936d34 100644
--- a/pandora_console/godmode/setup/links.php
+++ b/pandora_console/godmode/setup/links.php
@@ -114,11 +114,11 @@ if ((isset($_GET['form_add'])) or (isset($_GET['form_edit']))) {
echo "'>";
echo '
'.__('Link name').' |
- | ';
+ | ';
echo '
'.__('Link').' |
- | ';
+ ';
echo '
';
echo '';
echo "";
diff --git a/pandora_console/godmode/setup/news.php b/pandora_console/godmode/setup/news.php
index b340e70066..a7a22cfe67 100644
--- a/pandora_console/godmode/setup/news.php
+++ b/pandora_console/godmode/setup/news.php
@@ -181,7 +181,7 @@ if ((isset($_GET['form_add'])) || (isset($_GET['form_edit']))) {
$data = [];
$data[0] = __('Subject').'
';
- $data[0] .= '';
+ $data[0] .= '';
$data[1] = __('Group').'
';
$data[1] .= '';
diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php
index f031621c65..7cae2b21b8 100644
--- a/pandora_console/include/config_process.php
+++ b/pandora_console/include/config_process.php
@@ -20,7 +20,7 @@
/**
* Pandora build version and version
*/
-$build_version = 'PC220621';
+$build_version = 'PC220622';
$pandora_version = 'v7.0NG.762';
// Do not overwrite default timezone set if defined.
diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php
index b0a24a9084..7993ce3db6 100644
--- a/pandora_console/include/functions_events.php
+++ b/pandora_console/include/functions_events.php
@@ -14,7 +14,7 @@
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
- * Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
+ * Copyright (c) 2005-2022 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -2364,10 +2364,10 @@ function events_print_event_table(
// Get class name, for the link color, etc.
$data[$i] = "
".agents_get_alias($event['id_agente']).'';
// For System or SNMP generated alerts.
- } else if ($event['event_type'] == 'system') {
+ } else if ($event['event_type'] === 'system') {
$data[$i] = __('System');
} else {
- $data[$i] = __('Alert').'SNMP';
+ $data[$i] = '';
}
$i++;
diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php
index a02d140290..b081b7e69f 100644
--- a/pandora_console/include/functions_html.php
+++ b/pandora_console/include/functions_html.php
@@ -2690,7 +2690,9 @@ function html_print_input_password(
}
if ($class) {
- $attr['class'] = $class;
+ $attr['class'] = $class.' '.'password_input';
+ } else {
+ $attr['class'] = 'password_input';
}
if ($disabled === false) {
@@ -2761,7 +2763,9 @@ function html_print_input_text(
}
if ($class != '') {
- $attr['class'] = $class;
+ $attr['class'] = $class.' '.'text_input';
+ } else {
+ $attr['class'] = 'text_input';
}
if ($onChange != '') {
@@ -4554,7 +4558,7 @@ function html_print_autocomplete_modules(
100,
false,
'',
- ['style' => 'background: url('.$module_icon.') no-repeat right; '.$text_color.'']
+ ['style' => 'border: none; padding: 2px 5px; margin-bottom: 4px; border-bottom: 1px solid #ccc; border-radius: 0; background: url('.$module_icon.') no-repeat right; '.$text_color.'']
);
html_print_input_hidden($name.'_hidden', $id_agent_module);
diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php
index 49cfaf0f3f..57abcee37d 100755
--- a/pandora_console/include/functions_ui.php
+++ b/pandora_console/include/functions_ui.php
@@ -5900,7 +5900,7 @@ function ui_print_agent_autocomplete_input($parameters)
}
$attrs = [];
- $attrs['style'] = 'padding-right: 20px; background: url('.$icon_image.') no-repeat right; '.$text_color.'';
+ $attrs['style'] = 'padding-right: 20px; padding: 2px 5px; margin-bottom: 4px; border: none; border-bottom: 1px solid #ccc; border-radius: 0; background: url('.$icon_image.') no-repeat right; '.$text_color.'';
if (!$disabled_javascript_on_blur_function) {
$attrs['onblur'] = $javascript_on_blur_function_name.'()';
diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css
index da9d972f4a..d49361fae6 100644
--- a/pandora_console/include/styles/pandora.css
+++ b/pandora_console/include/styles/pandora.css
@@ -9054,3 +9054,21 @@ div#err_msg_centralised {
padding-top: 15px;
}
}
+
+.text_input {
+ background-color: transparent !important;
+ border: none;
+ border-radius: 0;
+ border-bottom: 1px solid #ccc;
+ margin-bottom: 4px;
+ padding: 2px 5px;
+}
+
+.password_input {
+ background-color: transparent !important;
+ border: none !important;
+ border-radius: 0 !important;
+ border-bottom: 1px solid #ccc !important;
+ margin-bottom: 4px !important;
+ padding: 2px 5px !important;
+}
diff --git a/pandora_console/install.php b/pandora_console/install.php
index 16458f531d..37124fc2e0 100644
--- a/pandora_console/install.php
+++ b/pandora_console/install.php
@@ -129,7 +129,7 @@
[ qw() ] );
diff --git a/pandora_server/lib/PandoraFMS/SNMPServer.pm b/pandora_server/lib/PandoraFMS/SNMPServer.pm
index 492dfdfa60..581c1b441d 100644
--- a/pandora_server/lib/PandoraFMS/SNMPServer.pm
+++ b/pandora_server/lib/PandoraFMS/SNMPServer.pm
@@ -40,6 +40,7 @@ use PandoraFMS::ProducerConsumerServer;
# Inherits from PandoraFMS::ProducerConsumerServer
our @ISA = qw(PandoraFMS::ProducerConsumerServer);
+our @EXPORT = qw(start_snmptrapd);
# Global variables
my @TaskQueue :shared;
@@ -442,26 +443,29 @@ sub start_snmptrapd ($) {
# Manual start of snmptrapd
if ($config->{'snmp_trapd'} eq 'manual') {
- logger ($config, "No SNMP trap daemon configured. Start snmptrapd manually.", 1);
- print_message ($config, " [*] No SNMP trap daemon configured. Start snmptrapd manually.", 1);
+ my $noSNMPTrap = "No SNMP trap daemon configured. Start snmptrapd manually.";
+ logger ($config, $noSNMPTrap, 1);
+ print_message ($config, " [*] $noSNMPTrap", 1);
if (! -f $config->{'snmp_logfile'}) {
- logger ($config, "SNMP log file " . $config->{'snmp_logfile'} . " not found.", 1);
- print_message ($config, " [E] SNMP log file " . $config->{'snmp_logfile'} . " not found.", 1);
+ my $noLogFile = "SNMP log file " . $config->{'snmp_logfile'} . " not found.";
+ logger ($config, $noLogFile, 1);
+ print_message ($config, " [E] $noLogFile", 1);
return 1;
}
-
+
return 0;
}
-
+
if ( -e $pid_file && open (PIDFILE, $pid_file)) {
my $pid =
+ 0;
- close PIDFILE;
+ close PIDFILE;
# Check if snmptrapd is running
if ($snmptrapd_running = kill (0, $pid)) {
- logger ($config, "snmptrapd (pid $pid) is already running, attempting to kill it...", 1);
- print_message ($config, "snmptrapd (pid $pid) is already running, attempting to kill it...", 1);
+ my $alreadyRunning = "snmptrapd (pid $pid) is already running, attempting to kill it...";
+ logger ($config, $alreadyRunning, 1);
+ print_message ($config, " [*] $alreadyRunning ", 1);
kill (9, $pid);
}
}
@@ -471,17 +475,20 @@ sub start_snmptrapd ($) {
# Select agent-addr field of the PDU or PDU source address for V1 traps
my $address_format = ($config->{'snmp_pdu_address'} eq '0' ? '%a' : '%b');
-
+
my $snmptrapd_args = ' -t -On -n' . $snmp_ignore_authfailure . ' -Lf ' . $config->{'snmp_logfile'} . ' -p ' . $pid_file;
$snmptrapd_args .= ' --format1=SNMPv1[**]%4y-%02.2m-%l[**]%02.2h:%02.2j:%02.2k[**]' . $address_format . '[**]%N[**]%w[**]%W[**]%q[**]%v\\\n';
$snmptrapd_args .= ' --format2=SNMPv2[**]%4y-%02.2m-%l[**]%02.2h:%02.2j:%02.2k[**]%b[**]%v\\\n';
if (system ($config->{'snmp_trapd'} . $snmptrapd_args . " >$DEVNULL 2>&1") != 0) {
- logger ($config, " [E] Could not start snmptrapd.", 1);
- print_message ($config, " [E] Could not start snmptrapd.", 1);
+ my $showError = "Could not start snmptrapd.";
+ logger ($config, $showError, 1);
+ print_message ($config, " [E] $showError ", 1);
return 1;
}
+ print_message ($config, " [*] snmptrapd started and running.", 1);
+
return 0;
}
diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec
index c04b045fc8..debe0dcacf 100644
--- a/pandora_server/pandora_server.redhat.spec
+++ b/pandora_server/pandora_server.redhat.spec
@@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0NG.762
-%define release 220621
+%define release 220622
Summary: Pandora FMS Server
Name: %{name}
diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec
index 4b995009bd..25e79e7786 100644
--- a/pandora_server/pandora_server.spec
+++ b/pandora_server/pandora_server.spec
@@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0NG.762
-%define release 220621
+%define release 220622
Summary: Pandora FMS Server
Name: %{name}
diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer
index 7949e21322..3fa3adf952 100755
--- a/pandora_server/pandora_server_installer
+++ b/pandora_server/pandora_server_installer
@@ -9,7 +9,7 @@
# **********************************************************************
PI_VERSION="7.0NG.762"
-PI_BUILD="220621"
+PI_BUILD="220622"
MODE=$1
if [ $# -gt 1 ]; then
diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl
index 39e7c34516..a179a136ff 100755
--- a/pandora_server/util/pandora_db.pl
+++ b/pandora_server/util/pandora_db.pl
@@ -35,7 +35,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB;
# version: define current version
-my $version = "7.0NG.762 Build 220621";
+my $version = "7.0NG.762 Build 220622";
# Pandora server configuration
my %conf;
diff --git a/pandora_server/util/pandora_logrotate b/pandora_server/util/pandora_logrotate
index 3ac2623122..1abb6ff648 100644
--- a/pandora_server/util/pandora_logrotate
+++ b/pandora_server/util/pandora_logrotate
@@ -49,11 +49,15 @@
}
/var/log/pandora/pandora_snmptrap.log {
+ su pandora apache
weekly
missingok
size 500000
rotate 1
maxage 30
notifempty
+ postrotate
+ pandora_manage /etc/pandora/pandora_server.conf --start_snmptrapd > /dev/null 2>/dev/null || true
+ endscript
copytruncate
}
diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl
index d69946d6d3..fd84475a9e 100755
--- a/pandora_server/util/pandora_manage.pl
+++ b/pandora_server/util/pandora_manage.pl
@@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv;
# version: define current version
-my $version = "7.0NG.762 Build 220621";
+my $version = "7.0NG.762 Build 220622";
# save program name for logging
my $progname = basename($0);
@@ -231,6 +231,7 @@ sub help_screen{
print "\nTOOLS:\n\n" unless $param ne '';
help_screen_line('--exec_from_file', ' ', "Execute any CLI option \n\t with macros from CSV file");
help_screen_line('--create_snmp_trap', ' ', "Create a new trap definition. \n\tSeverity 0 (Maintenance), 1(Info) , 2 (Normal), 3 (Warning), 4 (Critical), 5 (Minor) and 6 (Major)");
+ help_screen_line('--start_snmptrapd', '[no parameters needed]', "Start the snmptrap process or restart if it is running");
print "\nSETUP:\n\n" unless $param ne '';
help_screen_line('--set_event_storm_protection', '', "Enable (1) or disable (0) event \n\t storm protection");
@@ -279,7 +280,7 @@ sub api_call($$$;$$$$) {
my $ua = new LWP::UserAgent;
my $url = $pa_config->{"console_api_url"};
my $response = $ua->post($url, $params);
-
+
if ($response->is_success) {
$content = $response->decoded_content();
}
@@ -1188,6 +1189,16 @@ sub cli_enable_group() {
pandora_enable_group ($conf, $dbh, $id_group);
}
+##############################################################################
+# Start snmptrap process.
+# Related option: --start_snmptrapd
+##############################################################################
+sub cli_start_snmptrapd() {
+ use PandoraFMS::SNMPServer;
+ print_log "[INFO] Starting snmptrap process. \n";
+ PandoraFMS::SNMPServer::start_snmptrapd(\%conf);
+}
+
##############################################################################
# Create an agent.
# Related option: --created_agent
@@ -7526,6 +7537,10 @@ sub pandora_manage_main ($$$) {
param_check($ltotal, 1);
cli_enable_group();
}
+ elsif ($param eq '--start_snmptrapd') {
+ #param_check($ltotal, 0);
+ cli_start_snmptrapd();
+ }
elsif ($param eq '--create_agent') {
param_check($ltotal, 8, 4);
cli_create_agent();