summaryrefslogtreecommitdiffstats
path: root/src/go/plugin/go.d/modules/ntpd
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-11-09 08:36:11 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-11-09 08:37:11 +0000
commit910c794ec6d0a364b4aabccf22b715cb45780e83 (patch)
tree561a9ef6b6a4668102674e1a52b3e7563c57ac61 /src/go/plugin/go.d/modules/ntpd
parentReleasing debian version 1.47.5-1. (diff)
downloadnetdata-910c794ec6d0a364b4aabccf22b715cb45780e83.tar.xz
netdata-910c794ec6d0a364b4aabccf22b715cb45780e83.zip
Merging upstream version 2.0.0 (Closes: #923993, #1042533, #1045145).
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/go/plugin/go.d/modules/ntpd')
-rw-r--r--src/go/plugin/go.d/modules/ntpd/integrations/ntpd.md4
-rw-r--r--src/go/plugin/go.d/modules/ntpd/ntpd.go17
2 files changed, 9 insertions, 12 deletions
diff --git a/src/go/plugin/go.d/modules/ntpd/integrations/ntpd.md b/src/go/plugin/go.d/modules/ntpd/integrations/ntpd.md
index c0094c52..ec907208 100644
--- a/src/go/plugin/go.d/modules/ntpd/integrations/ntpd.md
+++ b/src/go/plugin/go.d/modules/ntpd/integrations/ntpd.md
@@ -122,8 +122,8 @@ No action required.
The configuration file name for this integration is `go.d/ntpd.conf`.
-You can edit the configuration file using the `edit-config` script from the
-Netdata [config directory](/docs/netdata-agent/configuration/README.md#the-netdata-config-directory).
+You can edit the configuration file using the [`edit-config`](https://github.com/netdata/netdata/blob/master/docs/netdata-agent/configuration/README.md#edit-a-configuration-file-using-edit-config) script from the
+Netdata [config directory](https://github.com/netdata/netdata/blob/master/docs/netdata-agent/configuration/README.md#the-netdata-config-directory).
```bash
cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata
diff --git a/src/go/plugin/go.d/modules/ntpd/ntpd.go b/src/go/plugin/go.d/modules/ntpd/ntpd.go
index 01162468..8bff01cc 100644
--- a/src/go/plugin/go.d/modules/ntpd/ntpd.go
+++ b/src/go/plugin/go.d/modules/ntpd/ntpd.go
@@ -9,8 +9,8 @@ import (
"time"
"github.com/netdata/netdata/go/plugins/plugin/go.d/agent/module"
+ "github.com/netdata/netdata/go/plugins/plugin/go.d/pkg/confopt"
"github.com/netdata/netdata/go/plugins/plugin/go.d/pkg/iprange"
- "github.com/netdata/netdata/go/plugins/plugin/go.d/pkg/web"
)
//go:embed "config_schema.json"
@@ -28,7 +28,7 @@ func New() *NTPd {
return &NTPd{
Config: Config{
Address: "127.0.0.1:123",
- Timeout: web.Duration(time.Second),
+ Timeout: confopt.Duration(time.Second),
CollectPeers: false,
},
charts: systemCharts.Copy(),
@@ -39,10 +39,10 @@ func New() *NTPd {
}
type Config struct {
- UpdateEvery int `yaml:"update_every,omitempty" json:"update_every"`
- Address string `yaml:"address" json:"address"`
- Timeout web.Duration `yaml:"timeout,omitempty" json:"timeout"`
- CollectPeers bool `yaml:"collect_peers" json:"collect_peers"`
+ UpdateEvery int `yaml:"update_every,omitempty" json:"update_every"`
+ Address string `yaml:"address" json:"address"`
+ Timeout confopt.Duration `yaml:"timeout,omitempty" json:"timeout"`
+ CollectPeers bool `yaml:"collect_peers" json:"collect_peers"`
}
type (
@@ -75,14 +75,12 @@ func (n *NTPd) Configuration() any {
func (n *NTPd) Init() error {
if n.Address == "" {
- n.Error("config validation: 'address' can not be empty")
- return errors.New("address not set")
+ return errors.New("config: 'address' can not be empty")
}
txt := "0.0.0.0 127.0.0.0/8"
r, err := iprange.ParseRanges(txt)
if err != nil {
- n.Errorf("error on parsing ip range '%s': %v", txt, err)
return fmt.Errorf("error on parsing ip range '%s': %v", txt, err)
}
@@ -94,7 +92,6 @@ func (n *NTPd) Init() error {
func (n *NTPd) Check() error {
mx, err := n.collect()
if err != nil {
- n.Error(err)
return err
}
if len(mx) == 0 {