fix agent cfg path on macOS for standalone agent installer (#162659)

This commit is contained in:
Gil Raphaelli 2023-08-02 10:11:47 -04:00 committed by GitHub
parent 716fb1444d
commit 38b132e6cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -30,6 +30,7 @@ OS="$(uname)"
ARCH="$(uname -m)"
os=linux
arch=x86_64
cfg=/opt/Elastic/Agent/elastic-agent.yml
if [ "${OS}" == "Linux" ]; then
if [ "${ARCH}" == "aarch64" ]; then
arch=arm64
@ -39,6 +40,7 @@ elif [ "${OS}" == "Darwin" ]; then
if [ "${ARCH}" == "arm64" ]; then
arch=aarch64
fi
cfg=/Library/Elastic/Agent/elastic-agent.yml
else
fail "this script is only supported on linux and macOS"
fi
@ -126,7 +128,7 @@ ELASTIC_AGENT_STATE="$(elastic-agent status | grep -m1 State | sed 's/State: //'
ELASTIC_AGENT_MESSAGE="$(elastic-agent status | grep -m1 Message | sed 's/Message: //')"
if [ "${ELASTIC_AGENT_STATE}" = "HEALTHY" ] && [ "${ELASTIC_AGENT_MESSAGE}" = "Running" ]; then
echo "Elastic Agent running"
echo "Download and save configuration to /opt/Elastic/Agent/elastic-agent.yml"
echo "Download and save configuration to ${cfg}"
updateStepProgress "ea-status" "complete"
else
updateStepProgress "ea-status" "warning" "Expected agent status HEALTHY / Running but got ${ELASTIC_AGENT_STATE} / ${ELASTIC_AGENT_MESSAGE}"
@ -141,7 +143,7 @@ downloadElasticAgentConfig() {
--header "Content-Type: application/json" \
--header "kbn-xsrf: true" \
--no-progress-meter \
--output /opt/Elastic/Agent/elastic-agent.yml
--output ${cfg}
if [ "$?" -eq 0 ]; then
echo "Downloaded elastic-agent.yml"
@ -156,5 +158,5 @@ if [ "${AUTO_DOWNLOAD_CONFIG}" == "autoDownloadConfig=1" ]; then
downloadElasticAgentConfig
echo "Done with standalone Elastic Agent setup for custom logs. Look for streaming logs to arrive in Kibana"
else
echo "Done with standalone Elastic Agent setup for custom logs. Make sure to add your configuration to /opt/Elastic/Agent/elastic-agent.yml, then look for streaming logs to arrive in Kibana"
echo "Done with standalone Elastic Agent setup for custom logs. Make sure to add your configuration to ${cfg}, then look for streaming logs to arrive in Kibana"
fi