forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Logs Onboarding] Adds install shipper step for custom logs (elastic#…
…154937) (WIP)
- Loading branch information
Showing
12 changed files
with
516 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
x-pack/plugins/observability_onboarding/public/assets/standalone-agent-setup.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#!/bin/bash | ||
|
||
# Arguments | ||
# ELASTIC_HOST=$1 | ||
# ELASTIC_TOKEN=$2 | ||
|
||
# download and extract Elastic Agent | ||
# curl -L -O https://artifacts.elastic.co/downloads/beats/elastic-agent/elastic-agent-8.7.0-linux-x86_64.tar.gz | ||
# tar xzvf elastic-agent-8.7.0-linux-x86_64.tar.gz | ||
# cd elastic-agent-8.7.0-linux-x86_64 | ||
|
||
# install Elastic Agent | ||
# sudo ./elastic-agent install --url=$ELASTIC_HOST --enrollment-token=$ELASTIC_TOKEN | ||
|
||
## ➜ elastic-agent-8.7.1-linux-x86_64 sudo ./elastic-agent install | ||
## [sudo] password for oliver: | ||
## Elastic Agent will be installed at /opt/Elastic/Agent and will run as a service. Do you want to continue? [Y/n]:Y | ||
## Do you want to enroll this Agent into Fleet? [Y/n]:n | ||
## Elastic Agent has been successfully installed. | ||
|
||
# INSTALL_EXIT_CODE=$? | ||
|
||
# check the exit code to determine whether the installation was successful or not | ||
# if [ $INSTALL_EXIT_CODE -eq 0 ]; then | ||
# INSTALL_RESULT="success" | ||
# else | ||
# INSTALL_RESULT="failure" | ||
# fi | ||
|
||
# call the API with the installation result | ||
# curl -X POST "$KIBANA_HOST/api/observabilityOnboarding/agent-installation-status?host=$ELASTIC_HOST&token=$ELASTIC_TOKEN&result=$INSTALL_RESULT" | ||
|
||
######################## | ||
|
||
API_KEY_ENCODED=$1 | ||
STATUS_API_ENDPOINT=$2 | ||
|
||
pingKibana () { | ||
echo " GET $STATUS_API_ENDPOINT?ping=$1" | ||
curl --request GET \ | ||
--url "$STATUS_API_ENDPOINT?ping=$1" \ | ||
--header "Authorization: ApiKey $API_KEY_ENCODED" \ | ||
--header "Content-Type: application/json" \ | ||
--header "kbn-xsrf: true" | ||
echo "" | ||
} | ||
|
||
echo "Downloading Elastic Agent" | ||
curl -L -O https://artifacts.elastic.co/downloads/beats/elastic-agent/elastic-agent-8.7.1-linux-x86_64.tar.gz | ||
pingKibana "ea-download-success" | ||
echo "Extracting Elastic Agent" | ||
tar xzvf elastic-agent-8.7.1-linux-x86_64.tar.gz | ||
pingKibana "ea-extract-success" | ||
echo "Installing Elastic Agent" | ||
cd elastic-agent-8.7.1-linux-x86_64 | ||
./elastic-agent install -f | ||
pingKibana "ea-install-success" | ||
echo "Sending status to Kibana..." | ||
pingKibana "ea-status-active" |
Oops, something went wrong.