fix(inputs.upsd): Move to new sample.conf style (#11471)
This commit is contained in:
parent
e4afb2bcfa
commit
bf0d261e53
|
|
@ -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"
|
||||
```
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue