Skip to content

Commit

Permalink
exporter fix downloader for arm v
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Glonek committed Nov 17, 2022
1 parent d23acba commit 1607877
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 11 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
* Add support for exporter on `arm`
* Test all `arm` features on clients

#### 4.3.6
* small improvement in exporter installation procedure
* change exporter download URL to use artifacts download URLs

#### 4.3.5
* added option `template vacuum` to remove any leftover template containers/instances from failed template creation
* template vacuuming will auto-run if templating fails, unless `--no-vacuum` is specified
Expand Down
2 changes: 1 addition & 1 deletion VERSION.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.3.5
4.3.6
2 changes: 2 additions & 0 deletions src/aerospikeDownloadUrls.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ var communityUrls = []string{
"https://download.aerospike.com/artifacts/aerospike-server-community/",
}

var promUrl = "https://download.aerospike.com/artifacts/aerospike-prometheus-exporter/"

var enterpriseUrl = enterpriseUrls[1]

var communityUrl = communityUrls[1]
45 changes: 36 additions & 9 deletions src/cmdClusterAddExporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,33 +24,60 @@ func (c *clusterAddExporterCmd) Execute(args []string) error {
return err
}

//noarm
//arms
armlist := []int{}
amdlist := []int{}
for _, cluster := range cList {
nlist := nodes[cluster]
newnlist := []int{}
for _, node := range nlist {
isArm, err := b.IsNodeArm(cluster, node)
if err != nil {
return err
}
if isArm {
log.Printf("Skipping arm machine %s:%v", cluster, node)
armlist = append(armlist, node)
} else {
newnlist = append(newnlist, node)
amdlist = append(amdlist, node)
}
}
nodes[cluster] = newnlist
}

// install
// find url
pUrl, pV, err := aeroFindUrlX(promUrl, "latest", "", "")
if err != nil {
return fmt.Errorf("could not locate prometheus url: %s", err)
}
log.Printf("Installing version %s of prometheus exporter", pV)
pUrlAmd := pUrl + "aerospike-prometheus-exporter_" + pV + "_x86_64.tar.gz"
pUrlArm := pUrl + "aerospike-prometheus-exporter_" + pV + "_aarch64.tar.gz"

// install amd
commands := [][]string{
[]string{"/bin/bash", "-c", "kill $(pidof aerospike-prometheus-exporter); sleep 2; kill -9 $(pidof aerospike-prometheus-exporter) || exit 0"},
[]string{"wget", "https://www.aerospike.com/download/monitoring/aerospike-prometheus-exporter/latest/artifact/tgz", "-O", "/aerospike-prometheus-exporter.tgz"},
[]string{"/bin/bash", "-c", "kill $(pidof aerospike-prometheus-exporter) >/dev/null 2>&1; sleep 2; kill -9 $(pidof aerospike-prometheus-exporter) >/dev/null 2>&1 || exit 0"},
[]string{"wget", pUrlAmd, "-O", "/aerospike-prometheus-exporter.tgz"},
[]string{"/bin/bash", "-c", "cd / && tar -xvzf aerospike-prometheus-exporter.tgz"},
[]string{"/bin/bash", "-c", "mkdir -p /opt/autoload && echo \"pidof aerospike-prometheus-exporter; [ \\$? -eq 0 ] && exit 0; bash -c 'nohup aerospike-prometheus-exporter --config /etc/aerospike-prometheus-exporter/ape.toml >/var/log/exporter.log 2>&1 & jobs -p %1'\" > /opt/autoload/01-exporter; chmod 755 /opt/autoload/01-exporter"},
}
for _, cluster := range cList {
out, err := b.RunCommands(cluster, commands, nodes[cluster])
out, err := b.RunCommands(cluster, commands, amdlist)
if err != nil {
nout := ""
for _, n := range out {
nout = nout + "\n" + string(n)
}
return fmt.Errorf("error on cluster %s: %s: %s", cluster, nout, err)
}
}

// install arm
commands = [][]string{
[]string{"/bin/bash", "-c", "kill $(pidof aerospike-prometheus-exporter) >/dev/null 2>&1; sleep 2; kill -9 $(pidof aerospike-prometheus-exporter) >/dev/null 2>&1 || exit 0"},
[]string{"wget", pUrlArm, "-O", "/aerospike-prometheus-exporter.tgz"},
[]string{"/bin/bash", "-c", "cd / && tar -xvzf aerospike-prometheus-exporter.tgz"},
[]string{"/bin/bash", "-c", "mkdir -p /opt/autoload && echo \"pidof aerospike-prometheus-exporter; [ \\$? -eq 0 ] && exit 0; bash -c 'nohup aerospike-prometheus-exporter --config /etc/aerospike-prometheus-exporter/ape.toml >/var/log/exporter.log 2>&1 & jobs -p %1'\" > /opt/autoload/01-exporter; chmod 755 /opt/autoload/01-exporter"},
}
for _, cluster := range cList {
out, err := b.RunCommands(cluster, commands, armlist)
if err != nil {
nout := ""
for _, n := range out {
Expand Down
3 changes: 3 additions & 0 deletions src/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,10 @@ func aeroFindInstallers(baseUrl string, user string, pass string) ([]*dlVersion,
}

func aeroFindUrl(version string, user string, pass string) (url string, v string, err error) {
return aeroFindUrlX(enterpriseUrl, version, user, pass)
}

func aeroFindUrlX(enterpriseUrl string, version string, user string, pass string) (url string, v string, err error) {
var baseUrl string
partversion := ""
if strings.HasSuffix(version, "*") {
Expand Down
2 changes: 1 addition & 1 deletion src/version.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package main

var version = "v4.3.5"
var version = "v4.3.6"

var simulateArmInstaller = false

0 comments on commit 1607877

Please sign in to comment.