Skip to content

Commit 428cb9f

Browse files
committed
Add documentation
1 parent b320f5b commit 428cb9f

File tree

3 files changed

+23
-10
lines changed

3 files changed

+23
-10
lines changed

collector/sbd/sbd.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func NewCollector(sbdPath string, sbdConfigPath string) (*sbdCollector, error) {
3535
}
3636

3737
c.SetDescriptor("devices", "SBD devices; one line per device", []string{"device", "status"})
38-
c.SetDescriptor("sbd_timeout", "sbd watchdog timeout", []string{"device", "type"})
38+
c.SetDescriptor("timeouts", "SBD timeouts for each device and type", []string{"device", "type"})
3939

4040
return c, nil
4141
}
@@ -73,11 +73,11 @@ func (c *sbdCollector) CollectWithError(ch chan<- prometheus.Metric) error {
7373

7474
sbdWatchdogs, sbdMsgWaits := c.getSbdTimeouts(sbdDevices)
7575
for sbdDev, sbdWatchdog := range sbdWatchdogs {
76-
ch <- c.MakeGaugeMetric("sbd_timeout", sbdWatchdog, sbdDev, "watchdog_timeout")
76+
ch <- c.MakeGaugeMetric("timeouts", sbdWatchdog, sbdDev, "watchdog")
7777
}
7878

7979
for sbdDev, sbdMsgWait := range sbdMsgWaits {
80-
ch <- c.MakeGaugeMetric("sbd_timeout", sbdMsgWait, sbdDev, "msgwait_timeout")
80+
ch <- c.MakeGaugeMetric("timeouts", sbdMsgWait, sbdDev, "msgwait")
8181
}
8282

8383
return nil

doc/metrics.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,8 @@ The status of each Corosync ring; `1` means healthy, `0` means faulty.
198198
The SBD subsystems collect devices stats by parsing its configuration and the output of `sbd --dump`.
199199

200200
0. [Sample](../test/sbd.metrics)
201-
2. [`ha_cluster_sbd_devices`](#ha_cluster_sbd_devices)
201+
1. [`ha_cluster_sbd_devices`](#ha_cluster_sbd_devices)
202+
2. [`ha_cluster_sbd_timeouts`](#ha_cluster_sbd_timeouts)
202203

203204
### `ha_cluster_sbd_devices`
204205

@@ -214,6 +215,18 @@ Either the value is `1`, or the line is absent altogether.
214215

215216
The total number of lines for this metric will be the cardinality of `device`.
216217

218+
### `ha_cluster_sbd_timeouts`
219+
220+
#### Description
221+
222+
The SBD timeouts pro SBD device
223+
Value is an integer expessing the timeout
224+
225+
#### Labels
226+
227+
- `device`: the path of the SBD device
228+
- `type`: either `watchdog` or `msgwait`
229+
217230

218231
## DRBD
219232

test/sbd.metrics

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
# TYPE ha_cluster_sbd_devices gauge
33
ha_cluster_sbd_devices{device="/dev/vdc",status="healthy"} 1
44
ha_cluster_sbd_devices{device="/dev/vdd",status="healthy"} 1
5-
# HELP ha_cluster_sbd_sbd_timeout sbd watchdog timeout
6-
# TYPE ha_cluster_sbd_sbd_timeout gauge
7-
ha_cluster_sbd_sbd_timeout{device="/dev/vdc",type="msgwait_timeout"} 10
8-
ha_cluster_sbd_sbd_timeout{device="/dev/vdc",type="watchdog_timeout"} 9
9-
ha_cluster_sbd_sbd_timeout{device="/dev/vdd",type="msgwait_timeout"} 10
10-
ha_cluster_sbd_sbd_timeout{device="/dev/vdd",type="watchdog_timeout"} 9
5+
# HELP ha_cluster_sbd_timeouts SBD timeouts for each device and type
6+
# TYPE ha_cluster_sbd_timeouts gauge
7+
ha_cluster_sbd_timeouts{device="/dev/vdc",type="msgwait"} 10
8+
ha_cluster_sbd_timeouts{device="/dev/vdc",type="watchdog"} 9
9+
ha_cluster_sbd_timeouts{device="/dev/vdd",type="msgwait"} 10
10+
ha_cluster_sbd_timeouts{device="/dev/vdd",type="watchdog"} 9

0 commit comments

Comments
 (0)