Skip to content

Commit c1d7c86

Browse files
committed
chore(outputs.amon)!: Remove deprecated plugin
The Amon service no longer exists and the platform code is unmaintained, so the plugin was deprecated in v1.37.0 for removal in v1.40.0. Remove it and add a migration that drops the plugin from the configuration on 'telegraf config migrate', as there is no replacement.
1 parent 0ab75b1 commit c1d7c86

8 files changed

Lines changed: 54 additions & 300 deletions

File tree

migrations/all/outputs_amon.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
//go:build !custom || (migrations && (outputs || outputs.amon))
2+
3+
package all
4+
5+
import _ "github.com/influxdata/telegraf/migrations/outputs_amon" // register migration
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package outputs_amon
2+
3+
import (
4+
"github.com/influxdata/toml/ast"
5+
6+
"github.com/influxdata/telegraf/migrations"
7+
)
8+
9+
const msg = `
10+
The 'outputs.amon' plugin has been removed as the Amon service no longer
11+
exists. There is no replacement; please remove the plugin from your
12+
configuration.
13+
`
14+
15+
// Migration function
16+
func migrate(_ *ast.Table) ([]byte, string, error) {
17+
return nil, msg, nil
18+
}
19+
20+
// Register the migration function for the plugin type
21+
func init() {
22+
migrations.AddPluginMigration("outputs.amon", migrate)
23+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package outputs_amon_test
2+
3+
import (
4+
"strings"
5+
"testing"
6+
7+
"github.com/stretchr/testify/require"
8+
9+
"github.com/influxdata/telegraf/config"
10+
_ "github.com/influxdata/telegraf/migrations/outputs_amon" // register migration
11+
)
12+
13+
func TestMigration(t *testing.T) {
14+
input := []byte(`
15+
[[outputs.amon]]
16+
server_key = "my-server-key"
17+
amon_instance = "https://youramoninstance"
18+
timeout = "5s"
19+
`)
20+
21+
// The plugin has no replacement, so the migration drops it
22+
output, n, err := config.ApplyMigrations(input)
23+
require.NoError(t, err)
24+
require.Empty(t, strings.TrimSpace(string(output)))
25+
require.Equal(t, uint64(1), n)
26+
}

plugins/outputs/all/amon.go

Lines changed: 0 additions & 5 deletions
This file was deleted.

plugins/outputs/amon/README.md

Lines changed: 0 additions & 45 deletions
This file was deleted.

plugins/outputs/amon/amon.go

Lines changed: 0 additions & 151 deletions
This file was deleted.

plugins/outputs/amon/amon_test.go

Lines changed: 0 additions & 89 deletions
This file was deleted.

plugins/outputs/amon/sample.conf

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)