Skip to content

Commit 6095a30

Browse files
authored
Merge pull request #45 from NETWAYS/dependabot/go_modules/github.com/NETWAYS/go-check-0.6.2
Bump github.com/NETWAYS/go-check from 0.6.1 to 0.6.2
2 parents d500b61 + 63b7ee4 commit 6095a30

File tree

5 files changed

+12
-14
lines changed

5 files changed

+12
-14
lines changed

cmd/health.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Ready: Checks the readiness of an endpoint, which returns OK if the Prometheus s
4646
check.ExitError(fmt.Errorf(output))
4747
}
4848
p := perfdata.PerfdataList{
49-
{Label: "statuscode", Value: sc},
49+
{Label: "statuscode", Value: float64(sc)},
5050
}
5151

5252
check.ExitRaw(rc, output, "|", p.String())
@@ -68,10 +68,6 @@ Ready: Checks the readiness of an endpoint, which returns OK if the Prometheus s
6868

6969
p := perfdata.PerfdataList{
7070
{Label: "statuscode", Value: 200},
71-
{Label: "version", Value: info.Version},
72-
{Label: "builddate", Value: info.BuildDate},
73-
{Label: "builduser", Value: info.BuildUser},
74-
{Label: "revision", Value: info.Revision},
7571
}
7672

7773
check.ExitRaw(rc, output, "|", p.String())
@@ -85,7 +81,7 @@ Ready: Checks the readiness of an endpoint, which returns OK if the Prometheus s
8581
}
8682

8783
p := perfdata.PerfdataList{
88-
{Label: "statuscode", Value: sc},
84+
{Label: "statuscode", Value: float64(sc)},
8985
}
9086

9187
check.ExitRaw(rc, output, "|", p.String())

cmd/health_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func TestHealthCmd(t *testing.T) {
6565
w.Write([]byte(`{"status":"success","data":{"version":"2.30.3","revision":"foo","branch":"HEAD","buildUser":"root@foo","buildDate":"20211005-16:10:52","goVersion":"go1.17.1"}}`))
6666
})),
6767
args: []string{"run", "../main.go", "health", "--info"},
68-
expected: "[OK] - Prometheus Server information\n\nVersion: 2.30.3\nBranch: HEAD\nBuildDate: 20211005-16:10:52\nBuildUser: root@foo\nRevision: foo | statuscode=200 version=2.30.3 builddate=20211005-16:10:52 builduser=root@foo revision=foo\n",
68+
expected: "[OK] - Prometheus Server information\n\nVersion: 2.30.3\nBranch: HEAD\nBuildDate: 20211005-16:10:52\nBuildUser: root@foo\nRevision: foo | statuscode=200\n",
6969
},
7070
{
7171
name: "health-bearer-ok",

cmd/query.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func generateMetricOutput(rc int, metric string, value string) string {
3434
return fmt.Sprintf(" \\_[%s] %s - value: %s\n", check.StatusText(rc), metric, value)
3535
}
3636

37-
func generatePerfdata(metric, value string, warning, critical *check.Threshold) perfdata.Perfdata {
37+
func generatePerfdata(metric string, value float64, warning, critical *check.Threshold) perfdata.Perfdata {
3838
// We trim the trailing "} from the string, so that the Perfdata won't have a trailing _
3939
return perfdata.Perfdata{
4040
Label: replacer.Replace(metric),
@@ -138,7 +138,7 @@ Note: Time range values e.G. 'go_memstats_alloc_bytes_total[0s]' only the latest
138138
metricOutput.WriteString(generateMetricOutput(rc, sample.Metric.String(), sample.Value.String()))
139139

140140
// Generate Perfdata from API return
141-
perf := generatePerfdata(sample.Metric.String(), sample.Value.String(), warn, crit)
141+
perf := generatePerfdata(sample.Metric.String(), float64(sample.Value), warn, crit)
142142
perfList.Add(&perf)
143143
}
144144
states = vStates
@@ -172,7 +172,7 @@ Note: Time range values e.G. 'go_memstats_alloc_bytes_total[0s]' only the latest
172172
metricOutput.WriteString(generateMetricOutput(rc, samplepair.String(), samplepair.Value.String()))
173173

174174
// Generate Perfdata from API return
175-
perf := generatePerfdata(samplestream.Metric.String(), samplepair.Value.String(), warn, crit)
175+
perf := generatePerfdata(samplestream.Metric.String(), float64(samplepair.Value), warn, crit)
176176
perfList.Add(&perf)
177177
}
178178
states = mStates

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/NETWAYS/check_prometheus
33
go 1.21
44

55
require (
6-
github.com/NETWAYS/go-check v0.6.1
6+
github.com/NETWAYS/go-check v0.6.2
77
github.com/prometheus/client_golang v1.19.1
88
github.com/prometheus/common v0.53.0
99
github.com/spf13/cobra v1.8.1

go.sum

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
github.com/NETWAYS/go-check v0.6.1 h1:fwya2nBWoRTUt2U6j3BCe0aUvNw+EbFYji4t1JrloC4=
2-
github.com/NETWAYS/go-check v0.6.1/go.mod h1:3G1p9ZCv41UcKirl+nZWne8oKVPUY5HbtyjRwGgyw6A=
1+
github.com/NETWAYS/go-check v0.6.2 h1:H/9Q/+rVzLbSUV/6QS9eDhyMUml7sf67TF4nSuHBwJo=
2+
github.com/NETWAYS/go-check v0.6.2/go.mod h1:qx8m3s2Xul9wqfUjrCSArEFkOdtwxIyUmBYYrCkqA/8=
33
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
44
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
55
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
@@ -54,11 +54,13 @@ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An
5454
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
5555
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
5656
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
57+
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
5758
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
5859
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
5960
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
60-
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
6161
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
62+
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
63+
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
6264
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
6365
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
6466
golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs=

0 commit comments

Comments
 (0)