diff --git a/plugins/inputs/upsd/README.md b/plugins/inputs/upsd/README.md index c47619f04c539..709cf50c1aa77 100644 --- a/plugins/inputs/upsd/README.md +++ b/plugins/inputs/upsd/README.md @@ -9,15 +9,12 @@ upsd should be installed and it's daemon should be running. ## Configuration -```toml +```toml @sample.conf +# Monitor UPSes connected via Network UPS Tools [[inputs.upsd]] ## A running NUT server to connect to. - # If not provided will default to 127.0.0.1 # server = "127.0.0.1" - - ## The default NUT port 3493 can be overridden with: # port = 3493 - # username = "user" # password = "password" ``` diff --git a/plugins/inputs/upsd/sample.conf b/plugins/inputs/upsd/sample.conf new file mode 100644 index 0000000000000..2c0a1960af07c --- /dev/null +++ b/plugins/inputs/upsd/sample.conf @@ -0,0 +1,7 @@ +# Monitor UPSes connected via Network UPS Tools +[[inputs.upsd]] + ## A running NUT server to connect to. + # server = "127.0.0.1" + # port = 3493 + # username = "user" + # password = "password" diff --git a/plugins/inputs/upsd/upsd.go b/plugins/inputs/upsd/upsd.go index 081aa1b5be251..f65c5310cd447 100644 --- a/plugins/inputs/upsd/upsd.go +++ b/plugins/inputs/upsd/upsd.go @@ -1,14 +1,21 @@ +//go:generate ../../../tools/readme_config_includer/generator package upsd import ( + _ "embed" "fmt" + "strings" + "github.com/influxdata/telegraf" "github.com/influxdata/telegraf/internal/choice" "github.com/influxdata/telegraf/plugins/inputs" nut "github.com/robbiet480/go.nut" - "strings" ) +// DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +//go:embed sample.conf +var sampleConfig string + //See: https://networkupstools.org/docs/developer-guide.chunked/index.html const defaultAddress = "127.0.0.1" @@ -24,18 +31,6 @@ type Upsd struct { batteryRuntimeTypeWarningIssued bool } -func (*Upsd) Description() string { - return "Monitor UPSes connected via Network UPS Tools" -} - -var sampleConfig = ` - ## A running NUT server to connect to. - # server = "127.0.0.1" - # port = 3493 - # username = "user" - # password = "password" -` - func (*Upsd) SampleConfig() string { return sampleConfig }