Path: blob/main/component/prometheus/exporter/apache/apache.go
4096 views
package apache12import (3"github.com/grafana/agent/component"4"github.com/grafana/agent/component/prometheus/exporter"5"github.com/grafana/agent/pkg/integrations"6"github.com/grafana/agent/pkg/integrations/apache_http"7)89func init() {10component.Register(component.Registration{11Name: "prometheus.exporter.apache",12Args: Arguments{},13Exports: exporter.Exports{},14Build: exporter.New(createExporter, "apache"),15})16}1718func createExporter(opts component.Options, args component.Arguments) (integrations.Integration, error) {19a := args.(Arguments)20return a.Convert().NewIntegration(opts.Logger)21}2223// DefaultArguments holds the default settings for the apache exporter24var DefaultArguments = Arguments{25ApacheAddr: "http://localhost/server-status?auto",26ApacheHostOverride: "",27ApacheInsecure: false,28}2930// Arguments controls the apache exporter.31type Arguments struct {32ApacheAddr string `river:"scrape_uri,attr,optional"`33ApacheHostOverride string `river:"host_override,attr,optional"`34ApacheInsecure bool `river:"insecure,attr,optional"`35}3637// UnmarshalRiver implements River unmarshalling for Arguments.38func (a *Arguments) UnmarshalRiver(f func(interface{}) error) error {39*a = DefaultArguments4041type args Arguments42return f((*args)(a))43}4445func (a *Arguments) Convert() *apache_http.Config {46return &apache_http.Config{47ApacheAddr: a.ApacheAddr,48ApacheHostOverride: a.ApacheHostOverride,49ApacheInsecure: a.ApacheInsecure,50}51}525354