Skip to content

Commit

Permalink
Add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
MalloZup committed Sep 3, 2020
1 parent b320f5b commit 428cb9f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
6 changes: 3 additions & 3 deletions collector/sbd/sbd.go
Expand Up @@ -35,7 +35,7 @@ func NewCollector(sbdPath string, sbdConfigPath string) (*sbdCollector, error) {
}

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

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

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

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

return nil
Expand Down
15 changes: 14 additions & 1 deletion doc/metrics.md
Expand Up @@ -198,7 +198,8 @@ The status of each Corosync ring; `1` means healthy, `0` means faulty.
The SBD subsystems collect devices stats by parsing its configuration and the output of `sbd --dump`.

0. [Sample](../test/sbd.metrics)
2. [`ha_cluster_sbd_devices`](#ha_cluster_sbd_devices)
1. [`ha_cluster_sbd_devices`](#ha_cluster_sbd_devices)
2. [`ha_cluster_sbd_timeouts`](#ha_cluster_sbd_timeouts)

### `ha_cluster_sbd_devices`

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

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

### `ha_cluster_sbd_timeouts`

#### Description

The SBD timeouts pro SBD device
Value is an integer expessing the timeout

#### Labels

- `device`: the path of the SBD device
- `type`: either `watchdog` or `msgwait`


## DRBD

Expand Down
12 changes: 6 additions & 6 deletions test/sbd.metrics
Expand Up @@ -2,9 +2,9 @@
# TYPE ha_cluster_sbd_devices gauge
ha_cluster_sbd_devices{device="/dev/vdc",status="healthy"} 1
ha_cluster_sbd_devices{device="/dev/vdd",status="healthy"} 1
# HELP ha_cluster_sbd_sbd_timeout sbd watchdog timeout
# TYPE ha_cluster_sbd_sbd_timeout gauge
ha_cluster_sbd_sbd_timeout{device="/dev/vdc",type="msgwait_timeout"} 10
ha_cluster_sbd_sbd_timeout{device="/dev/vdc",type="watchdog_timeout"} 9
ha_cluster_sbd_sbd_timeout{device="/dev/vdd",type="msgwait_timeout"} 10
ha_cluster_sbd_sbd_timeout{device="/dev/vdd",type="watchdog_timeout"} 9
# HELP ha_cluster_sbd_timeouts SBD timeouts for each device and type
# TYPE ha_cluster_sbd_timeouts gauge
ha_cluster_sbd_timeouts{device="/dev/vdc",type="msgwait"} 10
ha_cluster_sbd_timeouts{device="/dev/vdc",type="watchdog"} 9
ha_cluster_sbd_timeouts{device="/dev/vdd",type="msgwait"} 10
ha_cluster_sbd_timeouts{device="/dev/vdd",type="watchdog"} 9

0 comments on commit 428cb9f

Please sign in to comment.