Log warning when wireless plugin is used on unsupported platform (#4986)
This commit is contained in:
parent
46b340c899
commit
140387d2c3
|
@ -110,6 +110,11 @@ func runAgent(ctx context.Context,
|
||||||
inputFilters []string,
|
inputFilters []string,
|
||||||
outputFilters []string,
|
outputFilters []string,
|
||||||
) error {
|
) error {
|
||||||
|
// Setup default logging. This may need to change after reading the config
|
||||||
|
// file, but we can configure it to use our logger implementation now.
|
||||||
|
logger.SetupLogging(false, false, "")
|
||||||
|
log.Printf("I! Starting Telegraf %s", version)
|
||||||
|
|
||||||
// If no other options are specified, load the config file and run.
|
// If no other options are specified, load the config file and run.
|
||||||
c := config.NewConfig()
|
c := config.NewConfig()
|
||||||
c.OutputFilters = outputFilters
|
c.OutputFilters = outputFilters
|
||||||
|
@ -147,7 +152,7 @@ func runAgent(ctx context.Context,
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup logging
|
// Setup logging as configured.
|
||||||
logger.SetupLogging(
|
logger.SetupLogging(
|
||||||
ag.Config.Agent.Debug || *fDebug,
|
ag.Config.Agent.Debug || *fDebug,
|
||||||
ag.Config.Agent.Quiet || *fQuiet,
|
ag.Config.Agent.Quiet || *fQuiet,
|
||||||
|
@ -158,7 +163,6 @@ func runAgent(ctx context.Context,
|
||||||
return ag.Test(ctx)
|
return ag.Test(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Printf("I! Starting Telegraf %s\n", version)
|
|
||||||
log.Printf("I! Loaded inputs: %s", strings.Join(c.InputNames(), " "))
|
log.Printf("I! Loaded inputs: %s", strings.Join(c.InputNames(), " "))
|
||||||
log.Printf("I! Loaded aggregators: %s", strings.Join(c.AggregatorNames(), " "))
|
log.Printf("I! Loaded aggregators: %s", strings.Join(c.AggregatorNames(), " "))
|
||||||
log.Printf("I! Loaded processors: %s", strings.Join(c.ProcessorNames(), " "))
|
log.Printf("I! Loaded processors: %s", strings.Join(c.ProcessorNames(), " "))
|
||||||
|
|
|
@ -1,3 +1,33 @@
|
||||||
// +build !linux
|
|
||||||
|
|
||||||
package wireless
|
package wireless
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/influxdata/telegraf"
|
||||||
|
"github.com/influxdata/telegraf/plugins/inputs"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Wireless is used to store configuration values.
|
||||||
|
type Wireless struct {
|
||||||
|
HostProc string `toml:"host_proc"`
|
||||||
|
}
|
||||||
|
|
||||||
|
var sampleConfig = `
|
||||||
|
## Sets 'proc' directory path
|
||||||
|
## If not specified, then default is /proc
|
||||||
|
# host_proc = "/proc"
|
||||||
|
`
|
||||||
|
|
||||||
|
// Description returns information about the plugin.
|
||||||
|
func (w *Wireless) Description() string {
|
||||||
|
return "Monitor wifi signal strength and quality"
|
||||||
|
}
|
||||||
|
|
||||||
|
// SampleConfig displays configuration instructions.
|
||||||
|
func (w *Wireless) SampleConfig() string {
|
||||||
|
return sampleConfig
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
inputs.Add("wireless", func() telegraf.Input {
|
||||||
|
return &Wireless{}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
@ -40,27 +40,6 @@ type wirelessInterface struct {
|
||||||
Beacon int64
|
Beacon int64
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wireless is used to store configuration values.
|
|
||||||
type Wireless struct {
|
|
||||||
HostProc string `toml:"host_proc"`
|
|
||||||
}
|
|
||||||
|
|
||||||
var sampleConfig = `
|
|
||||||
## Sets 'proc' directory path
|
|
||||||
## If not specified, then default is /proc
|
|
||||||
# host_proc = "/proc"
|
|
||||||
`
|
|
||||||
|
|
||||||
// Description returns information about the plugin.
|
|
||||||
func (w *Wireless) Description() string {
|
|
||||||
return "Monitor wifi signal strength and quality"
|
|
||||||
}
|
|
||||||
|
|
||||||
// SampleConfig displays configuration instructions.
|
|
||||||
func (w *Wireless) SampleConfig() string {
|
|
||||||
return sampleConfig
|
|
||||||
}
|
|
||||||
|
|
||||||
// Gather collects the wireless information.
|
// Gather collects the wireless information.
|
||||||
func (w *Wireless) Gather(acc telegraf.Accumulator) error {
|
func (w *Wireless) Gather(acc telegraf.Accumulator) error {
|
||||||
// load proc path, get default value if config value and env variable are empty
|
// load proc path, get default value if config value and env variable are empty
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
// +build !linux
|
||||||
|
|
||||||
|
package wireless
|
||||||
|
|
||||||
|
import (
|
||||||
|
"log"
|
||||||
|
|
||||||
|
"github.com/influxdata/telegraf"
|
||||||
|
"github.com/influxdata/telegraf/plugins/inputs"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (w *Wireless) Gather(acc telegraf.Accumulator) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
inputs.Add("wireless", func() telegraf.Input {
|
||||||
|
log.Print("W! [inputs.wireless] Current platform is not supported")
|
||||||
|
return &Wireless{}
|
||||||
|
})
|
||||||
|
}
|
Loading…
Reference in New Issue