Merge branch 'develop' of github.com:pandorafms/pandorafms into develop

This commit is contained in:
mdtrooper 2014-09-29 13:50:26 +02:00
commit 81ad47e751
29 changed files with 100 additions and 56 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 5.1SP1 Version: 5.1SP1-140929
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

@ -41,7 +41,7 @@ my $Sem = undef;
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '5.1SP1'; use constant AGENT_VERSION => '5.1SP1';
use constant AGENT_BUILD => '140926'; use constant AGENT_BUILD => '140929';
# Commands to retrieve total memory information in kB # Commands to retrieve total memory information in kB
use constant TOTALMEMORY_CMDS => { use constant TOTALMEMORY_CMDS => {

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 5.1SP1 %define version 5.1SP1
%define release 1 %define release 140929
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 5.1SP1 %define version 5.1SP1
%define release 1 %define release 140929
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -97,6 +97,15 @@ xml_buffer 1
#secondary_server_ssl no #secondary_server_ssl no
#secondary_server_opts #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 # Module Definition
# Check online documentation and module library at http://pandorafms.org # Check online documentation and module library at http://pandorafms.org
# ================= # =================
@ -268,15 +277,6 @@ module_end
#module_watchdog yes #module_watchdog yes
#module_end #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 # Example of preconditions
#module_begin #module_begin
#module_name Test Precondicion #module_name Test Precondicion

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{140926} {140929}
ViewReadme ViewReadme
{Yes} {Yes}
@ -2387,7 +2387,7 @@ Windows,BuildSeparateArchives
{No} {No}
Windows,Executable Windows,Executable
{<%AppName%>-Setup<%Ext%>} {<%AppName%>-<%Version%>-Setup<%Ext%>}
Windows,FileDescription Windows,FileDescription
{<%AppName%> <%Version%> Setup} {<%AppName%> <%Version%> Setup}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils; using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1 #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_path;
string pandora_dir; string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST" VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent" VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(5.1SP1(Build 140926))" VALUE "ProductVersion", "(5.1SP1(Build 140929))"
VALUE "FileVersion", "1.0.0.0" VALUE "FileVersion", "1.0.0.0"
END END
END END

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 5.1SP1 Version: 5.1SP1-140929
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="5.1SP1" pandora_version="5.1SP1-140929"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -22,7 +22,7 @@
/** /**
* Pandora build version and version * Pandora build version and version
*/ */
$build_version = 'PC140926'; $build_version = 'PC140929';
$pandora_version = 'v5.1SP1'; $pandora_version = 'v5.1SP1';
// Do not overwrite default timezone set if defined. // Do not overwrite default timezone set if defined.

View File

@ -1512,7 +1512,7 @@ function truncate_negatives(&$element) {
* @param bool return or echo flag * @param bool return or echo flag
* @param bool show_not_init 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; global $config;
@ -1531,8 +1531,13 @@ function graph_agent_status ($id_agent = false, $width = 300, $height = 200, $re
if ($show_not_init) { if ($show_not_init) {
$fields[] = 'SUM(notinit_count) "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)) { if (empty($data)) {
$data = array(); $data = array();
} }

View File

@ -1350,7 +1350,7 @@ function reporting_get_stats_servers($tiny = true) {
return $output; 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; global $config;
// Link URLS // Link URLS
@ -1414,14 +1414,14 @@ function reporting_get_stats_modules_status($data, $graph_width = 250, $graph_he
$tdata[2] = $tdata[3] = ''; $tdata[2] = $tdata[3] = '';
$table_mbs->rowclass[] = ''; $table_mbs->rowclass[] = '';
$table_mbs->data[] = $tdata; $table_mbs->data[] = $tdata;
if ($data["monitor_checks"] > 0) { if ($data["monitor_checks"] > 0) {
$tdata = array(); $tdata = array();
$table_mbs->colspan[count($table_mbs->data)][0] = 4; $table_mbs->colspan[count($table_mbs->data)][0] = 4;
$table_mbs->cellstyle[count($table_mbs->data)][0] = 'text-align: center;'; $table_mbs->cellstyle[count($table_mbs->data)][0] = 'text-align: center;';
$tdata[0] = '<div id="outter_status_pie" style="height: ' . $graph_height . 'px">' . $tdata[0] = '<div id="outter_status_pie" style="height: ' . $graph_height . 'px">' .
'<div id="status_pie" style="margin: auto; width: ' . $graph_width . 'px;">' . '<div id="status_pie" style="margin: auto; width: ' . $graph_width . 'px;">' .
graph_agent_status(false, $graph_width, $graph_height, true, true) . graph_agent_status(false, $graph_width, $graph_height, true, true, $data_agents) .
'</div></div>'; '</div></div>';
$table_mbs->rowclass[] = ''; $table_mbs->rowclass[] = '';
$table_mbs->data[] = $tdata; $table_mbs->data[] = $tdata;
@ -4778,19 +4778,21 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$datelimit = $report["datetime"] - $content['period']; $datelimit = $report["datetime"] - $content['period'];
// This query gets information from the default and the historic database
$result = db_get_all_rows_sql('SELECT * $result = db_get_all_rows_sql('SELECT *
FROM tagente_datos FROM tagente_datos
WHERE id_agente_modulo = ' . $content['id_agent_module'] . ' WHERE id_agente_modulo = ' . $content['id_agent_module'] . '
AND utimestamp > ' . $datelimit . ' AND utimestamp > ' . $datelimit . '
AND utimestamp <= ' . $report["datetime"]); AND utimestamp <= ' . $report["datetime"], true);
// Adds string data if there is no numeric data // 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 * $result = db_get_all_rows_sql('SELECT *
FROM tagente_datos_string FROM tagente_datos_string
WHERE id_agente_modulo = ' . $content['id_agent_module'] . ' WHERE id_agente_modulo = ' . $content['id_agent_module'] . '
AND utimestamp > ' . $datelimit . ' AND utimestamp > ' . $datelimit . '
AND utimestamp <= ' . $report["datetime"]); AND utimestamp <= ' . $report["datetime"], true);
} }
if ($result === false) { if ($result === false) {
$result = array(); $result = array();

View File

@ -63,7 +63,7 @@
<div style='height: 10px'> <div style='height: 10px'>
<?php <?php
$version = '5.1SP1'; $version = '5.1SP1';
$build = '140926'; $build = '140929';
$banner = "v$version Build $build"; $banner = "v$version Build $build";
error_reporting(0); error_reporting(0);

View File

@ -48,9 +48,29 @@ else {
$sql_post = ""; $sql_post = "";
} }
else { else {
//Otherwise select all groups the user has rights to. if ($meta) {
$sql_post = " AND id_grupo IN (" . // In metaconsole the group search is performed by name
implode (",", array_keys ($groups)) . ")";
$sql_post = " AND group_name IN ( ";
$i = 0;
foreach ($groups as $group_id=>$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)) . ")";
}
} }
} }

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 5.1SP1 %define version 5.1SP1
%define release 1 %define release 140929
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name httpd %define httpd_name httpd

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 5.1SP1 %define version 5.1SP1
%define release 1 %define release 140929
%define httpd_name httpd %define httpd_name httpd
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name apache2 %define httpd_name apache2

View File

@ -38,7 +38,7 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
('graph_res','5'), ('graph_res','5'),
('step_compact','1'), ('step_compact','1'),
('db_scheme_version','5.1SP1'), ('db_scheme_version','5.1SP1'),
('db_scheme_build','PD140926'), ('db_scheme_build','PD140929'),
('show_unknown','0'), ('show_unknown','0'),
('show_lastalerts','1'), ('show_lastalerts','1'),
('style','pandora'), ('style','pandora'),

View File

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 5.1SP1 Version: 5.1SP1-140929
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="5.1SP1" pandora_version="5.1SP1-140929"
package_cpan=0 package_cpan=0
package_pandora=1 package_pandora=1

View File

@ -270,6 +270,9 @@ sub pandora_server_tasks ($) {
# Update forced alerts # Update forced alerts
pandora_exec_forced_alerts ($pa_config, $dbh); pandora_exec_forced_alerts ($pa_config, $dbh);
# Rotate Log File
pandora_rotate_logfile($pa_config);
} }
# TASKS EXECUTED EVERY 30 SECONDS (Mid latency tasks) # TASKS EXECUTED EVERY 30 SECONDS (Mid latency tasks)

View File

@ -43,7 +43,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only # version: Defines actual version of Pandora Server for this module only
my $pandora_version = "5.1SP1"; my $pandora_version = "5.1SP1";
my $pandora_build = "140926"; my $pandora_build = "140929";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash # Setup hash

View File

@ -3452,9 +3452,9 @@ sub get_module_status ($$$) {
return 1 if ($data >= $critical_min && $data < $critical_max); return 1 if ($data >= $critical_min && $data < $critical_max);
return 1 if ($data >= $critical_min && $critical_max < $critical_min); return 1 if ($data >= $critical_min && $critical_max < $critical_min);
} }
# (-inf, critical_min), (critical_max, +inf) # (-inf, critical_min), [critical_max, +inf)
else { 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); 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 && $data < $warning_max);
return 2 if ($data >= $warning_min && $warning_max < $warning_min); return 2 if ($data >= $warning_min && $warning_max < $warning_min);
} }
# (-inf, warning_min), (warning_max, +inf) # (-inf, warning_min), [warning_max, +inf)
else { 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); return 2 if ($data <= $warning_max && $warning_max < $warning_min);
} }
} }

View File

@ -62,6 +62,7 @@ our @EXPORT = qw(
cron_next_execution_date cron_next_execution_date
pandora_daemonize pandora_daemonize
logger logger
pandora_rotate_logfile
limpia_cadena limpia_cadena
md5check md5check
float_equal float_equal
@ -441,7 +442,7 @@ sub logger ($$;$) {
$level = 1 unless defined ($level); $level = 1 unless defined ($level);
return if ($level > $pa_config->{'verbosity'}); return if ($level > $pa_config->{'verbosity'});
if (!defined($pa_config->{'logfile'})) { if (!defined($pa_config->{'logfile'})) {
print strftime ("%Y-%m-%d %H:%M:%S", localtime()) . " [V". $level ."] " . $message . "\n"; print strftime ("%Y-%m-%d %H:%M:%S", localtime()) . " [V". $level ."] " . $message . "\n";
return; return;
@ -465,20 +466,33 @@ sub logger ($$;$) {
syslog($security_level, $message); syslog($security_level, $message);
closelog(); closelog();
} else { } 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'"; 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"; print FILE strftime ("%Y-%m-%d %H:%M:%S", localtime()) . " " . $pa_config->{'servername'} . $pa_config->{'servermode'} . " [V". $level ."] " . $message . "\n";
close (FILE); 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) # limpia_cadena (string) - Purge a string for any forbidden characters (esc, etc)
######################################################################## ########################################################################

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_server %define name pandorafms_server
%define version 5.1SP1 %define version 5.1SP1
%define release 1 %define release 140929
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_server %define name pandorafms_server
%define version 5.1SP1 %define version 5.1SP1
%define release 1 %define release 140929
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -33,7 +33,7 @@ use PandoraFMS::Tools;
use PandoraFMS::DB; use PandoraFMS::DB;
# version: define current version # version: define current version
my $version = "5.1SP1 PS140926"; my $version = "5.1SP1 PS140929";
# Pandora server configuration # Pandora server configuration
my %conf; my %conf;

View File

@ -34,7 +34,7 @@ use Encode::Locale;
Encode::Locale::decode_argv; Encode::Locale::decode_argv;
# version: define current version # version: define current version
my $version = "5.1SP1 PS140926"; my $version = "5.1SP1 PS140929";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);