Skip to content

Basic script for use with the telegraf exec input plugin to collect DRBD status data into influxdb for display in a grafana dashboard

License

Notifications You must be signed in to change notification settings

wmandra/telegraf-drbd_collector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

telegraf-drbd_collector

Basic script for use with the telegraf exec input plugin to collect DRBD status data into influxdb for display in a grafana dashboard.

Configuration

v1

[[inputs.exec]]
  commands = [
    "/usr/local/bin/drbd_collector"
  ]
  timeout = "5s"
  name_suffix = ""
  data_format = "influx"

v2

[[inputs.exec]]
  commands = [
    "/usr/local/bin/drbd_collector-v2 --statistics"
  ]
  timeout = "5s"
  name_suffix = ""
  data_format = "influx"
Frequency

You can reduce the frequency of just the drbd_collector by adding an interval entry to the [[inputs.exec]] configuration:

[[inputs.exec]]
  commands = [
    "/usr/local/bin/drbd_collector-v2 --statistics"
  ]
  timeout = "5s"
  interval = "30s"
  name_suffix = ""
  data_format = "influx"

Sudoers

By default the telegraf service runs as the telegraf user which will prevent the drbd_collector script from running the drdbadm command. Add the following to the suders.conf file to permit sudo access:

telegraf ALL=(ALL) NOPASSWD: /usr/sbin/drbdsetup

To prevent log spam from sudo access also add the following:

Defaults:telegraf !syslog

Metrics

  • state
  • role
  • disk
  • resync

Tags

  • resource
  • volume

Optional Metrics

When using the v2 script and the --statistics parameter these additional metrics will be provided per volume

  • read
  • written
  • sent
  • received

Example Output

drbd,host=node04,resource=nfs,volume=0 disk=0i,role=2i,state=8i 1708126124000000000
drbd,host=node04,resource=nfs,volume=1 disk=0i,role=2i,state=8i 1708126124000000000
drbd,host=node04,resource=nfs,volume=2 disk=0i,role=2i,state=8i 1708126124000000000

Notes

The state, role, and disk metrics are sent to influx as integer values rather than strings. This permits Grafana dashboard panels to make use of Thresholds for cell coloring along with use in alerting. You can use Value Mappings within the Grafana panel to convert back to text values for display purposes.

The resync metric is only provided in the output when it is present in the drbdadm status.

ToDo

Potentially rewrite in go for inclusion as telegraf plugin.

About

Basic script for use with the telegraf exec input plugin to collect DRBD status data into influxdb for display in a grafana dashboard

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages