Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
saikumar-vs committed Feb 25, 2024
1 parent 00c3d45 commit 6b33600
Showing 1 changed file with 26 additions and 34 deletions.
60 changes: 26 additions & 34 deletions pmm-tests/pmm2-client-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,60 +72,52 @@ if [[ "$client_version" == 2* ]]; then
dpkg -i pmm2-client.deb
fi

# Default Binary path
## Default Binary path
path="/usr/local/percona/pmm2";
# As export PATH is not working link the paths
## As export PATH is not working link the paths
ln -sf ${path}/bin/pmm-admin /usr/local/bin/pmm-admin
ln -sf ${path}/bin/pmm-agent /usr/local/bin/pmm-agent

if [[ "$client_version" == http* ]]; then
if [[ "$install_client" == "yes" ]]; then
wget -O pmm2-client.tar.gz --progress=dot:giga "${client_version}"
fi
if [[ "$install_client" == "yes" ]]; then
wget -O pmm2-client.tar.gz --progress=dot:giga "${client_version}"
fi
tar -zxpf pmm2-client.tar.gz
rm -r pmm2-client.tar.gz
export PMM2_CLIENT=`ls -1td pmm2-client* 2>/dev/null | grep -v ".tar" | grep -v ".sh" | head -n1`
PMM2_CLIENT=`ls -1td pmm2-client* 2>/dev/null | grep -v ".tar" | grep -v ".sh" | head -n1`
echo ${PMM2_CLIENT}
rm -rf pmm2-client
mv ${PMM2_CLIENT} pmm2-client
mv pmm2-client /usr/local/bin
rm -rf /usr/local/bin/pmm2-client
mv -f pmm2-client /usr/local/bin
pushd /usr/local/bin/pmm2-client
## only setting up all binaries in default path /usr/local/percona/pmm2
bash -x ./install_tarball
## keep the pmm-admin & pmm-agent binaries in the /usr/local/bin path
export PMM_DIR=/usr/local
bash -x ./install_tarball
bash -x ./install_tarball ${upgrade}
pwd
popd
pmm-admin --version
fi

## Check if we are upgrading or attempting fresh install.
if [[ -z "$upgrade" ]]; then
if [[ "$use_metrics_mode" == "yes" ]]; then
echo "install pmm-agent 1"
pmm-agent setup --config-file=/usr/local/config/pmm-agent.yaml --server-address=${pmm_server_ip}:443 --server-insecure-tls --metrics-mode=${metrics_mode} --server-username=admin --server-password=${admin_password}
else
echo "install pmm-agent 2"
pmm-agent setup --config-file=/usr/local/config/pmm-agent.yaml --server-address=${pmm_server_ip}:443 --server-insecure-tls --server-username=admin --server-password=${admin_password}
fi
sleep 10
pmm-agent --config-file=/usr/local/config/pmm-agent.yaml > pmm-agent.log 2>&1 &
elif [[ -z "$upgrade" ]]; then
if [[ "$use_metrics_mode" == "yes" ]]; then
echo "install pmm-agent 3"
echo "setup pmm-agent"
pmm-agent setup --config-file=/usr/local/percona/pmm2/config/pmm-agent.yaml --server-address=${pmm_server_ip}:443 --server-insecure-tls --metrics-mode=${metrics_mode} --server-username=admin --server-password=${admin_password}
else
echo "install pmm-agent 4"
echo "setup pmm-agent"
pmm-agent setup --config-file=/usr/local/percona/pmm2/config/pmm-agent.yaml --server-address=${pmm_server_ip}:443 --server-insecure-tls --server-username=admin --server-password=${admin_password}
fi
sleep 10
pmm-agent --config-file=/usr/local/percona/pmm2/config/pmm-agent.yaml > pmm-agent.log 2>&1 &
fi

if [[ ! -z "$upgrade" ]]; then
pid=`ps -ef | grep pmm-agent | grep -v grep | awk -F ' ' '{print $2}'`
if [[ ! -z "$pid" ]]; then
kill -9 $pid
echo "killed old agent, restarting agent...."
pmm-agent --config-file=/usr/local/percona/pmm2/config/pmm-agent.yaml > pmm-agent.log 2>&1 &
sleep 10
fi
pmm-agent --config-file=/usr/local/percona/pmm2/config/pmm-agent.yaml > pmm-agent.log 2>&1 &
sleep 10
else
pid=`ps -ef | grep pmm-agent | grep -v grep | awk -F ' ' '{print $2}'`
if [[ ! -z "$pid" ]]; then
kill -9 $pid
echo "killed old agent, restarting agent...."
pmm-agent --config-file=/usr/local/percona/pmm2/config/pmm-agent.yaml > pmm-agent.log 2>&1 &
sleep 10
fi
fi
echo "pmm-admin status"
pmm-admin status

0 comments on commit 6b33600

Please sign in to comment.