chore: Enable printing Windows sample configs on non-Windows (#12741)

This commit is contained in:
Joshua Powers 2023-03-01 06:31:45 -07:00 committed by GitHub
parent a26893d22a
commit 56ecbba523
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 116 additions and 4 deletions

View File

@ -24,6 +24,7 @@ See the [CONFIGURATION.md][CONFIGURATION.md] for more details.
```toml @sample.conf ```toml @sample.conf
# Input plugin to collect Windows Event Log messages # Input plugin to collect Windows Event Log messages
# This plugin ONLY supports Windows
[[inputs.win_eventlog]] [[inputs.win_eventlog]]
## Telegraf should have Administrator permissions to subscribe for some Windows Events channels ## Telegraf should have Administrator permissions to subscribe for some Windows Events channels
## (System log, for example) ## (System log, for example)

View File

@ -1,4 +1,5 @@
# Input plugin to collect Windows Event Log messages # Input plugin to collect Windows Event Log messages
# This plugin ONLY supports Windows
[[inputs.win_eventlog]] [[inputs.win_eventlog]]
## Telegraf should have Administrator permissions to subscribe for some Windows Events channels ## Telegraf should have Administrator permissions to subscribe for some Windows Events channels
## (System log, for example) ## (System log, for example)

View File

@ -1,6 +1,30 @@
//go:build !windows //go:build !windows
// Package win_eventlog Input plugin to collect Windows Event Log messages
//
//revive:disable-next-line:var-naming
package win_eventlog package win_eventlog
import (
_ "embed"
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/plugins/inputs"
)
//go:embed sample.conf
var sampleConfig string
type WinEventLog struct {
Log telegraf.Logger `toml:"-"`
}
func (w *WinEventLog) Init() error {
w.Log.Warn("current platform is not supported")
return nil
}
func (w *WinEventLog) SampleConfig() string { return sampleConfig }
func (w *WinEventLog) Gather(_ telegraf.Accumulator) error { return nil }
func init() {
inputs.Add("win_eventlog", func() telegraf.Input {
return &WinEventLog{}
})
}

View File

@ -303,6 +303,7 @@ See the [CONFIGURATION.md][CONFIGURATION.md] for more details.
```toml @sample.conf ```toml @sample.conf
# # Input plugin to counterPath Performance Counters on Windows operating systems # # Input plugin to counterPath Performance Counters on Windows operating systems
# # This plugin ONLY supports Windows
# [[inputs.win_perf_counters]] # [[inputs.win_perf_counters]]
# ## By default this plugin returns basic CPU and Disk statistics. # ## By default this plugin returns basic CPU and Disk statistics.
# ## See the README file for more examples. # ## See the README file for more examples.

View File

@ -1,4 +1,5 @@
# # Input plugin to counterPath Performance Counters on Windows operating systems # # Input plugin to counterPath Performance Counters on Windows operating systems
# # This plugin ONLY supports Windows
# [[inputs.win_perf_counters]] # [[inputs.win_perf_counters]]
# ## By default this plugin returns basic CPU and Disk statistics. # ## By default this plugin returns basic CPU and Disk statistics.
# ## See the README file for more examples. # ## See the README file for more examples.

View File

@ -1,3 +1,30 @@
//go:build !windows //go:build !windows
package win_perf_counters package win_perf_counters
import (
_ "embed"
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/plugins/inputs"
)
//go:embed sample.conf
var sampleConfig string
type WinPerfCounters struct {
Log telegraf.Logger `toml:"-"`
}
func (w *WinPerfCounters) Init() error {
w.Log.Warn("current platform is not supported")
return nil
}
func (w *WinPerfCounters) SampleConfig() string { return sampleConfig }
func (w *WinPerfCounters) Gather(_ telegraf.Accumulator) error { return nil }
func init() {
inputs.Add("win_perf_counters", func() telegraf.Input {
return &WinPerfCounters{}
})
}

View File

@ -18,6 +18,7 @@ See the [CONFIGURATION.md][CONFIGURATION.md] for more details.
```toml @sample.conf ```toml @sample.conf
# Input plugin to report Windows services info. # Input plugin to report Windows services info.
# This plugin ONLY supports Windows
[[inputs.win_services]] [[inputs.win_services]]
## Names of the services to monitor. Leave empty to monitor all the available services on the host. Globs accepted. Case sensitive. ## Names of the services to monitor. Leave empty to monitor all the available services on the host. Globs accepted. Case sensitive.
service_names = [ service_names = [

View File

@ -1,4 +1,5 @@
# Input plugin to report Windows services info. # Input plugin to report Windows services info.
# This plugin ONLY supports Windows
[[inputs.win_services]] [[inputs.win_services]]
## Names of the services to monitor. Leave empty to monitor all the available services on the host. Globs accepted. Case sensitive. ## Names of the services to monitor. Leave empty to monitor all the available services on the host. Globs accepted. Case sensitive.
service_names = [ service_names = [

View File

@ -1,3 +1,30 @@
//go:build !windows //go:build !windows
package win_services package win_services
import (
_ "embed"
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/plugins/inputs"
)
//go:embed sample.conf
var sampleConfig string
type WinServices struct {
Log telegraf.Logger `toml:"-"`
}
func (w *WinServices) Init() error {
w.Log.Warn("current platform is not supported")
return nil
}
func (w *WinServices) SampleConfig() string { return sampleConfig }
func (w *WinServices) Gather(_ telegraf.Accumulator) error { return nil }
func init() {
inputs.Add("win_services", func() telegraf.Input {
return &WinServices{}
})
}

View File

@ -23,6 +23,7 @@ See the [CONFIGURATION.md][CONFIGURATION.md] for more details.
```toml @sample.conf ```toml @sample.conf
# Input plugin to query Windows Management Instrumentation # Input plugin to query Windows Management Instrumentation
# This plugin ONLY supports Windows
[[inputs.win_wmi]] [[inputs.win_wmi]]
# specifies a prefix to attach to the measurement name # specifies a prefix to attach to the measurement name
name_prefix = "win_wmi_" name_prefix = "win_wmi_"

View File

@ -1,4 +1,5 @@
# Input plugin to query Windows Management Instrumentation # Input plugin to query Windows Management Instrumentation
# This plugin ONLY supports Windows
[[inputs.win_wmi]] [[inputs.win_wmi]]
[[inputs.win_wmi.query]] [[inputs.win_wmi.query]]
# a string representing the WMI namespace to be queried # a string representing the WMI namespace to be queried

View File

@ -1,4 +1,30 @@
//go:build !windows //go:build !windows
// +build !windows
package win_wmi package win_wmi
import (
_ "embed"
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/plugins/inputs"
)
//go:embed sample.conf
var sampleConfig string
type Wmi struct {
Log telegraf.Logger `toml:"-"`
}
func (w *Wmi) Init() error {
w.Log.Warn("current platform is not supported")
return nil
}
func (w *Wmi) SampleConfig() string { return sampleConfig }
func (w *Wmi) Gather(_ telegraf.Accumulator) error { return nil }
func init() {
inputs.Add("win_wmi", func() telegraf.Input {
return &Wmi{}
})
}