diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control
index e6a3e13697..73e9480b52 100644
--- a/pandora_agents/unix/DEBIAN/control
+++ b/pandora_agents/unix/DEBIAN/control
@@ -1,5 +1,5 @@
package: pandorafms-agent-unix
-Version: 5.1SP1
+Version: 5.1SP1-140929
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 b49d57a208..bd843c5293 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="5.1SP1"
+pandora_version="5.1SP1-140929"
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 a7ce487093..c6dbeb3fb0 100644
--- a/pandora_agents/unix/pandora_agent
+++ b/pandora_agents/unix/pandora_agent
@@ -41,7 +41,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '5.1SP1';
-use constant AGENT_BUILD => '140926';
+use constant AGENT_BUILD => '140929';
# Commands to retrieve total memory information in kB
use constant TOTALMEMORY_CMDS => {
diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec
index 0812c58460..df65b18242 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 5.1SP1
-%define release 1
+%define release 140929
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 2e516db1c9..5a4a3d57d9 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 5.1SP1
-%define release 1
+%define release 140929
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}
diff --git a/pandora_agents/win32/bin/pandora_agent.conf b/pandora_agents/win32/bin/pandora_agent.conf
index a8ef9ad563..f75fd15368 100644
--- a/pandora_agents/win32/bin/pandora_agent.conf
+++ b/pandora_agents/win32/bin/pandora_agent.conf
@@ -97,6 +97,15 @@ xml_buffer 1
#secondary_server_ssl no
#secondary_server_opts
+# Example UDP server to be able to execute remote actions such
+# as starting or stopping process.
+#udp_server 1
+#udp_server_port 4321
+#udp_server_auth_address 192.168.1.23
+#process_firefox_start firefox
+#process_firefox_stop killall firefox
+#service_messenger 1
+
# Module Definition
# Check online documentation and module library at http://pandorafms.org
# =================
@@ -268,15 +277,6 @@ module_end
#module_watchdog yes
#module_end
-# Example UDP server to be able to execute remote actions such
-# as starting or stopping process.
-#udp_server 1
-#udp_server_port 4321
-#udp_server_auth_address 192.168.1.23
-#process_firefox_start firefox
-#process_firefox_stop killall firefox
-#service_messenger 1
-
# Example of preconditions
#module_begin
#module_name Test Precondicion
diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi
index 86682c25fe..10c8680147 100644
--- a/pandora_agents/win32/installer/pandora.mpi
+++ b/pandora_agents/win32/installer/pandora.mpi
@@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
-{140926}
+{140929}
ViewReadme
{Yes}
@@ -2387,7 +2387,7 @@ Windows,BuildSeparateArchives
{No}
Windows,Executable
-{<%AppName%>-Setup<%Ext%>}
+{<%AppName%>-<%Version%>-Setup<%Ext%>}
Windows,FileDescription
{<%AppName%> <%Version%> Setup}
diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc
index d078593287..bd63534900 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 ("5.1SP1(Build 140926)")
+#define PANDORA_VERSION ("5.1SP1(Build 140929)")
string pandora_path;
string pandora_dir;
diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc
index 17b20c108d..8dd648f13c 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", "(5.1SP1(Build 140926))"
+ VALUE "ProductVersion", "(5.1SP1(Build 140929))"
VALUE "FileVersion", "1.0.0.0"
END
END
diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control
index feee97b159..7389572e2f 100644
--- a/pandora_console/DEBIAN/control
+++ b/pandora_console/DEBIAN/control
@@ -1,5 +1,5 @@
package: pandorafms-console
-Version: 5.1SP1
+Version: 5.1SP1-140929
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 b1165d21f2..fa2d1d8540 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="5.1SP1"
+pandora_version="5.1SP1-140929"
package_pear=0
package_pandora=1
diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php
index 0dab2433b3..f817e745e0 100644
--- a/pandora_console/include/config_process.php
+++ b/pandora_console/include/config_process.php
@@ -22,7 +22,7 @@
/**
* Pandora build version and version
*/
-$build_version = 'PC140926';
+$build_version = 'PC140929';
$pandora_version = 'v5.1SP1';
// Do not overwrite default timezone set if defined.
diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php
index 7d54e946cf..5d9c09275a 100755
--- a/pandora_console/include/functions_graph.php
+++ b/pandora_console/include/functions_graph.php
@@ -1512,7 +1512,7 @@ function truncate_negatives(&$element) {
* @param bool return or echo flag
* @param bool show_not_init flag
*/
-function graph_agent_status ($id_agent = false, $width = 300, $height = 200, $return = false, $show_not_init = false) {
+function graph_agent_status ($id_agent = false, $width = 300, $height = 200, $return = false, $show_not_init = false, $data_agents=false) {
global $config;
@@ -1531,8 +1531,13 @@ function graph_agent_status ($id_agent = false, $width = 300, $height = 200, $re
if ($show_not_init) {
$fields[] = 'SUM(notinit_count) "Not init"';
}
+
+ if ($data_agents == false) {
+ $data = db_get_row_filter('tagente', $filter, $fields);
+ } else {
+ $data = $data_agents;
+ }
- $data = db_get_row_filter('tagente', $filter, $fields);
if (empty($data)) {
$data = array();
}
diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php
index 5d3259d057..f8f8d5a2df 100644
--- a/pandora_console/include/functions_reporting.php
+++ b/pandora_console/include/functions_reporting.php
@@ -1350,7 +1350,7 @@ function reporting_get_stats_servers($tiny = true) {
return $output;
}
-function reporting_get_stats_modules_status($data, $graph_width = 250, $graph_height = 150, $links = false) {
+function reporting_get_stats_modules_status($data, $graph_width = 250, $graph_height = 150, $links = false, $data_agents=false) {
global $config;
// Link URLS
@@ -1414,14 +1414,14 @@ function reporting_get_stats_modules_status($data, $graph_width = 250, $graph_he
$tdata[2] = $tdata[3] = '';
$table_mbs->rowclass[] = '';
$table_mbs->data[] = $tdata;
-
+
if ($data["monitor_checks"] > 0) {
$tdata = array();
$table_mbs->colspan[count($table_mbs->data)][0] = 4;
$table_mbs->cellstyle[count($table_mbs->data)][0] = 'text-align: center;';
$tdata[0] = '
' .
'
' .
- graph_agent_status(false, $graph_width, $graph_height, true, true) .
+ graph_agent_status(false, $graph_width, $graph_height, true, true, $data_agents) .
'
';
$table_mbs->rowclass[] = '';
$table_mbs->data[] = $tdata;
@@ -4778,19 +4778,21 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$datelimit = $report["datetime"] - $content['period'];
+ // This query gets information from the default and the historic database
$result = db_get_all_rows_sql('SELECT *
FROM tagente_datos
WHERE id_agente_modulo = ' . $content['id_agent_module'] . '
AND utimestamp > ' . $datelimit . '
- AND utimestamp <= ' . $report["datetime"]);
+ AND utimestamp <= ' . $report["datetime"], true);
// Adds string data if there is no numeric data
- if ((count($result) < 0) or (!$result)){
+ if ((count($result) < 0) or (!$result)) {
+ // This query gets information from the default and the historic database
$result = db_get_all_rows_sql('SELECT *
FROM tagente_datos_string
WHERE id_agente_modulo = ' . $content['id_agent_module'] . '
AND utimestamp > ' . $datelimit . '
- AND utimestamp <= ' . $report["datetime"]);
+ AND utimestamp <= ' . $report["datetime"], true);
}
if ($result === false) {
$result = array();
diff --git a/pandora_console/install.php b/pandora_console/install.php
index 2e99cb67bb..194f2734c0 100644
--- a/pandora_console/install.php
+++ b/pandora_console/install.php
@@ -63,7 +63,7 @@
$group_name) {
+ if ($group_id == 0) {
+ continue;
+ }
+ if ($i==0) {
+ $sql_post .= "'$group_name'";
+ } else {
+ $sql_post .= ",'$group_name'";
+ }
+ $i++;
+ }
+ $sql_post.= ")";
+
+ } else {
+ //Otherwise select all groups the user has rights to.
+ $sql_post = " AND id_grupo IN (" .
+ implode (",", array_keys ($groups)) . ")";
+ }
}
}
diff --git a/pandora_console/pandora_console.redhat.spec b/pandora_console/pandora_console.redhat.spec
index 26e6322e73..a2a64d1e16 100644
--- a/pandora_console/pandora_console.redhat.spec
+++ b/pandora_console/pandora_console.redhat.spec
@@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 5.1SP1
-%define release 1
+%define release 140929
# User and Group under which Apache is running
%define httpd_name httpd
diff --git a/pandora_console/pandora_console.spec b/pandora_console/pandora_console.spec
index 76b222aeb9..b1ad966921 100644
--- a/pandora_console/pandora_console.spec
+++ b/pandora_console/pandora_console.spec
@@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 5.1SP1
-%define release 1
+%define release 140929
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2
diff --git a/pandora_console/pandoradb_data.sql b/pandora_console/pandoradb_data.sql
index 07a96f3878..f3e65499a3 100644
--- a/pandora_console/pandoradb_data.sql
+++ b/pandora_console/pandoradb_data.sql
@@ -38,7 +38,7 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
('graph_res','5'),
('step_compact','1'),
('db_scheme_version','5.1SP1'),
-('db_scheme_build','PD140926'),
+('db_scheme_build','PD140929'),
('show_unknown','0'),
('show_lastalerts','1'),
('style','pandora'),
diff --git a/pandora_server/DEBIAN/control b/pandora_server/DEBIAN/control
index 3cf212747b..1d3cf4f324 100644
--- a/pandora_server/DEBIAN/control
+++ b/pandora_server/DEBIAN/control
@@ -1,5 +1,5 @@
package: pandorafms-server
-Version: 5.1SP1
+Version: 5.1SP1-140929
Architecture: all
Priority: optional
Section: admin
diff --git a/pandora_server/DEBIAN/make_deb_package.sh b/pandora_server/DEBIAN/make_deb_package.sh
index 3d497bdd29..49301ce55a 100644
--- a/pandora_server/DEBIAN/make_deb_package.sh
+++ b/pandora_server/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="5.1SP1"
+pandora_version="5.1SP1-140929"
package_cpan=0
package_pandora=1
diff --git a/pandora_server/bin/pandora_server b/pandora_server/bin/pandora_server
index 5c296b35f8..31068a1a34 100755
--- a/pandora_server/bin/pandora_server
+++ b/pandora_server/bin/pandora_server
@@ -270,6 +270,9 @@ sub pandora_server_tasks ($) {
# Update forced alerts
pandora_exec_forced_alerts ($pa_config, $dbh);
+
+ # Rotate Log File
+ pandora_rotate_logfile($pa_config);
}
# TASKS EXECUTED EVERY 30 SECONDS (Mid latency tasks)
diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm
index 0e9d5518c7..4b4654748c 100644
--- a/pandora_server/lib/PandoraFMS/Config.pm
+++ b/pandora_server/lib/PandoraFMS/Config.pm
@@ -43,7 +43,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "5.1SP1";
-my $pandora_build = "140926";
+my $pandora_build = "140929";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash
diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm
index 7405274f9e..c8cb3605a4 100644
--- a/pandora_server/lib/PandoraFMS/Core.pm
+++ b/pandora_server/lib/PandoraFMS/Core.pm
@@ -3452,9 +3452,9 @@ sub get_module_status ($$$) {
return 1 if ($data >= $critical_min && $data < $critical_max);
return 1 if ($data >= $critical_min && $critical_max < $critical_min);
}
- # (-inf, critical_min), (critical_max, +inf)
+ # (-inf, critical_min), [critical_max, +inf)
else {
- return 1 if ($data < $critical_min || $data > $critical_max);
+ return 1 if ($data < $critical_min || $data >= $critical_max);
return 1 if ($data <= $critical_max && $critical_max < $critical_min);
}
}
@@ -3466,9 +3466,9 @@ sub get_module_status ($$$) {
return 2 if ($data >= $warning_min && $data < $warning_max);
return 2 if ($data >= $warning_min && $warning_max < $warning_min);
}
- # (-inf, warning_min), (warning_max, +inf)
+ # (-inf, warning_min), [warning_max, +inf)
else {
- return 2 if ($data < $warning_min || $data > $warning_max);
+ return 2 if ($data < $warning_min || $data >= $warning_max);
return 2 if ($data <= $warning_max && $warning_max < $warning_min);
}
}
diff --git a/pandora_server/lib/PandoraFMS/Tools.pm b/pandora_server/lib/PandoraFMS/Tools.pm
index 708a874ca7..8534af25c6 100644
--- a/pandora_server/lib/PandoraFMS/Tools.pm
+++ b/pandora_server/lib/PandoraFMS/Tools.pm
@@ -62,6 +62,7 @@ our @EXPORT = qw(
cron_next_execution_date
pandora_daemonize
logger
+ pandora_rotate_logfile
limpia_cadena
md5check
float_equal
@@ -441,7 +442,7 @@ sub logger ($$;$) {
$level = 1 unless defined ($level);
return if ($level > $pa_config->{'verbosity'});
-
+
if (!defined($pa_config->{'logfile'})) {
print strftime ("%Y-%m-%d %H:%M:%S", localtime()) . " [V". $level ."] " . $message . "\n";
return;
@@ -465,20 +466,33 @@ sub logger ($$;$) {
syslog($security_level, $message);
closelog();
} else {
- # Log rotation
- if (-e $file && (stat($file))[7] > $pa_config->{'max_log_size'}) {
- foreach my $i (reverse 1..$pa_config->{'max_log_generation'}) {
- rename ($file . "." . ($i - 1), $file . "." . $i);
- }
- rename ($file, "$file.0");
- }
-
open (FILE, ">> $file") or die "[FATAL] Could not open logfile '$file'";
+ # Get an exclusive lock on the file (LOCK_EX)
+ flock (FILE, 2);
print FILE strftime ("%Y-%m-%d %H:%M:%S", localtime()) . " " . $pa_config->{'servername'} . $pa_config->{'servermode'} . " [V". $level ."] " . $message . "\n";
close (FILE);
}
}
+########################################################################
+# SUB pandora_rotate_log (pa_config)
+# Log to file
+########################################################################
+sub pandora_rotate_logfile ($) {
+ my ($pa_config) = @_;
+
+ my $file = $pa_config->{'logfile'};
+
+ # Log File Rotation
+ if ($file ne 'syslog' && -e $file && (stat($file))[7] > $pa_config->{'max_log_size'}) {
+ foreach my $i (reverse 1..$pa_config->{'max_log_generation'}) {
+ rename ($file . "." . ($i - 1), $file . "." . $i);
+ }
+ rename ($file, "$file.0");
+
+ }
+}
+
########################################################################
# limpia_cadena (string) - Purge a string for any forbidden characters (esc, etc)
########################################################################
diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec
index 1b32151f2a..a8bfe2111c 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 5.1SP1
-%define release 1
+%define release 140929
Summary: Pandora FMS Server
Name: %{name}
diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec
index 3f8ef64a5b..0fd1244f86 100644
--- a/pandora_server/pandora_server.spec
+++ b/pandora_server/pandora_server.spec
@@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 5.1SP1
-%define release 1
+%define release 140929
Summary: Pandora FMS Server
Name: %{name}
diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl
index 911dcac257..4f3bdd6225 100644
--- a/pandora_server/util/pandora_db.pl
+++ b/pandora_server/util/pandora_db.pl
@@ -33,7 +33,7 @@ use PandoraFMS::Tools;
use PandoraFMS::DB;
# version: define current version
-my $version = "5.1SP1 PS140926";
+my $version = "5.1SP1 PS140929";
# Pandora server configuration
my %conf;
diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl
index 5f90a23beb..6b6d22efa4 100644
--- a/pandora_server/util/pandora_manage.pl
+++ b/pandora_server/util/pandora_manage.pl
@@ -34,7 +34,7 @@ use Encode::Locale;
Encode::Locale::decode_argv;
# version: define current version
-my $version = "5.1SP1 PS140926";
+my $version = "5.1SP1 PS140929";
# save program name for logging
my $progname = basename($0);