fix(go.d/megacli): handle BBU hardware component is not present (#20008)
Ilya Mashchenko committed
Mar 31, 2025 at 14:14 UTC
fd97fd9c050a6e7d1d564941a2b8728565108e5f
2 files changed
+8
-2
src/go/plugin/go.d/collector/megacli/collect.go
+6
-2
@@ -15,8 +15,12 @@ func (c *Collector) collect() (map[string]int64, error) {
15
if err := c.collectPhysDrives(mx); err != nil {
16
return nil, err
17
}
18
- if err := c.collectBBU(mx); err != nil {
19
- return nil, err
18
+
19
+ if c.doBBU {
20
+ if err := c.collectBBU(mx); err != nil {
21
+ c.doBBU = false
22
+ c.Warningf("BBU collection failed, disabling it: %v", err)
23
+ }
24
}
25
26
return mx, nil
src/go/plugin/go.d/collector/megacli/collector.go
+2
@@ -38,6 +38,7 @@ func New() *Collector {
38
adapters: make(map[string]bool),
39
drives: make(map[string]bool),
40
bbu: make(map[string]bool),
41
+ doBBU: true,
42
}
43
}
44
@@ -57,6 +58,7 @@ type Collector struct {
58
adapters map[string]bool
59
drives map[string]bool
60
bbu map[string]bool
61
+ doBBU bool
62
}
63
64
func (c *Collector) Configuration() any {