summaryrefslogtreecommitdiffstats
path: root/src/go/collectors/go.d.plugin/modules/whoisquery/init.go
blob: d42002095479be09f233c5241c11ac4f3d4218b5 (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
32
// SPDX-License-Identifier: GPL-3.0-or-later

package whoisquery

import (
	"errors"

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

func (w *WhoisQuery) validateConfig() error {
	if w.Source == "" {
		return errors.New("source is not set")
	}
	return nil
}

func (w *WhoisQuery) initProvider() (provider, error) {
	return newProvider(w.Config)
}

func (w *WhoisQuery) initCharts() *module.Charts {
	charts := baseCharts.Copy()

	for _, chart := range *charts {
		chart.Labels = []module.Label{
			{Key: "domain", Value: w.Source},
		}
	}

	return charts
}