This commit is contained in:
m-lopez-f 2015-04-24 12:15:46 +02:00
commit 51cd55da10
25 changed files with 81 additions and 61 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 6.0dev-150421 Version: 6.0dev-150424
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="6.0dev-150421" pandora_version="6.0dev-150424"
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 => '6.0dev'; use constant AGENT_VERSION => '6.0dev';
use constant AGENT_BUILD => '150421'; use constant AGENT_BUILD => '150424';
# Commands to retrieve total memory information in kB # Commands to retrieve total memory information in kB
use constant TOTALMEMORY_CMDS => { use constant TOTALMEMORY_CMDS => {
@ -754,8 +754,31 @@ sub read_config (;$) {
$RemoteConfFile = "$AgentMD5.conf"; $RemoteConfFile = "$AgentMD5.conf";
$RemoteMD5File = "$AgentMD5.md5"; $RemoteMD5File = "$AgentMD5.md5";
# Set the maximun number of threads # Load thread support if agent_threads is greater than 1.
$ThreadSem = Thread::Semaphore->new ($Conf{'agent_threads'}) if defined ($Sem); if ($Conf{'agent_threads'} > 1) {
eval {
local $SIG{__DIE__};
require threads;
require threads::shared;
require Thread::Semaphore;
};
if (!$@) {
$Sem = Thread::Semaphore->new;
$ThreadSem = Thread::Semaphore->new ($Conf{'agent_threads'});
threads::shared::share (\$Xml);
threads::shared::share (\$Sem);
log_message ('log', 'Using thread library.');
} else {
log_message ('log', 'Thread library is not available. agent_threads is set to 1 (disabled).');
$Conf{'agent_threads'} = 1;
$Sem = undef;
$ThreadSem = undef;
}
} else {
$Sem = undef;
$ThreadSem = undef;
log_message ('log', 'Thread is disabled.');
}
# Set tentacle client options # Set tentacle client options
if ($Conf{'transfer_mode'} eq 'tentacle') { if ($Conf{'transfer_mode'} eq 'tentacle') {
@ -1205,7 +1228,7 @@ sub guess_os_version ($) {
################################################################################ ################################################################################
sub exec_module ($) { sub exec_module ($) {
my $module = shift; my $module = shift;
print "THREAD " . threads->tid() . " EXECUTING MODULE " . $module->{'name'} . "\n";
# Need something to execute # Need something to execute
if ($module->{'func'} == 0) { if ($module->{'func'} == 0) {
$ThreadSem->up () if (defined ($ThreadSem) && $Conf{'agent_threads'} > 1); $ThreadSem->up () if (defined ($ThreadSem) && $Conf{'agent_threads'} > 1);
@ -2064,27 +2087,6 @@ error ("Temporal directory '" . $Conf{'temporal'} . "' does not exist.") unless
$Conf{'server_path'} = fix_directory ($Conf{'server_path'}); $Conf{'server_path'} = fix_directory ($Conf{'server_path'});
$Conf{'secondary_server_path'} = fix_directory ($Conf{'secondary_server_path'}); $Conf{'secondary_server_path'} = fix_directory ($Conf{'secondary_server_path'});
# Load thread support if agent_threads is greater than 1.
if ($Conf{'agent_threads'} > 1) {
eval {
local $SIG{__DIE__};
require threads;
require threads::shared;
require Thread::Semaphore;
};
if (!$@) {
$Sem = Thread::Semaphore->new;
threads::shared::share (\$Xml);
threads::shared::share (\$Sem);
log_message ('log', 'Using thread library.');
} else {
log_message ('log', 'Thread library is not available. agent_threads is set to 1 (disabled).');
$Conf{'agent_threads'} = 1;
}
} else {
log_message ('log', 'Thread is disabled.');
}
# Startup delay # Startup delay
log_message ('log', 'Sleeping for ' . $Conf{'delayed_startup'} . ' seconds.') if ($Conf{'delayed_startup'} > 0); log_message ('log', 'Sleeping for ' . $Conf{'delayed_startup'} . ' seconds.') if ($Conf{'delayed_startup'} > 0);
sleep ($Conf{'delayed_startup'}); sleep ($Conf{'delayed_startup'});

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 6.0dev %define version 6.0dev
%define release 150421 %define release 150424
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 6.0dev %define version 6.0dev
%define release 150421 %define release 150424
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -47,9 +47,9 @@ pidof_pandora () {
fi fi
if [ "$ZONE" = "global" ] if [ "$ZONE" = "global" ]
then then
PANDORA_PID=`ps -f -z global | grep "$TRUNCATED_DAEMON" | grep -v grep | head -1 | awk '{ print $2 }'` PANDORA_PID=`ps -f -z global | grep "$TRUNCATED_DAEMON" | grep -v grep | awk '{ print $2 }'`
else else
PANDORA_PID=`ps -Af | grep "$TRUNCATED_DAEMON" | grep -v grep | head -1 | awk '{ print $2 }'` PANDORA_PID=`ps -Af | grep "$TRUNCATED_DAEMON" | grep -v grep | awk '{ print $2 }'`
fi fi
elif [ "$OS_NAME" = "Linux" ] && [ -x /usr/sbin/vzpid ] elif [ "$OS_NAME" = "Linux" ] && [ -x /usr/sbin/vzpid ]
then then
@ -66,7 +66,7 @@ pidof_pandora () {
fi fi
done done
else else
PANDORA_PID=`ps -Af | grep "$DAEMON $PANDORA_PATH" | grep -v grep | head -1 | awk '{ print $2 }'` PANDORA_PID=`ps -Af | grep "$DAEMON $PANDORA_PATH" | grep -v grep | awk '{ print $2 }'`
fi fi
echo $PANDORA_PID echo $PANDORA_PID
@ -90,7 +90,14 @@ case "$1" in
su $PANDORA_USER -c "PATH=$PATH nohup $DAEMON $PANDORA_PATH >/dev/null 2>$LOGFILE &" su $PANDORA_USER -c "PATH=$PATH nohup $DAEMON $PANDORA_PATH >/dev/null 2>$LOGFILE &"
sleep 2 sleep 2
PANDORA_PID=`pidof_pandora` PANDORA_PID=`pidof_pandora`
echo "Pandora FMS Agent is now running with PID $PANDORA_PID" if [ "$PANDORA_PID" = "" ]
then
echo "Pandora FMS Agent could not be started. Please check the file $LOGFILE."
exit 1
else
echo "Pandora FMS Agent is now running with PID $PANDORA_PID"
fi
;; ;;
stop) stop)

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{150421} {150424}
ViewReadme ViewReadme
{Yes} {Yes}

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 ("6.0dev(Build 150421)") #define PANDORA_VERSION ("6.0dev(Build 150424)")
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", "(6.0dev(Build 150421))" VALUE "ProductVersion", "(6.0dev(Build 150424))"
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: 6.0dev-150421 Version: 6.0dev-150424
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="6.0dev-150421" pandora_version="6.0dev-150424"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -138,7 +138,7 @@ function mainAgentsModules() {
} }
$count++; $count++;
} }
$total_pagination = count($agents);
$all_modules = agents_get_modules($agents, false, $filter_module_group, true, false); $all_modules = agents_get_modules($agents, false, $filter_module_group, true, false);
$modules_by_name = array(); $modules_by_name = array();
@ -242,13 +242,12 @@ function mainAgentsModules() {
echo "</tr>"; echo "</tr>";
$filter_agents = array('offset' => (int) $offset, $filter_agents = array('offset' => (int) $offset, 'disabled' => 0);
'limit' => (int) $config['block_size'], 'disabled' => 0);
if ($group_id > 0) { if ($group_id > 0) {
$filter_agents['id_grupo'] = $group_id; $filter_agents['id_grupo'] = $group_id;
} }
// Prepare pagination // Prepare pagination
ui_pagination ((int)count(agents_get_agents ($filter_agents))); ui_pagination ($total_pagination);
foreach ($agents as $agent) { foreach ($agents as $agent) {
// Get stats for this group // Get stats for this group

View File

@ -22,7 +22,7 @@
/** /**
* Pandora build version and version * Pandora build version and version
*/ */
$build_version = 'PC150421'; $build_version = 'PC150424';
$pandora_version = 'v6.0dev'; $pandora_version = 'v6.0dev';
// Do not overwrite default timezone set if defined. // Do not overwrite default timezone set if defined.

View File

@ -181,14 +181,26 @@ function mysql_db_get_row ($table, $field_search, $condition, $fields = false) {
* @return mixed A matrix with all the values in the table * @return mixed A matrix with all the values in the table
*/ */
function mysql_db_get_all_rows_in_table($table, $order_field = "", $order = 'ASC') { function mysql_db_get_all_rows_in_table($table, $order_field = "", $order = 'ASC') {
if ($order_field != "") { $sql = "
return db_get_all_rows_sql ("SELECT * SELECT *
FROM `".$table."` FROM `".$table."`";
ORDER BY ".$order_field . " " . $order);
} if (!empty($order_field)) {
else { if (is_array($order_field)) {
return db_get_all_rows_sql ("SELECT * FROM `".$table."`"); foreach ($order_field as $i => $o) {
$order_field[$i] = $o . " " . $order;
}
$sql .= "
ORDER BY " . implode(",", $order_field);
}
else {
$sql .= "
ORDER BY ".$order_field . " " . $order;
}
} }
return db_get_all_rows_sql($sql);
} }
/** /**

View File

@ -63,7 +63,7 @@
<div style='height: 10px'> <div style='height: 10px'>
<?php <?php
$version = '6.0dev'; $version = '6.0dev';
$build = '150421'; $build = '150424';
$banner = "v$version Build $build"; $banner = "v$version Build $build";
error_reporting(0); error_reporting(0);

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 6.0dev %define version 6.0dev
%define release 150421 %define release 150424
# 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 6.0dev %define version 6.0dev
%define release 150421 %define release 150424
%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','6.0dev'), ('db_scheme_version','6.0dev'),
('db_scheme_build','PD150421'), ('db_scheme_build','PD150424'),
('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: 6.0dev-150421 Version: 6.0dev-150424
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="6.0dev-150421" pandora_version="6.0dev-150424"
package_cpan=0 package_cpan=0
package_pandora=1 package_pandora=1

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 = "6.0dev"; my $pandora_version = "6.0dev";
my $pandora_build = "150421"; my $pandora_build = "150424";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash # Setup hash

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_server %define name pandorafms_server
%define version 6.0dev %define version 6.0dev
%define release 150421 %define release 150424
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 6.0dev %define version 6.0dev
%define release 150421 %define release 150424
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 = "6.0dev PS150421"; my $version = "6.0dev PS150424";
# Pandora server configuration # Pandora server configuration
my %conf; my %conf;

View File

@ -35,7 +35,7 @@ use Encode::Locale;
Encode::Locale::decode_argv; Encode::Locale::decode_argv;
# version: define current version # version: define current version
my $version = "6.0dev PS150421"; my $version = "6.0dev PS150424";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);