github.com/netdata/go.d.plugin@v0.58.1/modules/x509check/init.go (about)

     1  // SPDX-License-Identifier: GPL-3.0-or-later
     2  
     3  package x509check
     4  
     5  import (
     6  	"errors"
     7  
     8  	"github.com/netdata/go.d.plugin/agent/module"
     9  )
    10  
    11  func (x *X509Check) validateConfig() error {
    12  	if x.Source == "" {
    13  		return errors.New("source is not set")
    14  	}
    15  	return nil
    16  }
    17  
    18  func (x *X509Check) initProvider() (provider, error) {
    19  	return newProvider(x.Config)
    20  }
    21  
    22  func (x *X509Check) initCharts() *module.Charts {
    23  	var charts *module.Charts
    24  	if x.CheckRevocation {
    25  		charts = withRevocationCharts.Copy()
    26  	} else {
    27  		charts = baseCharts.Copy()
    28  	}
    29  
    30  	for _, chart := range *charts {
    31  		chart.Labels = []module.Label{
    32  			{Key: "source", Value: x.Source},
    33  		}
    34  	}
    35  
    36  	return charts
    37  
    38  }