Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
aos
GitHub Repository: aos/grafana-agent
Path: blob/main/pkg/integrations/windows_exporter/windows_exporter.go
5365 views
1
//go:build !windows
2
3
package windows_exporter //nolint:golint
4
5
import (
6
"context"
7
"net/http"
8
9
"github.com/go-kit/log"
10
"github.com/go-kit/log/level"
11
"github.com/grafana/agent/pkg/integrations/config"
12
)
13
14
// Integration is the windows_exporter integration. On non-Windows platforms,
15
// this integration does nothing and will print a warning if enabled.
16
type Integration struct {
17
}
18
19
// New creates a fake windows_exporter integration.
20
func New(logger log.Logger, _ *Config) (*Integration, error) {
21
level.Warn(logger).Log("msg", "the windows_exporter only works on Windows; enabling it otherwise will do nothing")
22
return &Integration{}, nil
23
}
24
25
// MetricsHandler satisfies Integration.RegisterRoutes.
26
func (i *Integration) MetricsHandler() (http.Handler, error) {
27
return http.NotFoundHandler(), nil
28
}
29
30
// ScrapeConfigs satisfies Integration.ScrapeConfigs.
31
func (i *Integration) ScrapeConfigs() []config.ScrapeConfig {
32
// No-op: nothing to scrape.
33
return []config.ScrapeConfig{}
34
}
35
36
// Run satisfies Integration.Run.
37
func (i *Integration) Run(ctx context.Context) error {
38
// We don't need to do anything here, so we can just wait for the context to
39
// finish.
40
<-ctx.Done()
41
return ctx.Err()
42
}
43
44