Adding upstream version 1.34.4.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
e393c3af3f
commit
4978089aab
4963 changed files with 677545 additions and 0 deletions
32
migrations/inputs_io/migration.go
Normal file
32
migrations/inputs_io/migration.go
Normal file
|
@ -0,0 +1,32 @@
|
|||
package inputs_io
|
||||
|
||||
import (
|
||||
"github.com/influxdata/toml"
|
||||
"github.com/influxdata/toml/ast"
|
||||
|
||||
"github.com/influxdata/telegraf/migrations"
|
||||
)
|
||||
|
||||
// Migration function
|
||||
func migrate(tbl *ast.Table) ([]byte, string, error) {
|
||||
// Load the plugin config and directly encode it again as we do not want to
|
||||
// modify anything beyond the name.
|
||||
|
||||
// Decode the old data structure
|
||||
var plugin interface{}
|
||||
if err := toml.UnmarshalTable(tbl, &plugin); err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
|
||||
// Create the corresponding metric configurations
|
||||
cfg := migrations.CreateTOMLStruct("inputs", "diskio")
|
||||
cfg.Add("inputs", "diskio", plugin)
|
||||
|
||||
output, err := toml.Marshal(cfg)
|
||||
return output, "", err
|
||||
}
|
||||
|
||||
// Register the migration function for the plugin type
|
||||
func init() {
|
||||
migrations.AddPluginMigration("inputs.io", migrate)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue