Documentation
¶
Index ¶
- Variables
- func CompileIgnoreInterfaces(list string) (string, error)
- func FetchRemoteConfig(factumConfig *util.ConfigFactum) (*util.ConfigPrometheus, error)
- func InstallIgnoreInterfaces(destFile, list string) (path string, changed bool, err error)
- func NewPrometheusClient(c util.ConfigPrometheus) *prometheusClient
- type FactumPrometheusClient
Constants ¶
This section is empty.
Variables ¶
var ErrNoIgnoreConfig = errors.New("prometheus config has no factum-if-ignore marker")
ErrNoIgnoreConfig means none of the scrape configs next to the file_sd file contain the factum-if-ignore markers.
Functions ¶
func CompileIgnoreInterfaces ¶ added in v1.6.0
CompileIgnoreInterfaces checks list and returns the single expression written into the scrape config. An empty list returns "".
func FetchRemoteConfig ¶
func FetchRemoteConfig(factumConfig *util.ConfigFactum) (*util.ConfigPrometheus, error)
FetchRemoteConfig pulls the Prometheus/snmp_exporter sync settings from the primary, authenticated with factumConfig.Token (checked against the primary's Settings.FactumApiToken - see web.Controller.checkServiceToken).
func InstallIgnoreInterfaces ¶ added in v1.6.0
InstallIgnoreInterfaces compiles list and rewrites the first writable scrape config next to destFile that contains the markers. changed is false when the block was already up to date.
func NewPrometheusClient ¶
func NewPrometheusClient(c util.ConfigPrometheus) *prometheusClient
Types ¶
type FactumPrometheusClient ¶
type FactumPrometheusClient struct {
Config *util.ConfigFactum
PrometheusConfig *util.ConfigPrometheus
Prometheus *prometheusClient
}
func NewFactumPrometheusClient ¶
func NewFactumPrometheusClient(root *util.ConfigAgentRoot) (*FactumPrometheusClient, error)
NewFactumPrometheusClient fetches the Prometheus/snmp_exporter sync settings from the primary over REST - config.Prometheus is never used, since factum2-prometheus typically runs on a different host than the primary and has no local prometheus config of its own (see util.ConfigPrometheus's doc comment).
func (*FactumPrometheusClient) Sync ¶
func (fpc *FactumPrometheusClient) Sync(reporter jobevent.Reporter) error
Sync fetches devices from the Factum API, filters out those that shouldn't be scraped, writes Prometheus file_sd JSON, and asks Prometheus to reload if anything changed (and a reload URL is configured).