Split out linux counts.
This commit is contained in:
parent
7ae07d5447
commit
6899f331d6
@ -115,6 +115,9 @@ type filesystemStat struct {
|
||||
// FreenasCounts is the number of snapshots matching freenas' auto-snapshot
|
||||
// names.
|
||||
FreenasCounts int
|
||||
// LinuxCounts is the number of snapshots matching linux' auto-snapshot
|
||||
// names.
|
||||
LinuxCounts int
|
||||
}
|
||||
type snapshotStats map[filesystemName]*filesystemStat
|
||||
|
||||
@ -176,7 +179,7 @@ func fetchSnapshotStats(host string, c *ssh.Client) (snapshotStats, error) {
|
||||
continue
|
||||
}
|
||||
glog.V(3).Infof("filesystem: %s timestamp %v", l, t)
|
||||
stats[name].FreenasCounts++
|
||||
stats[name].LinuxCounts++
|
||||
snapshotTime := stats[name].Timestamp
|
||||
glog.V(3).Infof("snapshotTime.Before(t) = %v snapshotTime: %v t: %v", snapshotTime.Before(t), snapshotTime, t)
|
||||
if snapshotTime.Before(t) {
|
||||
@ -197,6 +200,7 @@ func updateMetrics(host string, stats snapshotStats) {
|
||||
for filesystem, stat := range stats {
|
||||
snapshotCountsMetrics.WithLabelValues(host, string(filesystem), "all").Set(float64(stat.Counts))
|
||||
snapshotCountsMetrics.WithLabelValues(host, string(filesystem), "freenas").Set(float64(stat.FreenasCounts))
|
||||
snapshotCountsMetrics.WithLabelValues(host, string(filesystem), "linux").Set(float64(stat.LinuxCounts))
|
||||
snapshotTimestampMetric.WithLabelValues(host, string(filesystem)).Set(float64(stat.Timestamp.Unix()))
|
||||
}
|
||||
}
|
||||
@ -227,6 +231,7 @@ var indexTmpl = template.Must(template.New("index").Parse(`<!doctype html>
|
||||
<th>Filesystem</th>
|
||||
<th>Counts</th>
|
||||
<th>FreeNAS Snapshots</th>
|
||||
<th>Linux Snapshots</th>
|
||||
<th>Most Recent</th>
|
||||
</tr>
|
||||
{{range $name, $fsStat := .}}
|
||||
@ -234,7 +239,8 @@ var indexTmpl = template.Must(template.New("index").Parse(`<!doctype html>
|
||||
<td>{{$name}}</td>
|
||||
<td>{{$fsStat.Counts}}</td>
|
||||
<td>{{$fsStat.FreenasCounts}}</td>
|
||||
<td>{{if $fsStat.FreenasCounts }}{{$fsStat.Timestamp}}{{end}}</td>
|
||||
<td>{{$fsStat.LinuxCounts}}</td>
|
||||
<td>{{if or $fsStat.LinuxCounts $fsStat.FreenasCounts }}{{$fsStat.Timestamp}}{{end}}</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
</table>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user