Skip to content
This repository was archived by the owner on Jul 28, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
5ce84f4
Merge pull request #1 from grafana/master
mattdurham Jan 6, 2021
876a0fb
Merge remote-tracking branch 'upstream/main'
mattdurham Mar 2, 2021
f41be56
Testing
mattdurham Mar 17, 2021
f632cf0
Merge remote-tracking branch 'upstream/main' into windows_exporter_in…
mattdurham Mar 17, 2021
1121a04
Windows Exporter support
mattdurham Mar 18, 2021
0951007
Add untracked files
mattdurham Mar 18, 2021
fdd16d1
Checkin example converting to custom config
mattdurham Mar 22, 2021
477c312
Merge remote-tracking branch 'upstream/main' into windows_exporter_in…
mattdurham Mar 22, 2021
3ec74d4
Scary reflect for getting the values
mattdurham Mar 22, 2021
67741ff
Smaller item feedback in PR
mattdurham Mar 22, 2021
3bdd395
Add linting exception
mattdurham Mar 22, 2021
2a78895
Update the changelog
mattdurham Mar 23, 2021
871a634
Fix MSSQL config
mattdurham Mar 23, 2021
022e718
Reorder functions and fix comments.
mattdurham Mar 24, 2021
59af5d8
Clean up var names
mattdurham Mar 24, 2021
51e17d5
Change to explicit setting of map
mattdurham Mar 24, 2021
106a443
minor formatting
mattdurham Mar 24, 2021
4dce453
Switch to explicit mapping
mattdurham Mar 24, 2021
0e10fd3
Add some checks on sync
mattdurham Mar 24, 2021
94d035b
Use far simpler method, under the assumption an empty string is not a…
mattdurham Mar 25, 2021
21c6ba5
Use far simpler method, under the assumption an empty string is not a…
mattdurham Mar 25, 2021
7d8427b
Add vendor files
mattdurham Mar 25, 2021
7cd5999
Add build tags so windows specific items dont get included
mattdurham Mar 25, 2021
80adb50
Fix linting error
mattdurham Mar 25, 2021
54d60b6
Merge pull request #4 from mattdurham/Explicit_Mapping
mattdurham Mar 25, 2021
49b0b66
Fix linting error
mattdurham Mar 25, 2021
1c61fc6
Fix linting error
mattdurham Mar 25, 2021
cc2d8bb
Fix linting error
mattdurham Mar 25, 2021
536d583
Fix linting error
mattdurham Mar 25, 2021
27423ec
Update CHANGELOG.md
mattdurham Mar 25, 2021
13eceb9
PR feedback of cleaning vars
mattdurham Mar 25, 2021
d4dd9fd
Merge remote-tracking branch 'origin/windows_exporter_integration' in…
mattdurham Mar 25, 2021
b1dd32e
Merge remote-tracking branch 'upstream/main' into windows_exporter_in…
mattdurham Mar 25, 2021
0ff7721
Rearranging files for non windows usage.
mattdurham Mar 25, 2021
d468deb
Cross platform support
mattdurham Mar 25, 2021
4b1b8fd
Cross platform support
mattdurham Mar 25, 2021
6bb695f
Add beta verbiage
mattdurham Mar 25, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ require (
github.com/opentracing-contrib/go-grpc v0.0.0-20191001143057-db30781987df
github.com/opentracing/opentracing-go v1.2.0
github.com/pkg/errors v0.9.1
github.com/prometheus-community/windows_exporter v0.0.0-00010101000000-000000000000
github.com/prometheus/client_golang v1.9.0
github.com/prometheus/common v0.17.0
github.com/prometheus/consul_exporter v0.7.2-0.20210127095228-584c6de19f23
Expand Down Expand Up @@ -92,3 +93,5 @@ replace github.com/gomodule/redigo => github.com/gomodule/redigo v1.8.2

// Excluding fixes a conflict in test packages and allows "go mod tidy" to run.
exclude google.golang.org/grpc/examples v0.0.0-20200728065043-dfc0c05b2da9

replace github.com/prometheus-community/windows_exporter => github.com/grafana/windows_exporter v0.15.1-0.20210318175846-f7531024d7fc
Comment thread
mattdurham marked this conversation as resolved.
Outdated
9 changes: 8 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,11 @@ github.com/Microsoft/ApplicationInsights-Go v0.4.2/go.mod h1:CukZ/G66zxXtI+h/VcV
github.com/Microsoft/go-winio v0.4.3/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA=
github.com/Microsoft/go-winio v0.4.9/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA=
github.com/Microsoft/go-winio v0.4.11/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA=
github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA=
github.com/Microsoft/go-winio v0.4.16 h1:FtSW/jqD+l4ba5iPBj9CODVtgfYAD8w2wS923g/cFDk=
github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0=
github.com/Microsoft/hcsshim v0.8.6 h1:ZfF0+zZeYdzMIVMZHKtDKJvLHj76XCuVae/jNkjj0IA=
github.com/Microsoft/hcsshim v0.8.6/go.mod h1:Op3hHsoHPAvb6lceZHDtd9OkTew38wNoXnJs8iY7rUg=
github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=
github.com/NYTimes/gziphandler v1.0.1/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=
github.com/NYTimes/gziphandler v1.1.1/go.mod h1:n/CVRwUEOgIxrgPvAQhUUr9oeUtvrhMomdKFjzJNB0c=
Expand All @@ -150,8 +153,9 @@ github.com/Shopify/sarama v1.28.0 h1:lOi3SfE6OcFlW9Trgtked2aHNZ2BIG/d6Do+PEUAqqM
github.com/Shopify/sarama v1.28.0/go.mod h1:j/2xTrU39dlzBmsxF1eQ2/DdWrxyBCl6pzz7a81o/ZY=
github.com/Shopify/toxiproxy v2.1.4+incompatible h1:TKdv8HiTLgE5wdJuEML90aBgNWsokNbMijUGhmcoBJc=
github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 h1:fLjPD/aNc3UIOA6tDi6QXUemppXK3P9BI7mr2hd6gx8=
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg=
github.com/StackExchange/wmi v0.0.0-20180725035823-b12b22c5341f h1:5ZfJxyXo8KyX8DgGXC5B7ILL8y51fci/qYz2B4j8iLY=
github.com/StackExchange/wmi v0.0.0-20180725035823-b12b22c5341f/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg=
github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE=
github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g=
github.com/abdullin/seq v0.0.0-20160510034733-d5467c17e7af/go.mod h1:5Jv4cbFiHJMsVxt52+i0Ha45fjshj6wxYr1r19tB9bw=
Expand Down Expand Up @@ -362,6 +366,7 @@ github.com/digitalocean/godo v1.1.1/go.mod h1:h6faOIcZ8lWIwNQ+DN7b3CgX4Kwby5T+nb
github.com/digitalocean/godo v1.10.0/go.mod h1:h6faOIcZ8lWIwNQ+DN7b3CgX4Kwby5T+nbpNqkUIozU=
github.com/digitalocean/godo v1.57.0 h1:uCpe0sRIZ/sJWxWDsJyBPBjUfSvxop+WHkHiSf+tjjM=
github.com/digitalocean/godo v1.57.0/go.mod h1:p7dOjjtSBqCTUksqtA5Fd3uaKs9kyTq2xcz76ulEJRU=
github.com/dimchansky/utfbom v1.1.0 h1:FcM3g+nofKgUteL8dm/UpdRXNC9KmADgTpLKsu0TRo4=
github.com/dimchansky/utfbom v1.1.0/go.mod h1:rO41eb7gLfo8SF1jd9F8HplJm1Fewwi4mQvIirEdv+8=
github.com/docker/distribution v2.6.0-rc.1.0.20170726174610-edc3ab29cdff+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
github.com/docker/distribution v2.7.0+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
Expand Down Expand Up @@ -772,6 +777,8 @@ github.com/grafana/prometheus v1.8.2-0.20210218144103-50bc1c15f0c7 h1:Zq7JXdYsCH
github.com/grafana/prometheus v1.8.2-0.20210218144103-50bc1c15f0c7/go.mod h1:dv3B1syqmkrkmo665MPCU6L8PbTXIiUeg/OEQULLNxA=
github.com/grafana/tail v0.0.0-20201004203643-7aa4e4a91f03 h1:fGgFrAraMB0BaPfYumu+iulfDXwHm+GFyHA4xEtBqI8=
github.com/grafana/tail v0.0.0-20201004203643-7aa4e4a91f03/go.mod h1:GIMXMPB/lRAllP5rVDvcGif87ryO2hgD7tCtHMdHrho=
github.com/grafana/windows_exporter v0.15.1-0.20210318175846-f7531024d7fc h1:q/x832Cv+fxjAdy8/dFu1oEPAKbxDgeN/PPL6pIrWZQ=
github.com/grafana/windows_exporter v0.15.1-0.20210318175846-f7531024d7fc/go.mod h1:Wepo+qoC6yj9L3e1j5g2Y7aABboSN1jFYFhdw39wP1c=
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA=
github.com/grobie/gomemcache v0.0.0-20201204163352-08d7c80fcac6 h1:vqwzYov9hrRoGAmy61um8mVteOCD0bEbKgXr1mmkTlI=
github.com/grobie/gomemcache v0.0.0-20201204163352-08d7c80fcac6/go.mod h1:L69/dBlPQlWkcnU76WgcppK5e4rrxzQdi6LhLnK/ytA=
Expand Down
5 changes: 5 additions & 0 deletions pkg/integrations/install/install_windows.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// +build windows

package install

import _ "github.com/grafana/agent/pkg/integrations/windows_exporter" // register windows_exporter
Comment thread
mattdurham marked this conversation as resolved.
Outdated
40 changes: 40 additions & 0 deletions pkg/integrations/windows_exporter/config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// +build windows
Comment thread
mattdurham marked this conversation as resolved.
Outdated

package windows_exporter //nolint:golint

import (
"github.com/go-kit/kit/log"
"github.com/grafana/agent/pkg/integrations"
"github.com/grafana/agent/pkg/integrations/config"
)

// Config controls the node_exporter integration.
type Config struct {
Common config.Common `yaml:",inline"`

WindowsConfig interface{} `yaml:"config"`

EnabledCollectors string `yaml:"enabledCollectors"`
Comment thread
rfratto marked this conversation as resolved.
Outdated
}

// UnmarshalYAML implements yaml.Unmarshaler for Config.
func (c *Config) UnmarshalYAML(unmarshal func(interface{}) error) error {
type plain Config
return unmarshal((*plain)(c))
}

func (c *Config) Name() string {
return "windows_exporter"
}

func (c *Config) CommonConfig() config.Common {
return c.Common
}

func (c *Config) NewIntegration(l log.Logger) (integrations.Integration, error) {
return New(l, c)
}

func init() {
integrations.RegisterIntegration(&Config{})
}
Comment thread
mattdurham marked this conversation as resolved.
91 changes: 91 additions & 0 deletions pkg/integrations/windows_exporter/windows_exporter.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
// +build windows

package windows_exporter //nolint:golint

import (
"context"
"fmt"
"net/http"

"gopkg.in/yaml.v2"

"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
"github.com/gorilla/mux"
"github.com/grafana/agent/pkg/integrations/config"
"github.com/prometheus-community/windows_exporter/exporter"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
)

type Integration struct {
c *Config
logger log.Logger
wc *exporter.WindowsCollector

exporterMetricsRegistry *prometheus.Registry
}

// New creates a new node_exporter integration.
func New(log log.Logger, c *Config) (*Integration, error) {

bytes, _ := yaml.Marshal(c.WindowsConfig)
Comment thread
mattdurham marked this conversation as resolved.
Outdated
cb := string(bytes)
wc, _ := exporter.NewWindowsCollector(c.Name(), c.EnabledCollectors, cb)
Comment thread
mattdurham marked this conversation as resolved.
Outdated

level.Info(log).Log("msg", "Enabled windows_exporter collectors")

return &Integration{
Comment thread
mattdurham marked this conversation as resolved.
Outdated
c: c,
logger: log,
wc: wc,

exporterMetricsRegistry: prometheus.NewRegistry(),
}, nil
}

// RegisterRoutes satisfies Integration.RegisterRoutes. The mux.Router provided
// here is expected to be a subrouter, where all registered paths will be
// registered within that subroute.
func (i *Integration) RegisterRoutes(r *mux.Router) error {
handler, err := i.handler()
if err != nil {
return err
}

r.Handle("/metrics", handler)
return nil
}

func (i *Integration) handler() (http.Handler, error) {
r := prometheus.NewRegistry()
if err := r.Register(i.wc); err != nil {
return nil, fmt.Errorf("couldn't register windows_exporter collector: %w", err)
}
handler := promhttp.HandlerFor(
prometheus.Gatherers{i.exporterMetricsRegistry, r},
promhttp.HandlerOpts{
ErrorHandling: promhttp.ContinueOnError,
MaxRequestsInFlight: 0,
Registry: i.exporterMetricsRegistry,
},
)

return handler, nil
}

// ScrapeConfigs satisfies Integration.ScrapeConfigs.
func (i *Integration) ScrapeConfigs() []config.ScrapeConfig {
return []config.ScrapeConfig{{
JobName: i.c.Name(),
MetricsPath: "/metrics",
}}
}

// Run satisfies Integration.Run.
func (i *Integration) Run(ctx context.Context) error {
// We don't need to do anything here, so we can just wait for the context to
// finish.
<-ctx.Done()
return ctx.Err()
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions vendor/github.com/Microsoft/hcsshim/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading