diff --git a/zfs_replication_exporter.go b/zfs_replication_exporter.go index dc6bccc..857b54c 100644 --- a/zfs_replication_exporter.go +++ b/zfs_replication_exporter.go @@ -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 }