summaryrefslogtreecommitdiffstats
path: root/src/go/collectors/go.d.plugin/modules/x509check/init.go
blob: f0df7fdeff40a7cdb078cf77a43bef72858939ac (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
33
34
35
36
37
38
// SPDX-License-Identifier: GPL-3.0-or-later

package x509check

import (
	"errors"

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

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

func (x *X509Check) initProvider() (provider, error) {
	return newProvider(x.Config)
}

func (x *X509Check) initCharts() *module.Charts {
	var charts *module.Charts
	if x.CheckRevocation {
		charts = withRevocationCharts.Copy()
	} else {
		charts = baseCharts.Copy()
	}

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

	return charts

}