diff options
Diffstat (limited to 'collector/ipvs_linux.go')
-rw-r--r-- | collector/ipvs_linux.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/collector/ipvs_linux.go b/collector/ipvs_linux.go index b5c8d73..c2e9d70 100644 --- a/collector/ipvs_linux.go +++ b/collector/ipvs_linux.go | |||
@@ -16,6 +16,7 @@ | |||
16 | package collector | 16 | package collector |
17 | 17 | ||
18 | import ( | 18 | import ( |
19 | "errors" | ||
19 | "fmt" | 20 | "fmt" |
20 | "os" | 21 | "os" |
21 | "sort" | 22 | "sort" |
@@ -140,11 +141,11 @@ func (c *ipvsCollector) Update(ch chan<- prometheus.Metric) error { | |||
140 | ipvsStats, err := c.fs.IPVSStats() | 141 | ipvsStats, err := c.fs.IPVSStats() |
141 | if err != nil { | 142 | if err != nil { |
142 | // Cannot access ipvs metrics, report no error. | 143 | // Cannot access ipvs metrics, report no error. |
143 | if os.IsNotExist(err) { | 144 | if errors.Is(err, os.ErrNotExist) { |
144 | level.Debug(c.logger).Log("msg", "ipvs collector metrics are not available for this system") | 145 | level.Debug(c.logger).Log("msg", "ipvs collector metrics are not available for this system") |
145 | return ErrNoData | 146 | return ErrNoData |
146 | } | 147 | } |
147 | return fmt.Errorf("could not get IPVS stats: %s", err) | 148 | return fmt.Errorf("could not get IPVS stats: %w", err) |
148 | } | 149 | } |
149 | ch <- c.connections.mustNewConstMetric(float64(ipvsStats.Connections)) | 150 | ch <- c.connections.mustNewConstMetric(float64(ipvsStats.Connections)) |
150 | ch <- c.incomingPackets.mustNewConstMetric(float64(ipvsStats.IncomingPackets)) | 151 | ch <- c.incomingPackets.mustNewConstMetric(float64(ipvsStats.IncomingPackets)) |
@@ -154,7 +155,7 @@ func (c *ipvsCollector) Update(ch chan<- prometheus.Metric) error { | |||
154 | 155 | ||
155 | backendStats, err := c.fs.IPVSBackendStatus() | 156 | backendStats, err := c.fs.IPVSBackendStatus() |
156 | if err != nil { | 157 | if err != nil { |
157 | return fmt.Errorf("could not get backend status: %s", err) | 158 | return fmt.Errorf("could not get backend status: %w", err) |
158 | } | 159 | } |
159 | 160 | ||
160 | sums := map[string]ipvsBackendStatus{} | 161 | sums := map[string]ipvsBackendStatus{} |