summaryrefslogtreecommitdiffstats
path: root/src/go/collectors/go.d.plugin/modules/dnsdist/init.go
blob: d88310883921b7955bad07862c49e9bf60c5f98e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// SPDX-License-Identifier: GPL-3.0-or-later

package dnsdist

import (
	"errors"
	"net/http"

	"github.com/netdata/netdata/go/go.d.plugin/agent/module"
	"github.com/netdata/netdata/go/go.d.plugin/pkg/web"
)

func (d *DNSdist) validateConfig() error {
	if d.URL == "" {
		return errors.New("URL not set")
	}

	if _, err := web.NewHTTPRequest(d.Request); err != nil {
		return err
	}

	return nil
}

func (d *DNSdist) initHTTPClient() (*http.Client, error) {
	return web.NewHTTPClient(d.Client)
}

func (d *DNSdist) initCharts() (*module.Charts, error) {
	return charts.Copy(), nil
}