Skip to content

Commit 0257fcf

Browse files
authored
Bugfix/session handling (#4)
Update from gofish 0.14 -> 0.20 There are lots of improvements. Let's get them.
1 parent e960426 commit 0257fcf

File tree

5 files changed

+37
-10
lines changed

5 files changed

+37
-10
lines changed

collector/chassis_collector.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ func parseChassisTemperature(ch chan<- prometheus.Metric, chassisID string, chas
267267
chassisTemperatureStatus := chassisTemperature.Status
268268
chassisTemperatureLabelvalues := []string{"temperature", chassisID, chassisTemperatureSensorName, chassisTemperatureSensorID}
269269

270-
chassisTemperatureStatusHealth :=chassisTemperatureStatus.Health
270+
chassisTemperatureStatusHealth := chassisTemperatureStatus.Health
271271
if chassisTemperatureStatusHealthValue, ok := parseCommonStatusHealth(chassisTemperatureStatusHealth); ok {
272272
ch <- prometheus.MustNewConstMetric(chassisMetrics["chassis_temperature_sensor_health"].desc, prometheus.GaugeValue, chassisTemperatureStatusHealthValue, chassisTemperatureLabelvalues...)
273273
}
@@ -283,7 +283,7 @@ func parseChassisTemperature(ch chan<- prometheus.Metric, chassisID string, chas
283283
ch <- prometheus.MustNewConstMetric(chassisMetrics["chassis_temperature_celsius"].desc, prometheus.GaugeValue, float64(chassisTemperatureReadingCelsius), chassisTemperatureLabelvalues...)
284284
}
285285

286-
func parseChassisFan(ch chan<- prometheus.Metric, chassisID string, chassisFan redfish.Fan, wg *sync.WaitGroup) {
286+
func parseChassisFan(ch chan<- prometheus.Metric, chassisID string, chassisFan redfish.ThermalFan, wg *sync.WaitGroup) {
287287
defer wg.Done()
288288
chassisFanID := chassisFan.MemberID
289289
chassisFanName := chassisFan.Name

collector/redfish_collector.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ func parseLinkStatus(status redfish.LinkStatus) (float64, bool) {
194194
return float64(0), false
195195
}
196196

197-
func parsePortLinkStatus(status redfish.PortLinkStatus) (float64, bool) {
197+
func parsePortLinkStatus(status redfish.NetworkPortLinkStatus) (float64, bool) {
198198
if bytes.Equal([]byte(status), []byte("Up")) {
199199
return float64(1), true
200200
}

config.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package main
22

33
import (
44
"fmt"
5-
"io/ioutil"
5+
"os"
66
"sync"
77

88
yaml "gopkg.in/yaml.v2"
@@ -27,7 +27,7 @@ type HostConfig struct {
2727
func (sc *SafeConfig) ReloadConfig(configFile string) error {
2828
var c = &Config{}
2929

30-
yamlFile, err := ioutil.ReadFile(configFile)
30+
yamlFile, err := os.ReadFile(configFile)
3131
if err != nil {
3232
return err
3333
}
@@ -71,7 +71,7 @@ func (sc *SafeConfig) HostConfigForGroup(group string) (*HostConfig, error) {
7171
return &HostConfig{}, fmt.Errorf("no credentials found for group %s", group)
7272
}
7373

74-
func (sc *SafeConfig) AppLogLevel() (string) {
74+
func (sc *SafeConfig) AppLogLevel() string {
7575
sc.Lock()
7676
defer sc.Unlock()
7777
logLevel := sc.C.Loglevel

go.mod

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,41 @@
11
module github.com/jenningsloy318/redfish_exporter
22

3-
go 1.12
3+
go 1.21
4+
5+
toolchain go1.23.4
46

57
require (
68
github.com/apex/log v1.9.0
79
github.com/go-kit/log v0.2.0
810
github.com/prometheus/client_golang v1.11.1
911
github.com/prometheus/common v0.26.0
1012
github.com/prometheus/exporter-toolkit v0.5.0
11-
github.com/stmcginnis/gofish v0.14.0
13+
github.com/stmcginnis/gofish v0.20.0
1214
gopkg.in/alecthomas/kingpin.v2 v2.2.6
1315
gopkg.in/yaml.v2 v2.4.0
1416
)
17+
18+
require (
19+
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect
20+
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d // indirect
21+
github.com/beorn7/perks v1.0.1 // indirect
22+
github.com/cespare/xxhash/v2 v2.1.1 // indirect
23+
github.com/go-kit/kit v0.10.0 // indirect
24+
github.com/go-logfmt/logfmt v0.5.1 // indirect
25+
github.com/golang/protobuf v1.4.3 // indirect
26+
github.com/jpillora/backoff v1.0.0 // indirect
27+
github.com/konsorten/go-windows-terminal-sequences v1.0.3 // indirect
28+
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
29+
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
30+
github.com/pkg/errors v0.9.1 // indirect
31+
github.com/prometheus/client_model v0.2.0 // indirect
32+
github.com/prometheus/procfs v0.6.0 // indirect
33+
github.com/sirupsen/logrus v1.6.0 // indirect
34+
golang.org/x/crypto v0.0.0-20201208171446-5f87f3452ae9 // indirect
35+
golang.org/x/net v0.0.0-20200625001655-4c5254603344 // indirect
36+
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421 // indirect
37+
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40 // indirect
38+
golang.org/x/text v0.3.2 // indirect
39+
google.golang.org/appengine v1.4.0 // indirect
40+
google.golang.org/protobuf v1.26.0-rc.1 // indirect
41+
)

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,8 @@ github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4k
289289
github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY=
290290
github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
291291
github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
292-
github.com/stmcginnis/gofish v0.14.0 h1:geECNAiG33JDB2x2xDkerpOOuXFqxp5YP3EFE3vd5iM=
293-
github.com/stmcginnis/gofish v0.14.0/go.mod h1:BLDSFTp8pDlf/xDbLZa+F7f7eW0E/CHCboggsu8CznI=
292+
github.com/stmcginnis/gofish v0.20.0 h1:hH2V2Qe898F2wWT1loApnkDUrXXiLKqbSlMaH3Y1n08=
293+
github.com/stmcginnis/gofish v0.20.0/go.mod h1:PzF5i8ecRG9A2ol8XT64npKUunyraJ+7t0kYMpQAtqU=
294294
github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
295295
github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
296296
github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI=

0 commit comments

Comments
 (0)