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
Version: 5.1SP1
Version: 5.1SP1-140929
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="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

View File

@ -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 => {

View File

@ -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}

View File

@ -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}

View File

@ -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

View File

@ -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}

View File

@ -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;

View File

@ -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

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 5.1SP1
Version: 5.1SP1-140929
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="5.1SP1"
pandora_version="5.1SP1-140929"
package_pear=0
package_pandora=1

View File

@ -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.

View File

@ -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;
@ -1532,7 +1532,12 @@ function graph_agent_status ($id_agent = false, $width = 300, $height = 200, $re
$fields[] = 'SUM(notinit_count) "Not init"';
}
if ($data_agents == false) {
$data = db_get_row_filter('tagente', $filter, $fields);
} else {
$data = $data_agents;
}
if (empty($data)) {
$data = array();
}

View File

@ -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
@ -1421,7 +1421,7 @@ function reporting_get_stats_modules_status($data, $graph_width = 250, $graph_he
$table_mbs->cellstyle[count($table_mbs->data)][0] = 'text-align: center;';
$tdata[0] = '<div id="outter_status_pie" style="height: ' . $graph_height . '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>';
$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();

View File

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

View File

@ -48,10 +48,30 @@ else {
$sql_post = "";
}
else {
if ($meta) {
// In metaconsole the group search is performed by name
$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)) . ")";
}
}
}
// Skip system messages if user is not PM

View File

@ -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

View File

@ -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

View File

@ -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'),

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 5.1SP1
Version: 5.1SP1-140929
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="5.1SP1"
pandora_version="5.1SP1-140929"
package_cpan=0
package_pandora=1

View File

@ -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)

View File

@ -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

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 && $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);
}
}

View File

@ -62,6 +62,7 @@ our @EXPORT = qw(
cron_next_execution_date
pandora_daemonize
logger
pandora_rotate_logfile
limpia_cadena
md5check
float_equal
@ -465,17 +466,30 @@ sub logger ($$;$) {
syslog($security_level, $message);
closelog();
} else {
# Log rotation
if (-e $file && (stat($file))[7] > $pa_config->{'max_log_size'}) {
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");
}
open (FILE, ">> $file") or die "[FATAL] Could not open logfile '$file'";
print FILE strftime ("%Y-%m-%d %H:%M:%S", localtime()) . " " . $pa_config->{'servername'} . $pa_config->{'servermode'} . " [V". $level ."] " . $message . "\n";
close (FILE);
}
}

View File

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

View File

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

View File

@ -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;

View File

@ -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);