Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
aos
GitHub Repository: aos/grafana-agent
Path: blob/main/component/prometheus/exporter/apache/apache.go
4096 views
1
package apache
2
3
import (
4
"github.com/grafana/agent/component"
5
"github.com/grafana/agent/component/prometheus/exporter"
6
"github.com/grafana/agent/pkg/integrations"
7
"github.com/grafana/agent/pkg/integrations/apache_http"
8
)
9
10
func init() {
11
component.Register(component.Registration{
12
Name: "prometheus.exporter.apache",
13
Args: Arguments{},
14
Exports: exporter.Exports{},
15
Build: exporter.New(createExporter, "apache"),
16
})
17
}
18
19
func createExporter(opts component.Options, args component.Arguments) (integrations.Integration, error) {
20
a := args.(Arguments)
21
return a.Convert().NewIntegration(opts.Logger)
22
}
23
24
// DefaultArguments holds the default settings for the apache exporter
25
var DefaultArguments = Arguments{
26
ApacheAddr: "http://localhost/server-status?auto",
27
ApacheHostOverride: "",
28
ApacheInsecure: false,
29
}
30
31
// Arguments controls the apache exporter.
32
type Arguments struct {
33
ApacheAddr string `river:"scrape_uri,attr,optional"`
34
ApacheHostOverride string `river:"host_override,attr,optional"`
35
ApacheInsecure bool `river:"insecure,attr,optional"`
36
}
37
38
// UnmarshalRiver implements River unmarshalling for Arguments.
39
func (a *Arguments) UnmarshalRiver(f func(interface{}) error) error {
40
*a = DefaultArguments
41
42
type args Arguments
43
return f((*args)(a))
44
}
45
46
func (a *Arguments) Convert() *apache_http.Config {
47
return &apache_http.Config{
48
ApacheAddr: a.ApacheAddr,
49
ApacheHostOverride: a.ApacheHostOverride,
50
ApacheInsecure: a.ApacheInsecure,
51
}
52
}
53
54