diff --git a/pandora_agents/unix/ChangeLog b/pandora_agents/unix/ChangeLog index 115ea1058a..544a5cd0fa 100644 --- a/pandora_agents/unix/ChangeLog +++ b/pandora_agents/unix/ChangeLog @@ -1,3 +1,11 @@ +2013-02-27 Tomas Palacios + + * pandora_agent_installer: Added compatibility for custom perl + installation paths. + + * pandora_agent_daemon: Modified the way to find SunOS agent PID + to make it more reliable. + 2013-02-22 Sancho Lerena * Darwrin: Added Darwin (MacOS) agent on directory, i don't @@ -9,7 +17,7 @@ 2013-02-12 Hirofumi Kosaka - * pandora_agent: Fixed bug that data transfer would fail + * pandora_agent: Fixed bug that data transfer would fail when secondary_transfer_mode is different from transfer_mode. 2013-01-17 Ramon Novoa diff --git a/pandora_agents/unix/pandora_agent_daemon b/pandora_agents/unix/pandora_agent_daemon index c237568600..6ec7b1f126 100755 --- a/pandora_agents/unix/pandora_agent_daemon +++ b/pandora_agents/unix/pandora_agent_daemon @@ -39,7 +39,7 @@ pidof_pandora () { if [ "$OS_NAME" = "SunOS" ] then ZONENAME_CMD="/bin/zonename" - TRUNCATED_DAEMON=`echo "$DAEMON $PANDORA_PATH" | cut -c1-40` + TRUNCATED_DAEMON=`echo "$DAEMON $PANDORA_PATH" | cut -c1-20` if [ -x $ZONENAME_CMD ] then ZONE=`$ZONENAME_CMD` diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index 947e991ad7..0fff6a33a0 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -35,8 +35,21 @@ else PANDORA_USER="root" fi +if [ "$4" != "" ] +then + PANDORA_PERL_PATH=$4 + echo $PANDORA_PERL_PATH > PANDORA_PERL_PATH.temp + sed 's/\//\\\//g' PANDORA_PERL_PATH.temp > PANDORA_PERL_PATH.temp2 + + PANDORA_PERL_DECODED_PATH=`cat PANDORA_PERL_PATH.temp2` + rm PANDORA_PERL_PATH.temp PANDORA_PERL_PATH.temp2 + #PANDORA_PERL_DECODED_PATH=`echo $PANDORA_PERL_PATH | sed -e "s.\/.\\\\\/.g"` +else + PANDORA_PERL_PATH="perl" +fi + # Check for Perl 5.6.x or higher available -PERL_VERSION=`perl -v | egrep 'v5.6|v5.7|v5.8|v5.9|v5.1[0-9]' | grep perl` +PERL_VERSION=`$PANDORA_PERL_PATH -v | egrep 'v5.6|v5.7|v5.8|v5.9|v5.1[0-9]' | grep perl` if [ -z "$PERL_VERSION" ] then @@ -68,7 +81,7 @@ fi help () { echo "Syntax": echo " " - echo " ./pandora_agent_installer < --mode > [ destination_path ] [ user_to_run_as ]" + echo " ./pandora_agent_installer < --mode > [ destination_path ] [ user_to_run_as ] [custom_perl_path]" echo " " echo "Modes:" echo " " @@ -81,6 +94,7 @@ help () { echo " ./pandora_agent_installer --install" echo " ./pandora_agent_installer --install /opt/pandora" echo " ./pandora_agent_installer --install \"\" pandora" + echo " ./pandora_agent_installer --install /opt/pandora root /opt/pandora/perl5/usr/local/bin/perl" echo " ./pandora_agent_installer --uninstall /opt/pandora" echo " " } @@ -247,6 +261,9 @@ install () { sed -e "s/^DAEMON\=[.]*/DAEMON\=$PANDORA_BASE_DECODED/g" $DAEMON_SCRIPT > $DAEMON_TEMP mv $DAEMON_TEMP $DAEMON_SCRIPT + + sed -e "s/^DAEMON_TENTACLE\=[.]*/DAEMON_TENTACLE\=$PANDORA_BASE_DECODED/g" $DAEMON_SCRIPT > $DAEMON_TEMP + mv $DAEMON_TEMP $DAEMON_SCRIPT sed -e "s/^PANDORA_USER\=.*/PANDORA_USER\=$PANDORA_USER/g" $DAEMON_SCRIPT > $DAEMON_TEMP mv $DAEMON_TEMP $DAEMON_SCRIPT @@ -301,9 +318,20 @@ install () { # Copying agent and securing it echo "Copying Pandora FMS Agent to $PANDORA_BASE$PANDORA_BIN..." - cp pandora_agent $PANDORA_BASE$PANDORA_BIN + + if [ "$PANDORA_PERL_DECODED_PATH" != "" ] + then + sed -e "s:^#\!.*:#\!$PANDORA_PERL_DECODED_PATH:g" pandora_agent > $PANDORA_BASE$PANDORA_BIN + else + cp pandora_agent $PANDORA_BASE$PANDORA_BIN + fi chmod 755 $PANDORA_BASE$PANDORA_BIN - cp pandora_agent_exec $PANDORA_BASE$PANDORA_EXEC_BIN + if [ "$PANDORA_PERL_DECODED_PATH" != "" ] + then + sed -e "s:^#\!.*:#\!$PANDORA_PERL_DECODED_PATH:g" pandora_agent_exec > $PANDORA_BASE$PANDORA_EXEC_BIN + else + cp pandora_agent_exec $PANDORA_BASE$PANDORA_EXEC_BIN + fi chmod 755 $PANDORA_BASE$PANDORA_EXEC_BIN chown $PANDORA_USER:0 $PANDORA_BASE$PANDORA_BIN chown $PANDORA_USER:0 $PANDORA_BASE$PANDORA_EXEC_BIN @@ -326,12 +354,22 @@ install () { 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 + if [ "$PANDORA_PERL_DECODED_PATH" != "" ] + then + sed -e "s:^#\!.*:#\!$PANDORA_PERL_DECODED_PATH:g" tentacle_server > $PANDORA_BASE$TENTACLE_SERVER + else + cp tentacle_server $PANDORA_BASE$TENTACLE_SERVER + fi chmod 755 $PANDORA_BASE$TENTACLE_SERVER chown $PANDORA_USER:0 $PANDORA_BASE$TENTACLE_SERVER echo "Copying tentacle client to $PANDORA_BASE$TENTACLE" - cp tentacle_client $PANDORA_BASE$TENTACLE + if [ "$PANDORA_PERL_DECODED_PATH" != "" ] + then + sed -e "s:^#\!.*:#\!$PANDORA_PERL_DECODED_PATH:g" tentacle_client > $PANDORA_BASE$TENTACLE + else + cp tentacle_client $PANDORA_BASE$TENTACLE + fi chmod 755 $PANDORA_BASE$TENTACLE chown $PANDORA_USER:0 $PANDORA_BASE$TENTACLE