Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix AMS installation script - it fails if grafana succeeds on first a… #297

Merged
merged 1 commit into from
Apr 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions src/cmdClientDoAMS.go
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,7 @@ EOF

func (c *clientAddAMSCmd) installScript() string {
return `function grafana() {
set -x
set -e
mkdir -p /etc/apt/keyrings/
wget -q -O - https://apt.grafana.com/gpg.key | gpg --dearmor > /etc/apt/keyrings/grafana.gpg
Expand All @@ -673,6 +674,7 @@ func (c *clientAddAMSCmd) installScript() string {
}

function grafana_fallback() {
set -x
set -e
platform=amd64
[[ $(uname -m) =~ arm ]] && platform=arm64
Expand All @@ -682,14 +684,24 @@ function grafana_fallback() {
dpkg -i grafana_10.4.1_${platform}.deb
}

set -x
set -e
apt-get update
apt-get -y install prometheus apt-transport-https software-properties-common wget

set +e
ret=$(grafana)
[ $? -ne 0 ] && ret=$(grafana_fallback)
[ $? -ne 0 ] && exit 1
if [ $? -ne 0 ]
then
echo ${ret}
echo "WARNING: Grafana failed to install from apt repos, trying manual download"
ret=$(grafana_fallback)
if [ $? -ne 0 ]
then
echo ${ret}
exit 1
fi
fi

set -e
wget -q -O /etc/prometheus/aerospike_rules.yaml https://raw.githubusercontent.com/aerospike/aerospike-monitoring/master/config/prometheus/aerospike_rules.yml
Expand Down
Loading