2011-04-11 Dario Rodriguez <dario.rodriguez@artica.es>

* pandora_agent_installer: Added code to install tentacle_server with
	pandora agent.
	* AIX/pandora_agent.conf: Added two new parameters proxy_mode and 
	proxy_user.
	* tentacle_server: Added tentacle server with proxy support.
	* pandora_agent_daemon: Add feature to stop tentacle_server when
	pandora agent stops.
	* Linux/pandora_agent.conf: Added two new parameters proxy_mode and 
	proxy_user.
	* HP-UX/pandora_agent.conf: Added two new parameters proxy_mode and 
	proxy_user.
	* pandora_agent: Added support to tentacle_server and proxy_mode.
	* SunOS/pandora_agent.conf: Added two new parameters proxy_mode and 
	proxy_user.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4185 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
darode 2011-04-11 16:35:45 +00:00
parent 79f39a336f
commit 9d524f3b3f
9 changed files with 1578 additions and 2 deletions

View File

@ -82,6 +82,12 @@ transfer_mode tentacle
# If set to 1 allows the agent to be configured via the web console (Only Enterprise version)
# remote_config 1
# If set to 1 start babel agent in proxy mode
# proxy_mode 1
# User which runs tentacle server in proxy mode. Required with if proxy mode is enable (by default babel)
# proxy_user pandora
# User the agent will run as
#pandora_user root

View File

@ -1,3 +1,20 @@
2011-04-11 Dario Rodriguez <dario.rodriguez@artica.es>
* pandora_agent_installer: Added code to install tentacle_server with
pandora agent.
* AIX/pandora_agent.conf: Added two new parameters proxy_mode and
proxy_user.
* tentacle_server: Added tentacle server with proxy support.
* pandora_agent_daemon: Add feature to stop tentacle_server when
pandora agent stops.
* Linux/pandora_agent.conf: Added two new parameters proxy_mode and
proxy_user.
* HP-UX/pandora_agent.conf: Added two new parameters proxy_mode and
proxy_user.
* pandora_agent: Added support to tentacle_server and proxy_mode.
* SunOS/pandora_agent.conf: Added two new parameters proxy_mode and
proxy_user.
2011-04-04 Dario Rodriguez <dario.rodriguez@artica.es>
* pandora_agent_installer: Fixed an error with chown in AIX OS.

View File

@ -82,6 +82,12 @@ transfer_mode tentacle
# If set to 1 allows the agent to be configured via the web console (Only Enterprise version)
# remote_config 1
# If set to 1 start babel agent in proxy mode
# proxy_mode 1
# User which runs tentacle server in proxy mode. Required with if proxy mode is enable (by default babel)
# proxy_user pandora
# User the agent will run as
#pandora_user root

View File

@ -97,6 +97,12 @@ transfer_mode tentacle
# If set to 1 allows the agent to be configured via the web console (Only Enterprise version)
#remote_config 1
# If set to 1 start babel agent in proxy mode
# proxy_mode 1
# User which runs tentacle server in proxy mode. Required with if proxy mode is enable (by default babel)
# proxy_user pandora
# Number of threads to execute modules in parallel
#agent_threads 1

View File

@ -82,6 +82,12 @@ transfer_mode tentacle
# If set to 1 allows the agent to be configured via the web console (Only Enterprise version)
# remote_config 1
# If set to 1 start babel agent in proxy mode
# proxy_mode 1
# User which runs tentacle server in proxy mode. Required with if proxy mode is enable (by default babel)
# proxy_user pandora
# User the agent will run as
#pandora_user root

View File

@ -148,7 +148,9 @@ my %Conf = (
'agent_threads' => 1,
'udp_server_port' => 41122,
'udp_server_auth_address' => '0.0.0.0',
'udp_server' => 0
'udp_server' => 0,
'proxy_mode' => 0,
'proxy_user' => 'pandora'
);
# Modules
@ -608,6 +610,28 @@ sub check_remote_config () {
`renice "$Conf{'pandora_nice'}" "$PID"`;
}
################################################################################
# SUB launch_tentacle_proxy
# Launchs tentacle server in proxy mode.
################################################################################
sub launch_tentacle_proxy () {
# Check if proxy mode is enable.
if ($Conf{'proxy_mode'}) {
my $auxPid = fork();
if (! $auxPid) {
my $new_process = "sudo -u ".$Conf{'proxy_user'}." tentacle_server -b ".$Conf{'server_ip'}." -g ".$Conf{'server_port'};
log_message ('setup', 'Proxy mode enabled');
exec ($new_process);
}
}
}
################################################################################
# Delete old collections and download new collections.
################################################################################
@ -1379,6 +1403,9 @@ sleep ($Conf{'delayed_startup'});
my $PID = $$;
`renice "$Conf{'pandora_nice'}" "$PID"`;
#Launch tentacle server in proxy mode if needed
launch_tentacle_proxy();
# Add the plugins directory to the PATH
$ENV{'PATH'} .= ":$ConfDir/plugins";

View File

@ -23,6 +23,7 @@
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin
PANDORA_PATH=/etc/pandora
DAEMON=/usr/bin/pandora_agent
DAEMON_TENTACLE=/usr/bin/tentacle_server
LOGFILE=/var/log/pandora/pandora_agent.log
PANDORA_USER=root
@ -59,6 +60,19 @@ pidof_pandora () {
echo $PANDORA_PID
}
pidof_tentacle () {
COLUMNS=400
OS_NAME=`uname -s`
if [ $OS_NAME = "HP-UX" ]
then
TENTACLE_PID=`ps -ex | grep "$DAEMON_TENTACLE" | grep -v grep | head -1 | awk '{ print $1 }'`
else
TENTACLE_PID=`ps -Af | grep "$DAEMON_TENTACLE" | grep -v grep | head -1 | awk '{ print $2 }'`
fi
echo $TENTACLE_PID
}
if [ ! -f $DAEMON ]
then
echo "Pandora FMS Agent not found at $DAEMON, please check setup"
@ -90,6 +104,13 @@ case "$1" in
echo "Stopping Pandora Agent."
su $PANDORA_USER -c "kill -9 $PANDORA_PID >/dev/null 2>&1"
fi
TENTACLE_PID=`pidof_tentacle`
if [ ! -z "$TENTACLE_PID" ]
then
echo "Stopping Tentacle Server."
kill $TENTACLE_PID > /dev/null 2>&1
fi
;;
status)

View File

@ -23,6 +23,7 @@ PANDORA_CFG=/etc/pandora
PANDORA_LOG_DIR=/var/log/pandora
PANDORA_LOG=pandora_agent.log
TENTACLE=/usr/bin/tentacle_client
TENTACLE_SERVER=/usr/bin/tentacle_server
PANDORA_MAN=/usr/share/man
MODE=$1
@ -88,6 +89,7 @@ uninstall () {
PANDORA_EXEC_BIN=/usr/local/bin/pandora_agent_exec
PANDORA_CFG=/usr/local/etc/pandora
TENTACLE=/usr/local/bin/tentacle_client
TENTACLE_SERVER=/usr/local/bin/tentacle_server
PANDORA_MAN=/usr/local/man
fi
@ -102,6 +104,7 @@ uninstall () {
rm -Rf $PANDORA_BASE$PANDORA_TEMP/data_out 2> /dev/null
else
rm -Rf $PANDORA_BASE$PANDORA_TEMP 2> /dev/null
rm -Rf $PANDORA_BASE$TENTACLE_SERVER 2> /dev/null
fi
rm -Rf $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf 2> /dev/null
@ -161,6 +164,7 @@ install () {
PANDORA_EXEC_BIN=/usr/local/bin/pandora_agent_exec
PANDORA_CFG=/usr/local/etc/pandora
TENTACLE=/usr/local/bin/tentacle_client
TENTACLE_SERVER=/usr/local/bin/tentacle_server
PANDORA_MAN=/usr/local/man
fi
@ -318,6 +322,16 @@ install () {
chmod -R 700 $PANDORA_BASE$PANDORA_HOME/collections
ln -s $PANDORA_BASE$PANDORA_HOME/collections $PANDORA_BASE$PANDORA_CFG
echo "Copying tentacle server to $PANDORA_BASE$TENTACLE_SERVER"
cp tentacle_server $PANDORA_BASE$TENTACLE_SERVER
chmod 755 $PANDORA_BASE$TENTACLE_SERVER
if [ "$OS_NAME" = "FreeBSD" ]
then
chown $PANDORA_USER:wheel $PANDORA_BASE$TENTACLE_SERVER
else
chown $PANDORA_USER:0 $PANDORA_BASE$TENTACLE_SERVER
fi
echo "Copying tentacle client to $PANDORA_BASE$TENTACLE"
cp tentacle_client $PANDORA_BASE$TENTACLE
chmod 755 $PANDORA_BASE$TENTACLE

File diff suppressed because it is too large Load Diff