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