Skip to content

Commit 80e1e8e

Browse files
committed
systemd.go: Do not report IPAccounting data when IPAccounting=no or irrelevant
Signed-off-by: j <[email protected]>
1 parent 969b9d9 commit 80e1e8e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

systemd/systemd.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -727,8 +727,11 @@ func (c *Collector) collectIPAccountingMetrics(conn *dbus.Conn, ch chan<- promet
727727
return fmt.Errorf(errConvertUint64PropertyMsg, propertyName, property.Value.Value())
728728
}
729729

730-
ch <- prometheus.MustNewConstMetric(desc, prometheus.CounterValue,
731-
float64(counter), unit.Name)
730+
// Don't set if dbus reports MaxUint64.
731+
if counter != math.MaxUint64 {
732+
ch <- prometheus.MustNewConstMetric(desc, prometheus.CounterValue,
733+
float64(counter), unit.Name)
734+
}
732735
}
733736

734737
return nil

0 commit comments

Comments
 (0)