chore(inputs.net): Deprecate 'ignore_protocol_stats' value 'false' (#13608)

This commit is contained in:
Sven Rebhan 2023-07-12 16:04:00 +02:00 committed by GitHub
parent d2dfca5def
commit d8f8d3cbc5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 2 deletions

View File

@ -27,8 +27,10 @@ See the [CONFIGURATION.md][CONFIGURATION.md] for more details.
## On linux systems telegraf also collects protocol stats.
## Setting ignore_protocol_stats to true will skip reporting of protocol metrics.
##
## DEPRECATION NOTICE: A value of 'false' is deprecated and discouraged!
## Please set this to `true` and use the 'inputs.nstat'
## plugin instead.
# ignore_protocol_stats = false
##
```
## Metrics

View File

@ -9,6 +9,7 @@ import (
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/filter"
"github.com/influxdata/telegraf/models"
"github.com/influxdata/telegraf/plugins/inputs"
"github.com/influxdata/telegraf/plugins/inputs/system"
)
@ -29,6 +30,20 @@ func (*NetIOStats) SampleConfig() string {
return sampleConfig
}
func (n *NetIOStats) Init() error {
if !n.IgnoreProtocolStats {
models.PrintOptionValueDeprecationNotice(telegraf.Warn, "inputs.net", "ignore_protocol_stats", "false",
telegraf.DeprecationInfo{
Since: "1.27.3",
RemovalIn: "1.36.0",
Notice: "use the 'inputs.nstat' plugin instead",
},
)
}
return nil
}
func (n *NetIOStats) Gather(acc telegraf.Accumulator) error {
netio, err := n.ps.NetIO()
if err != nil {

View File

@ -10,5 +10,7 @@
## On linux systems telegraf also collects protocol stats.
## Setting ignore_protocol_stats to true will skip reporting of protocol metrics.
##
## DEPRECATION NOTICE: A value of 'false' is deprecated and discouraged!
## Please set this to `true` and use the 'inputs.nstat'
## plugin instead.
# ignore_protocol_stats = false
##