Merge pull request #95 from lnicolas83/add_cpu-temperature

Add cpu-temperature to health collector
This commit is contained in:
Steve Brunton 2021-03-22 22:51:29 -04:00 committed by GitHub
commit ac29090723
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,10 +21,10 @@ func newhealthCollector() routerOSCollector {
}
func (c *healthCollector) init() {
c.props = []string{"voltage", "temperature"}
c.props = []string{"voltage", "temperature", "cpu-temperature"}
labelNames := []string{"name", "address"}
helpText := []string{"Input voltage to the RouterOS board, in volts", "Temperature of RouterOS board, in degrees Celsius"}
helpText := []string{"Input voltage to the RouterOS board, in volts", "Temperature of RouterOS board, in degrees Celsius", "Temperature of RouterOS CPU, in degrees Celsius"}
c.descriptions = make(map[string]*prometheus.Desc)
for i, p := range c.props {
c.descriptions[p] = descriptionForPropertyNameHelpText("health", p, labelNames, helpText[i])
@ -64,7 +64,7 @@ func (c *healthCollector) fetch(ctx *collectorContext) ([]*proto.Sentence, error
}
func (c *healthCollector) collectForStat(re *proto.Sentence, ctx *collectorContext) {
for _, p := range c.props[:2] {
for _, p := range c.props[:3] {
c.collectMetricForProperty(p, re, ctx)
}
}