Export timestamp in addition to age for snapshots.
This commit is contained in:
parent
0a8d33ce8d
commit
d526a04717
@ -43,6 +43,12 @@ var (
|
||||
},
|
||||
[]string{"host", "filesystem"},
|
||||
)
|
||||
snapshotTimestampMetric = prometheus.NewGaugeVec(prometheus.GaugeOpts{
|
||||
Name: "zfs_snapshot_timestamp_seconds",
|
||||
Help: "Most recent snapshot timestamp for `filesystem` UNIX epoch seconds",
|
||||
},
|
||||
[]string{"host", "filesystem"},
|
||||
)
|
||||
snapshotCountsMetrics = prometheus.NewGaugeVec(prometheus.GaugeOpts{
|
||||
Name: "zfs_snapshot_count",
|
||||
Help: "Count of snapshots per-filesystem",
|
||||
@ -54,6 +60,7 @@ var (
|
||||
func init() {
|
||||
prometheus.MustRegister(fetchRequestDurationMetric)
|
||||
prometheus.MustRegister(snapshotAgesMetric)
|
||||
prometheus.MustRegister(snapshotTimestampMetric)
|
||||
prometheus.MustRegister(snapshotCountsMetrics)
|
||||
}
|
||||
|
||||
@ -149,6 +156,7 @@ func updateMetrics(host string, c *ssh.Client) error {
|
||||
}
|
||||
for filesystem, snapshotTime := range snapshotAges {
|
||||
snapshotAgesMetric.WithLabelValues(host, filesystem).Set(now.Sub(snapshotTime).Seconds())
|
||||
snapshotTimestampMetric.WithLabelValues(host, filesystem).Set(float64(snapshotTime.Unix()))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user