Skip to content

Commit 7d1bcb8

Browse files
authored
Merge pull request #28 from chrroberts-pure/issue14
Fix Alerts Labels - Issue 14
2 parents 963a45e + 322c34c commit 7d1bcb8

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ GOTEST=$(GOCMD) test
44
GOVET=$(GOCMD) vet
55
BINARY_NAME=pure-fa-om-exporter
66
MODULE_NAME=go mod init purestorage/fa-openmetrics-exporter
7-
VERSION?=1.0.2
7+
VERSION?=1.0.3
88
SERVICE_PORT?=9490
99
DOCKER_REGISTRY?= quay.io/purestorage/
1010
EXPORT_RESULT?=false # for CI please set EXPORT_RESULT to true

cmd/fa-om-exporter/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
"github.com/prometheus/client_golang/prometheus/promhttp"
1515
)
1616

17-
var version string = "1.0.2"
17+
var version string = "1.0.3"
1818
var debug bool = false
1919

2020
func main() {
@@ -86,7 +86,7 @@ func metricsHandler(w http.ResponseWriter, r *http.Request) {
8686

8787
registry := prometheus.NewRegistry()
8888
faclient := client.NewRestClient(endpoint, apitoken, apiver, debug)
89-
if faclient.Error != nil {
89+
if faclient.Error != nil {
9090
http.Error(w, "Error connecting to FlashArray. Check your management endpoint and/or api token are correct.", http.StatusBadRequest)
9191
return
9292
}

internal/openmetrics-exporter/alerts_collector.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
package collectors
22

3-
43
import (
54
"fmt"
5+
client "purestorage/fa-openmetrics-exporter/internal/rest-client"
66
"strings"
77

88
"github.com/prometheus/client_golang/prometheus"
9-
"purestorage/fa-openmetrics-exporter/internal/rest-client"
109
)
1110

1211
type AlertsCollector struct {
@@ -25,7 +24,7 @@ func (c *AlertsCollector) Collect(ch chan<- prometheus.Metric) {
2524
}
2625
al := make(map[string]float64)
2726
for _, alert := range alerts.Items {
28-
al[fmt.Sprintf("%s,%s,%s", alert.Severity, alert.ComponentType, alert.ComponentName)] += 1
27+
al[fmt.Sprintf("%s,%s,%s", alert.ComponentName, alert.ComponentType, alert.Severity)] += 1
2928
}
3029
for a, n := range al {
3130
alert := strings.Split(a, ",")

0 commit comments

Comments
 (0)