Skip to content

Commit

Permalink
Add Main Board Leak Status for Inspur's Server.
Browse files Browse the repository at this point in the history
Signed-off-by: yanghesong <hesong.yang@foxmail.com>
  • Loading branch information
yanghesong committed Sep 6, 2022
1 parent ff09aee commit c9fe61d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions collector_sel.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ var (
[]string{},
nil,
)
selMBLeakStatusDesc = prometheus.NewDesc(
prometheus.BuildFQName(namespace, "sel", "mb_leak_status"),
"Current Assertion Event for MB Leak Status.",
[]string{},
nil,
)
)

type SELCollector struct{}
Expand Down Expand Up @@ -60,15 +66,24 @@ func (c SELCollector) Collect(result freeipmi.Result, ch chan<- prometheus.Metri

stringItem := strings.Split(string(result.Output), "\n")
var gpuLeakCount = 0
var mbLeakCount = 0
for _, value := range stringItem {
if strings.Contains(value, "GPU_Leak_Status") && strings.Contains(value, "Assertion") {
gpuLeakCount++
}
if strings.Contains(value, "MB_Leak_Status") && strings.Contains(value, "Assertion") {
mbLeakCount++
}
}
ch <- prometheus.MustNewConstMetric(
selGpuLeakStatusDesc,
prometheus.GaugeValue,
float64(gpuLeakCount),
)
ch <- prometheus.MustNewConstMetric(
selMBLeakStatusDesc,
prometheus.GaugeValue,
float64(mbLeakCount),
)
return 1, nil
}

0 comments on commit c9fe61d

Please sign in to comment.