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
Version: 6.0dev-150421
Version: 6.0dev-150424
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="6.0dev-150421"
pandora_version="6.0dev-150424"
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 => '6.0dev';
use constant AGENT_BUILD => '150421';
use constant AGENT_BUILD => '150424';
# Commands to retrieve total memory information in kB
use constant TOTALMEMORY_CMDS => {
@ -754,8 +754,31 @@ sub read_config (;$) {
$RemoteConfFile = "$AgentMD5.conf";
$RemoteMD5File = "$AgentMD5.md5";
# Set the maximun number of threads
$ThreadSem = Thread::Semaphore->new ($Conf{'agent_threads'}) if defined ($Sem);
# 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;
$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
if ($Conf{'transfer_mode'} eq 'tentacle') {
@ -1205,7 +1228,7 @@ sub guess_os_version ($) {
################################################################################
sub exec_module ($) {
my $module = shift;
print "THREAD " . threads->tid() . " EXECUTING MODULE " . $module->{'name'} . "\n";
# Need something to execute
if ($module->{'func'} == 0) {
$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{'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
log_message ('log', 'Sleeping for ' . $Conf{'delayed_startup'} . ' seconds.') if ($Conf{'delayed_startup'} > 0);
sleep ($Conf{'delayed_startup'});

View File

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

View File

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

View File

@ -47,9 +47,9 @@ pidof_pandora () {
fi
if [ "$ZONE" = "global" ]
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
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
elif [ "$OS_NAME" = "Linux" ] && [ -x /usr/sbin/vzpid ]
then
@ -66,7 +66,7 @@ pidof_pandora () {
fi
done
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
echo $PANDORA_PID
@ -90,7 +90,14 @@ case "$1" in
su $PANDORA_USER -c "PATH=$PATH nohup $DAEMON $PANDORA_PATH >/dev/null 2>$LOGFILE &"
sleep 2
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)

View File

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

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#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_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(6.0dev(Build 150421))"
VALUE "ProductVersion", "(6.0dev(Build 150424))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 6.0dev-150421
Version: 6.0dev-150424
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="6.0dev-150421"
pandora_version="6.0dev-150424"
package_pear=0
package_pandora=1

View File

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

View File

@ -22,7 +22,7 @@
/**
* Pandora build version and version
*/
$build_version = 'PC150421';
$build_version = 'PC150424';
$pandora_version = 'v6.0dev';
// 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
*/
function mysql_db_get_all_rows_in_table($table, $order_field = "", $order = 'ASC') {
if ($order_field != "") {
return db_get_all_rows_sql ("SELECT *
FROM `".$table."`
ORDER BY ".$order_field . " " . $order);
}
else {
return db_get_all_rows_sql ("SELECT * FROM `".$table."`");
$sql = "
SELECT *
FROM `".$table."`";
if (!empty($order_field)) {
if (is_array($order_field)) {
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'>
<?php
$version = '6.0dev';
$build = '150421';
$build = '150424';
$banner = "v$version Build $build";
error_reporting(0);

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 6.0dev
%define release 150421
%define release 150424
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 6.0dev
%define release 150421
%define release 150424
%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','6.0dev'),
('db_scheme_build','PD150421'),
('db_scheme_build','PD150424'),
('show_unknown','0'),
('show_lastalerts','1'),
('style','pandora'),

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 6.0dev-150421
Version: 6.0dev-150424
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="6.0dev-150421"
pandora_version="6.0dev-150424"
package_cpan=0
package_pandora=1

View File

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

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 6.0dev
%define release 150421
%define release 150424
Summary: Pandora FMS Server
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 6.0dev
%define release 150421
%define release 150424
Summary: Pandora FMS Server
Name: %{name}

View File

@ -33,7 +33,7 @@ use PandoraFMS::Tools;
use PandoraFMS::DB;
# version: define current version
my $version = "6.0dev PS150421";
my $version = "6.0dev PS150424";
# Pandora server configuration
my %conf;

View File

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