Add NTP stratum to NTP collector
This commit is contained in:
parent
d4799999fc
commit
fc3a7b7a97
|
@ -30,7 +30,8 @@ var (
|
|||
)
|
||||
|
||||
type ntpCollector struct {
|
||||
drift prometheus.Gauge
|
||||
drift prometheus.Gauge
|
||||
stratum prometheus.Gauge
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
@ -53,6 +54,11 @@ func NewNtpCollector() (Collector, error) {
|
|||
Name: "ntp_drift_seconds",
|
||||
Help: "Time between system time and ntp time.",
|
||||
}),
|
||||
stratum: prometheus.NewGauge(prometheus.GaugeOpts{
|
||||
Namespace: Namespace,
|
||||
Name: "ntp_stratum",
|
||||
Help: "NTP server stratum.",
|
||||
}),
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
@ -65,5 +71,10 @@ func (c *ntpCollector) Update(ch chan<- prometheus.Metric) (err error) {
|
|||
log.Debugf("Set ntp_drift_seconds: %f", driftSeconds)
|
||||
c.drift.Set(driftSeconds)
|
||||
c.drift.Collect(ch)
|
||||
return err
|
||||
|
||||
stratum := float64(resp.Stratum)
|
||||
log.Debugf("Set ntp_stratum: %f", stratum)
|
||||
c.stratum.Set(stratum)
|
||||
c.stratum.Collect(ch)
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue