chore(go.d/snmp): remove unused ddsnmp (#20164)
Ilya Mashchenko committed
Apr 23, 2025 at 10:14 UTC
6db28b5b5344d6d00a8fe51c9dd00dc7a5118649
31 files changed
-1260
src/go/go.mod
-4
@@ -6,7 +6,6 @@ replace github.com/prometheus/prometheus => github.com/prometheus/prometheus v0.
6
7
require (
8
github.com/DATA-DOG/go-sqlmock v1.5.2
9
- github.com/DataDog/datadog-agent/pkg/networkdevice/profile v0.66.0-devel
9
github.com/Masterminds/sprig/v3 v3.3.0
10
github.com/Wing924/ltsv v0.4.0
11
github.com/apparentlymart/go-cidr v1.1.0
@@ -45,10 +44,8 @@ require (
44
github.com/prometheus/common v0.63.0
45
github.com/prometheus/prometheus v2.55.1+incompatible
46
github.com/redis/go-redis/v9 v9.7.3
48
- github.com/santhosh-tekuri/jsonschema/v5 v5.3.1
47
github.com/sijms/go-ora/v2 v2.8.24
48
github.com/sourcegraph/conc v0.3.0
51
- github.com/spf13/cobra v1.9.1
49
github.com/stretchr/testify v1.10.0
50
github.com/tidwall/gjson v1.18.0
51
github.com/valyala/fastjson v1.6.4
@@ -104,7 +101,6 @@ require (
101
github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc // indirect
102
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed // indirect
103
github.com/huandu/xstrings v1.5.0 // indirect
107
- github.com/inconshreveable/mousetrap v1.1.0 // indirect
104
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
105
github.com/jackc/pgconn v1.14.3 // indirect
106
github.com/jackc/pgio v1.0.0 // indirect
src/go/go.sum
-10
@@ -24,8 +24,6 @@ github.com/AzureAD/microsoft-authentication-library-for-go v1.3.2/go.mod h1:wP83
24
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
25
github.com/DATA-DOG/go-sqlmock v1.5.2 h1:OcvFkGmslmlZibjAjaHm3L//6LiuBgolP7OputlJIzU=
26
github.com/DATA-DOG/go-sqlmock v1.5.2/go.mod h1:88MAG/4G7SMwSE3CeA0ZKzrT5CiOU3OJ+JlNzwDqpNU=
27
-github.com/DataDog/datadog-agent/pkg/networkdevice/profile v0.66.0-devel h1:AbJgisK+FGeqf4aQmU88vAFkmxdUvert/w2/1lGTJyI=
28
-github.com/DataDog/datadog-agent/pkg/networkdevice/profile v0.66.0-devel/go.mod h1:1enYhQYfFxvRmPRpwCWfPDr9G+6++tpCXq+YVSoC1Eo=
27
github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI=
28
github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
29
github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
@@ -83,7 +81,6 @@ github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7
81
github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
82
github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs=
83
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
86
-github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
84
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
85
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
86
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -195,8 +192,6 @@ github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/b
192
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
193
github.com/huandu/xstrings v1.5.0 h1:2ag3IFq9ZDANvthTwTiqSSZLjDc+BedvHPAp5tJy2TI=
194
github.com/huandu/xstrings v1.5.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
198
-github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
199
-github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
195
github.com/invopop/jsonschema v0.13.0 h1:KvpoAJWEjR3uD9Kbm2HWJmqsEaHt8lBUpd0qHcIi21E=
196
github.com/invopop/jsonschema v0.13.0/go.mod h1:ffZ5Km5SWWRAIN6wbDXItl95euhFz2uON45H2qjYt+0=
197
github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo=
@@ -407,9 +402,6 @@ github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWN
402
github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
403
github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU=
404
github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc=
410
-github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
411
-github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 h1:lZUw3E0/J3roVtGQ+SCrUrg3ON6NgVqpn3+iol9aGu4=
412
-github.com/santhosh-tekuri/jsonschema/v5 v5.3.1/go.mod h1:uToXkOrWAZ6/Oc07xWQrPOhJotwFIyu2bBVN41fcDUY=
405
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
406
github.com/scylladb/termtables v0.0.0-20191203121021-c4c0b6d42ff4/go.mod h1:C1a7PQSMz9NShzorzCiG2fk9+xuCgLkPeCvMHYR2OWg=
407
github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4=
@@ -427,8 +419,6 @@ github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9yS
419
github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0=
420
github.com/spf13/cast v1.7.0 h1:ntdiHjuueXFgm5nzDRdOS4yfT43P5Fnud6DH50rz/7w=
421
github.com/spf13/cast v1.7.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
430
-github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo=
431
-github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0=
422
github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o=
423
github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
424
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
src/go/plugin/go.d/collector/snmp/ddsnmp/ddprofiledefinition/normalize_cmd/cmd/root.go
deleted
-125
@@ -1,125 +0,0 @@
1
-// Unless explicitly stated otherwise all files in this repository are licensed
2
-// under the Apache License Version 2.0.
3
-// This product includes software developed at Datadog (https://www.datadoghq.com/).
4
-// Copyright 2016-present Datadog, Inc.
5
-
6
-// Package cmd implements a cobra command for validating and normalizing profiles.
7
-package cmd
8
-
9
-import (
10
- "encoding/json"
11
- "fmt"
12
- "os"
13
- "path/filepath"
14
-
15
- "github.com/DataDog/datadog-agent/pkg/networkdevice/profile/profiledefinition"
16
- "github.com/spf13/cobra"
17
- "gopkg.in/yaml.v2"
18
-)
19
-
20
-// rootCmd represents the base command when called without any subcommands
21
-var rootCmd = &cobra.Command{
22
- Use: "normalize_cmd FILE [FILE...]",
23
- Short: "Validate and normalize profiles.",
24
- Long: `normalize_cmd is a tool for validating and normalizing profiles.
25
-
26
- Each profile file passed in will be parsed, and any errors in them will be
27
- reported. If an output directory is specified with -o, then the profiles will
28
- also be normalized, migrating legacy and deprecated structures to their
29
- modern counterparts, and written to the output directory.`,
30
-
31
- Run: func(cmd *cobra.Command, args []string) {
32
- outdir, err := cmd.Flags().GetString("outdir")
33
- if err != nil {
34
- fmt.Printf("parse failure %v, unable to generate output\n", err)
35
- }
36
- useJSON, err := cmd.Flags().GetBool("json")
37
- if err != nil {
38
- fmt.Printf("parse failure %v, unable to generate output\n", err)
39
- }
40
- for _, filePath := range args {
41
- filename := filepath.Base(filePath)
42
- name := filename[:len(filename)-len(filepath.Ext(filename))] // remove extension
43
- def, errors := GetProfile(filePath)
44
- if len(errors) > 0 {
45
- fmt.Printf("*** %d error(s) in profile %q ***\n", len(errors), filePath)
46
- for _, e := range errors {
47
- fmt.Println(" ", e)
48
- }
49
- fmt.Println()
50
- continue
51
- }
52
- if err := WriteProfile(def, name, outdir, useJSON); err != nil {
53
- fmt.Println(err)
54
- }
55
- }
56
- },
57
-}
58
-
59
-// GetProfile parses a profile from a file path and validates it.
60
-func GetProfile(filePath string) (*profiledefinition.ProfileDefinition, []string) {
61
- buf, err := os.ReadFile(filePath)
62
- if err != nil {
63
- return nil, []string{fmt.Sprintf("unable to read file: %v", err)}
64
- }
65
- def := profiledefinition.NewProfileDefinition()
66
- err = yaml.Unmarshal(buf, def)
67
- if err != nil {
68
- return nil, []string{fmt.Sprintf("unable to parse profile: %v", err)}
69
- }
70
- errors := profiledefinition.ValidateEnrichProfile(def)
71
- if len(errors) > 0 {
72
- return nil, errors
73
- }
74
- return def, nil
75
-}
76
-
77
-// WriteProfile writes a profile to disk.
78
-func WriteProfile(def *profiledefinition.ProfileDefinition, name string, outdir string, useJSON bool) error {
79
- if outdir == "" {
80
- return nil
81
- }
82
- var filename string
83
- var data []byte
84
- if useJSON {
85
- var err error
86
- filename = name + ".json"
87
- data, err = json.Marshal(def)
88
- if err != nil {
89
- return fmt.Errorf("unable to marshal profile %s: %w", name, err)
90
- }
91
- } else {
92
- var err error
93
- data, err = yaml.Marshal(def)
94
- filename = name + ".yaml"
95
- if err != nil {
96
- return fmt.Errorf("unable to marshal profile %s: %w", name, err)
97
- }
98
- }
99
- outfile := filepath.Join(outdir, filename)
100
- f, err := os.Create(outfile)
101
- if err != nil {
102
- return fmt.Errorf("unable to create file %s: %w", outfile, err)
103
- }
104
- defer func() {
105
- _ = f.Close()
106
- }()
107
- _, err = f.Write(data)
108
- if err != nil {
109
- return fmt.Errorf("unable to write to file %s: %w", outfile, err)
110
- }
111
- return nil
112
-}
113
-
114
-// Execute runs the command.
115
-func Execute() {
116
- err := rootCmd.Execute()
117
- if err != nil {
118
- os.Exit(1)
119
- }
120
-}
121
-
122
-func init() {
123
- rootCmd.Flags().StringP("outdir", "o", "", "Output path for normalized files. If blank, inputs will be validated but not output.")
124
- rootCmd.Flags().BoolP("json", "j", false, "Output as JSON")
125
-}
src/go/plugin/go.d/collector/snmp/ddsnmp/ddprofiledefinition/normalize_cmd/main.go
deleted
-11
@@ -1,11 +0,0 @@
1
-// Unless explicitly stated otherwise all files in this repository are licensed
2
-// under the Apache License Version 2.0.
3
-// This product includes software developed at Datadog (https://www.datadoghq.com/).
4
-// Copyright 2016-present Datadog, Inc.
5
-package main
6
-
7
-import "github.com/DataDog/datadog-agent/pkg/networkdevice/profile/profiledefinition/normalize_cmd/cmd"
8
-
9
-func main() {
10
- cmd.Execute()
11
-}
src/go/plugin/go.d/collector/snmp/ddsnmp/ddprofiledefinition/schema/doc.go
deleted
-7
@@ -1,7 +0,0 @@
1
-// Unless explicitly stated otherwise all files in this repository are licensed
2
-// under the Apache License Version 2.0.
3
-// This product includes software developed at Datadog (https://www.datadoghq.com/).
4
-// Copyright 2023-present Datadog, Inc.
5
-
6
-// Package schema contain json schema related code
7
-package schema
src/go/plugin/go.d/collector/snmp/ddsnmp/ddprofiledefinition/schema/generate.go
deleted
-26
@@ -1,26 +0,0 @@
1
-// Unless explicitly stated otherwise all files in this repository are licensed
2
-// under the Apache License Version 2.0.
3
-// This product includes software developed at Datadog (https://www.datadoghq.com/).
4
-// Copyright 2023-present Datadog, Inc.
5
-
6
-package schema
7
-
8
-import (
9
- "encoding/json"
10
- "github.com/DataDog/datadog-agent/pkg/networkdevice/profile/profiledefinition"
11
- "github.com/invopop/jsonschema"
12
-)
13
-
14
-// GenerateJSONSchema generate jsonschema from profiledefinition.DeviceProfileRcConfig
15
-func GenerateJSONSchema() ([]byte, error) {
16
- reflector := jsonschema.Reflector{
17
- AllowAdditionalProperties: false,
18
- }
19
- schema := reflector.Reflect(&profiledefinition.DeviceProfileRcConfig{})
20
- schemaJSON, err := json.MarshalIndent(schema, "", " ")
21
- if err != nil {
22
- return nil, err
23
- }
24
- schemaJSON = append(schemaJSON, byte('\n'))
25
- return schemaJSON, nil
26
-}
src/go/plugin/go.d/collector/snmp/ddsnmp/ddprofiledefinition/schema/generate_test.go
deleted
-20
@@ -1,20 +0,0 @@
1
-// Unless explicitly stated otherwise all files in this repository are licensed
2
-// under the Apache License Version 2.0.
3
-// This product includes software developed at Datadog (https://www.datadoghq.com/).
4
-// Copyright 2023-present Datadog, Inc.
5
-
6
-package schema
7
-
8
-import (
9
- "testing"
10
-
11
- "github.com/stretchr/testify/assert"
12
- "github.com/stretchr/testify/require"
13
-)
14
-
15
-func TestGenerateJSONSchemaIsInSync(t *testing.T) {
16
- schemaJSON, err := GenerateJSONSchema()
17
- require.NoError(t, err)
18
-
19
- assert.JSONEq(t, string(GetDeviceProfileRcConfigJsonschema()), string(schemaJSON))
20
-}
src/go/plugin/go.d/collector/snmp/ddsnmp/ddprofiledefinition/schema/profile_rc_schema.json
deleted
-463
@@ -1,463 +0,0 @@
1
-{
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://github.com/DataDog/datadog-agent/pkg/networkdevice/profile/profiledefinition/device-profile-rc-config",
4
- "$ref": "#/$defs/DeviceProfileRcConfig",
5
- "$defs": {
6
- "DeviceMeta": {
7
- "properties": {
8
- "vendor": {
9
- "type": "string"
10
- }
11
- },
12
- "additionalProperties": false,
13
- "type": "object"
14
- },
15
- "DeviceProfileRcConfig": {
16
- "properties": {
17
- "profile_definition": {
18
- "$ref": "#/$defs/ProfileDefinition"
19
- }
20
- },
21
- "additionalProperties": false,
22
- "type": "object",
23
- "required": [
24
- "profile_definition"
25
- ]
26
- },
27
- "ListMap[string]": {
28
- "items": {
29
- "properties": {
30
- "key": {
31
- "type": "string"
32
- },
33
- "value": {
34
- "type": "string"
35
- }
36
- },
37
- "additionalProperties": false,
38
- "type": "object",
39
- "required": [
40
- "key",
41
- "value"
42
- ]
43
- },
44
- "type": "array"
45
- },
46
- "MetadataConfig": {
47
- "items": {
48
- "properties": {
49
- "key": {
50
- "type": "string"
51
- },
52
- "value": {
53
- "properties": {
54
- "fields": {
55
- "items": {
56
- "properties": {
57
- "key": {
58
- "type": "string"
59
- },
60
- "value": {
61
- "properties": {
62
- "symbol": {
63
- "properties": {
64
- "OID": {
65
- "type": "string"
66
- },
67
- "name": {
68
- "type": "string"
69
- },
70
- "extract_value": {
71
- "type": "string"
72
- },
73
- "match_pattern": {
74
- "type": "string"
75
- },
76
- "match_value": {
77
- "type": "string"
78
- },
79
- "scale_factor": {
80
- "type": "number"
81
- },
82
- "format": {
83
- "type": "string"
84
- },
85
- "constant_value_one": {
86
- "type": "boolean"
87
- },
88
- "metric_type": {
89
- "type": "string"
90
- }
91
- },
92
- "additionalProperties": false,
93
- "type": "object"
94
- },
95
- "symbols": {
96
- "items": {
97
- "properties": {
98
- "OID": {
99
- "type": "string"
100
- },
101
- "name": {
102
- "type": "string"
103
- },
104
- "extract_value": {
105
- "type": "string"
106
- },
107
- "match_pattern": {
108
- "type": "string"
109
- },
110
- "match_value": {
111
- "type": "string"
112
- },
113
- "scale_factor": {
114
- "type": "number"
115
- },
116
- "format": {
117
- "type": "string"
118
- },
119
- "constant_value_one": {
120
- "type": "boolean"
121
- },
122
- "metric_type": {
123
- "type": "string"
124
- }
125
- },
126
- "additionalProperties": false,
127
- "type": "object"
128
- },
129
- "type": "array"
130
- },
131
- "value": {
132
- "type": "string"
133
- }
134
- },
135
- "additionalProperties": false,
136
- "type": "object"
137
- }
138
- },
139
- "additionalProperties": false,
140
- "type": "object",
141
- "required": [
142
- "key",
143
- "value"
144
- ]
145
- },
146
- "type": "array"
147
- },
148
- "id_tags": {
149
- "items": {
150
- "properties": {
151
- "tag": {
152
- "type": "string"
153
- },
154
- "index": {
155
- "type": "integer"
156
- },
157
- "symbol": {
158
- "properties": {
159
- "OID": {
160
- "type": "string"
161
- },
162
- "name": {
163
- "type": "string"
164
- },
165
- "extract_value": {
166
- "type": "string"
167
- },
168
- "match_pattern": {
169
- "type": "string"
170
- },
171
- "match_value": {
172
- "type": "string"
173
- },
174
- "scale_factor": {
175
- "type": "number"
176
- },
177
- "format": {
178
- "type": "string"
179
- },
180
- "constant_value_one": {
181
- "type": "boolean"
182
- },
183
- "metric_type": {
184
- "type": "string"
185
- }
186
- },
187
- "additionalProperties": false,
188
- "type": "object"
189
- },
190
- "index_transform": {
191
- "items": {
192
- "properties": {
193
- "start": {
194
- "type": "integer"
195
- },
196
- "end": {
197
- "type": "integer"
198
- }
199
- },
200
- "additionalProperties": false,
201
- "type": "object",
202
- "required": [
203
- "start",
204
- "end"
205
- ]
206
- },
207
- "type": "array"
208
- },
209
- "mapping": {
210
- "items": {
211
- "properties": {
212
- "key": {
213
- "type": "string"
214
- },
215
- "value": {
216
- "type": "string"
217
- }
218
- },
219
- "additionalProperties": false,
220
- "type": "object",
221
- "required": [
222
- "key",
223
- "value"
224
- ]
225
- },
226
- "type": "array"
227
- }
228
- },
229
- "additionalProperties": false,
230
- "type": "object",
231
- "required": [
232
- "tag"
233
- ]
234
- },
235
- "type": "array"
236
- }
237
- },
238
- "additionalProperties": false,
239
- "type": "object",
240
- "required": [
241
- "fields"
242
- ]
243
- }
244
- },
245
- "additionalProperties": false,
246
- "type": "object",
247
- "required": [
248
- "key",
249
- "value"
250
- ]
251
- },
252
- "type": "array"
253
- },
254
- "MetricIndexTransform": {
255
- "properties": {
256
- "start": {
257
- "type": "integer"
258
- },
259
- "end": {
260
- "type": "integer"
261
- }
262
- },
263
- "additionalProperties": false,
264
- "type": "object",
265
- "required": [
266
- "start",
267
- "end"
268
- ]
269
- },
270
- "MetricTagConfig": {
271
- "properties": {
272
- "tag": {
273
- "type": "string"
274
- },
275
- "index": {
276
- "type": "integer"
277
- },
278
- "symbol": {
279
- "$ref": "#/$defs/SymbolConfigCompat"
280
- },
281
- "index_transform": {
282
- "items": {
283
- "$ref": "#/$defs/MetricIndexTransform"
284
- },
285
- "type": "array"
286
- },
287
- "mapping": {
288
- "$ref": "#/$defs/ListMap[string]"
289
- }
290
- },
291
- "additionalProperties": false,
292
- "type": "object",
293
- "required": [
294
- "tag"
295
- ]
296
- },
297
- "MetricTagConfigList": {
298
- "items": {
299
- "$ref": "#/$defs/MetricTagConfig"
300
- },
301
- "type": "array"
302
- },
303
- "MetricsConfig": {
304
- "properties": {
305
- "MIB": {
306
- "type": "string"
307
- },
308
- "table": {
309
- "$ref": "#/$defs/SymbolConfig"
310
- },
311
- "symbol": {
312
- "$ref": "#/$defs/SymbolConfig"
313
- },
314
- "symbols": {
315
- "items": {
316
- "$ref": "#/$defs/SymbolConfig"
317
- },
318
- "type": "array"
319
- },
320
- "metric_tags": {
321
- "$ref": "#/$defs/MetricTagConfigList"
322
- },
323
- "options": {
324
- "$ref": "#/$defs/MetricsConfigOption"
325
- }
326
- },
327
- "additionalProperties": false,
328
- "type": "object"
329
- },
330
- "MetricsConfigOption": {
331
- "properties": {
332
- "placement": {
333
- "type": "integer"
334
- },
335
- "metric_suffix": {
336
- "type": "string"
337
- }
338
- },
339
- "additionalProperties": false,
340
- "type": "object"
341
- },
342
- "ProfileDefinition": {
343
- "properties": {
344
- "name": {
345
- "type": "string"
346
- },
347
- "description": {
348
- "type": "string"
349
- },
350
- "sysobjectid": {
351
- "$ref": "#/$defs/StringArray"
352
- },
353
- "extends": {
354
- "items": {
355
- "type": "string"
356
- },
357
- "type": "array"
358
- },
359
- "metadata": {
360
- "$ref": "#/$defs/MetadataConfig"
361
- },
362
- "metric_tags": {
363
- "items": {
364
- "$ref": "#/$defs/MetricTagConfig"
365
- },
366
- "type": "array"
367
- },
368
- "static_tags": {
369
- "items": {
370
- "type": "string"
371
- },
372
- "type": "array"
373
- },
374
- "metrics": {
375
- "items": {
376
- "$ref": "#/$defs/MetricsConfig"
377
- },
378
- "type": "array"
379
- },
380
- "device": {
381
- "$ref": "#/$defs/DeviceMeta"
382
- },
383
- "version": {
384
- "type": "integer"
385
- }
386
- },
387
- "additionalProperties": false,
388
- "type": "object"
389
- },
390
- "StringArray": {
391
- "items": {
392
- "type": "string"
393
- },
394
- "type": "array"
395
- },
396
- "SymbolConfig": {
397
- "properties": {
398
- "OID": {
399
- "type": "string"
400
- },
401
- "name": {
402
- "type": "string"
403
- },
404
- "extract_value": {
405
- "type": "string"
406
- },
407
- "match_pattern": {
408
- "type": "string"
409
- },
410
- "match_value": {
411
- "type": "string"
412
- },
413
- "scale_factor": {
414
- "type": "number"
415
- },
416
- "format": {
417
- "type": "string"
418
- },
419
- "constant_value_one": {
420
- "type": "boolean"
421
- },
422
- "metric_type": {
423
- "type": "string"
424
- }
425
- },
426
- "additionalProperties": false,
427
- "type": "object"
428
- },
429
- "SymbolConfigCompat": {
430
- "properties": {
431
- "OID": {
432
- "type": "string"
433
- },
434
- "name": {
435
- "type": "string"
436
- },
437
- "extract_value": {
438
- "type": "string"
439
- },
440
- "match_pattern": {
441
- "type": "string"
442
- },
443
- "match_value": {
444
- "type": "string"
445
- },
446
- "scale_factor": {
447
- "type": "number"
448
- },
449
- "format": {
450
- "type": "string"
451
- },
452
- "constant_value_one": {
453
- "type": "boolean"
454
- },
455
- "metric_type": {
456
- "type": "string"
457
- }
458
- },
459
- "additionalProperties": false,
460
- "type": "object"
461
- }
462
- }
463
-}
src/go/plugin/go.d/collector/snmp/ddsnmp/ddprofiledefinition/schema/profile_rc_schema_test.go
deleted
-100
@@ -1,100 +0,0 @@
1
-// Unless explicitly stated otherwise all files in this repository are licensed
2
-// under the Apache License Version 2.0.
3
-// This product includes software developed at Datadog (https://www.datadoghq.com/).
4
-// Copyright 2023-present Datadog, Inc.
5
-
6
-package schema
7
-
8
-import (
9
- "encoding/json"
10
- "fmt"
11
- "io/fs"
12
- "os"
13
- "path/filepath"
14
- "strings"
15
- "testing"
16
-
17
- "github.com/santhosh-tekuri/jsonschema/v5"
18
- "github.com/stretchr/testify/assert"
19
- "github.com/stretchr/testify/require"
20
-)
21
-
22
-type testcaseExpected struct {
23
- ErrorPatterns []string `json:"error_patterns"`
24
-}
25
-
26
-func Test_DeviceProfileRcConfigJsonSchema(t *testing.T) {
27
- // language=json
28
- instanceJSON := `{
29
- "profile_definition": {
30
- "name": "my-profile",
31
- "version": 10
32
- }
33
-}`
34
-
35
- err := assertAgainstSchema(t, instanceJSON)
36
-
37
- fmt.Printf("%#v\n", err) // using %#v prints errors hierarchy
38
- require.NoError(t, err)
39
-}
40
-
41
-func Test_Schema_TextCases(t *testing.T) {
42
- var testcases []string
43
- err := filepath.WalkDir("./testcases", func(s string, d fs.DirEntry, e error) error {
44
- if e != nil {
45
- return e
46
- }
47
- if strings.HasSuffix(d.Name(), "_exp.json") {
48
- return nil
49
- }
50
- if filepath.Ext(d.Name()) == ".json" {
51
- testcases = append(testcases, s)
52
- }
53
- return nil
54
- })
55
- require.NoError(t, err)
56
-
57
- for _, testcaseJSONPath := range testcases {
58
- t.Run(testcaseJSONPath, func(t *testing.T) {
59
- content, err := os.ReadFile(testcaseJSONPath)
60
- require.NoError(t, err)
61
-
62
- validationErr := assertAgainstSchema(t, string(content))
63
- validationErrStr := fmt.Sprintf("%#v\n", validationErr) // using %#v prints errors hierarchy
64
-
65
- if validationErr != nil {
66
- // Print validation error to ease debugging tests
67
- fmt.Print("--- ACTUAL VALIDATION ERRORS --------------------------------------------\n")
68
- fmt.Print(validationErrStr)
69
- fmt.Print("-------------------------------------------------------------------------\n")
70
- }
71
-
72
- testcaseExpectedErrPath := strings.ReplaceAll(testcaseJSONPath, ".json", "_exp.json")
73
- testcaseExpectedErr, err := os.ReadFile(testcaseExpectedErrPath)
74
- require.NoError(t, err)
75
-
76
- var expected testcaseExpected
77
- err = json.Unmarshal(testcaseExpectedErr, &expected)
78
- require.NoError(t, err)
79
-
80
- for _, expectedErrorPattern := range expected.ErrorPatterns {
81
- assert.Regexp(t, expectedErrorPattern, validationErrStr)
82
- }
83
- if len(expected.ErrorPatterns) == 0 {
84
- assert.NoError(t, validationErr)
85
- }
86
- })
87
- }
88
-}
89
-
90
-func assertAgainstSchema(t *testing.T, instanceJSON string) error {
91
- sch, err := jsonschema.CompileString("schema.json", string(GetDeviceProfileRcConfigJsonschema()))
92
- require.NoError(t, err)
93
-
94
- var v interface{}
95
- err = json.Unmarshal([]byte(instanceJSON), &v)
96
- require.NoError(t, err)
97
-
98
- err = sch.Validate(v)
99
- return err
100
-}
src/go/plugin/go.d/collector/snmp/ddsnmp/ddprofiledefinition/schema/schema.go
deleted
-18
@@ -1,18 +0,0 @@
1
-// Unless explicitly stated otherwise all files in this repository are licensed
2
-// under the Apache License Version 2.0.
3
-// This product includes software developed at Datadog (https://www.datadoghq.com/).
4
-// Copyright 2023-present Datadog, Inc.
5
-
6
-package schema
7
-
8
-import _ "embed"
9
-
10
-var (
11
- //go:embed profile_rc_schema.json
12
- deviceProfileRcConfigJsonschema []byte
13
-)
14
-
15
-// GetDeviceProfileRcConfigJsonschema returns deviceProfileRcConfigJsonschema
16
-func GetDeviceProfileRcConfigJsonschema() []byte {
17
- return deviceProfileRcConfigJsonschema
18
-}
src/go/plugin/go.d/collector/snmp/ddsnmp/ddprofiledefinition/schema/testcases/invalid_deprtd_forced_t.json
deleted
-14
@@ -1,14 +0,0 @@
1
-{
2
- "profile_definition": {
3
- "name": "some-profile",
4
- "metrics": [
5
- {
6
- "symbol": {
7
- "OID": "1.3.6.1.4.1.318.1.1.1.2.2.5.0",
8
- "name": "upsAdvBatteryNumOfBattPacks"
9
- },
10
- "forced_type": "gauge"
11
- }
12
- ]
13
- }
14
-}
src/go/plugin/go.d/collector/snmp/ddsnmp/ddprofiledefinition/schema/testcases/invalid_deprtd_forced_t_exp.json
deleted
-5
@@ -1,5 +0,0 @@
1
-{
2
- "error_patterns": [
3
- "defs/MetricsConfig/additionalProperties] additionalProperties 'forced_type' not allowed"
4
- ]
5
-}
src/go/plugin/go.d/collector/snmp/ddsnmp/ddprofiledefinition/schema/testcases/invalid_deprtd_oid_name.json
deleted
-11
@@ -1,11 +0,0 @@
1
-{
2
- "profile_definition": {
3
- "name": "some-profile",
4
- "metrics": [
5
- {
6
- "OID": "1.3.6.1.4.1.318.1.1.1.2.2.5.0",
7
- "name": "upsAdvBatteryNumOfBattPacks"
8
- }
9
- ]
10
- }
11
-}
src/go/plugin/go.d/collector/snmp/ddsnmp/ddprofiledefinition/schema/testcases/invalid_deprtd_oid_name_exp.json
deleted
-6
@@ -1,6 +0,0 @@
1
-{
2
- "error_patterns": [
3
- "MetricsConfig/additionalProperties] additionalProperties .*'OID'.* not allowed",
4
- "MetricsConfig/additionalProperties] additionalProperties .*'name'.* not allowed"
5
- ]
6
-}
src/go/plugin/go.d/collector/snmp/ddsnmp/ddprofiledefinition/schema/testcases/invalid_empty_profile.json
deleted
-1
@@ -1 +0,0 @@
1
-{}
src/go/plugin/go.d/collector/snmp/ddsnmp/ddprofiledefinition/schema/testcases/invalid_empty_profile_exp.json
deleted
-5
@@ -1,5 +0,0 @@
1
-{
2
- "error_patterns": [
3
- "missing properties: 'profile_definition'"
4
- ]
5
-}
src/go/plugin/go.d/collector/snmp/ddsnmp/ddprofiledefinition/schema/testcases/invalid_mult_errors.json
deleted
-6
@@ -1,6 +0,0 @@
1
-{
2
- "profile_definition": {
3
- "name": 123,
4
- "unknown_field": "abc"
5
- }
6
-}
src/go/plugin/go.d/collector/snmp/ddsnmp/ddprofiledefinition/schema/testcases/invalid_mult_errors_exp.json
deleted
-6
@@ -1,6 +0,0 @@
1
-{
2
- "error_patterns": [
3
- "ProfileDefinition/properties/name/type\\] expected string, but got number",
4
- "ProfileDefinition/additionalProperties] additionalProperties 'unknown_field' not allowed"
5
- ]
6
-}
src/go/plugin/go.d/collector/snmp/ddsnmp/ddprofiledefinition/schema/testcases/invalid_symbol_field.json
deleted
-49
@@ -1,49 +0,0 @@
1
-{
2
- "profile_definition": {
3
- "name": "apc-ups",
4
- "extends": [
5
- "apc.yaml"
6
- ],
7
- "sysobjectid": [
8
- "1.3.6.1.4.1.318.1.*"
9
- ],
10
- "device": {
11
- "vendor": "apc"
12
- },
13
- "metadata": {
14
- "device": {
15
- "fields": {
16
- "version": {
17
- "symbol": {
18
- "OID": "1.3.6.1.4.1.318.1.1.1.1.2.1.0",
19
- "name": "upsAdvIdentFirmwareRevision"
20
- }
21
- },
22
- "product_name": {
23
- "symbol": {
24
- "OID": "1.3.6.1.4.1.318.1.1.1.1.1.1.0",
25
- "name": "upsBasicIdentModel"
26
- }
27
- }
28
- }
29
- }
30
- },
31
- "metrics": [
32
- {
33
- "MIB": "PowerNet-MIB",
34
- "symbol": {
35
- "OID": "1.3.6.1.4.1.318.1.1.1.2.2.5.0",
36
- "name": "upsAdvBatteryNumOfBattPacks",
37
- "unknown_field": "value"
38
- }
39
- }
40
- ],
41
- "metric_tags": [
42
- {
43
- "tag": "model",
44
- "OID": "1.3.6.1.4.1.318.1.1.1.1.1.1.0",
45
- "symbol": "upsBasicIdentModel"
46
- }
47
- ]
48
- }
49
-}
src/go/plugin/go.d/collector/snmp/ddsnmp/ddprofiledefinition/schema/testcases/invalid_symbol_field_exp.json
deleted
-5
@@ -1,5 +0,0 @@
1
-{
2
- "error_patterns": [
3
- "defs/SymbolConfig/additionalProperties] additionalProperties 'unknown_field' not allowed"
4
- ]
5
-}
src/go/plugin/go.d/collector/snmp/ddsnmp/ddprofiledefinition/schema/testcases/invalid_unknown_field.json
deleted
-6
@@ -1,6 +0,0 @@
1
-{
2
- "profile_definition": {
3
- "name": "some-profile",
4
- "unknown_field": "abc"
5
- }
6
-}
src/go/plugin/go.d/collector/snmp/ddsnmp/ddprofiledefinition/schema/testcases/invalid_unknown_field_exp.json
deleted
-5
@@ -1,5 +0,0 @@
1
-{
2
- "error_patterns": [
3
- "additionalProperties 'unknown_field' not allowed"
4
- ]
5
-}
src/go/plugin/go.d/collector/snmp/ddsnmp/ddprofiledefinition/schema/testcases/valid_device_vendor.json
deleted
-9
@@ -1,9 +0,0 @@
1
-{
2
- "profile_definition": {
3
- "name": "some-profile",
4
- "version": 10,
5
- "device": {
6
- "vendor": "abc"
7
- }
8
- }
9
-}
src/go/plugin/go.d/collector/snmp/ddsnmp/ddprofiledefinition/schema/testcases/valid_device_vendor_exp.json
deleted
-4
@@ -1,4 +0,0 @@
1
-{
2
- "error_patterns": [
3
- ]
4
-}
src/go/plugin/go.d/collector/snmp/ddsnmp/ddprofiledefinition/schema/testcases/valid_empty_profile.json
deleted
-6
@@ -1,6 +0,0 @@
1
-{
2
- "profile_definition": {
3
- "name": "some-profile",
4
- "version": 10
5
- }
6
-}
src/go/plugin/go.d/collector/snmp/ddsnmp/ddprofiledefinition/schema/testcases/valid_empty_profile_exp.json
deleted
-4
@@ -1,4 +0,0 @@
1
-{
2
- "error_patterns": [
3
- ]
4
-}
src/go/plugin/go.d/collector/snmp/ddsnmp/ddprofiledefinition/schema/testcases/valid_metric_tag_mapping.json
deleted
-45
@@ -1,45 +0,0 @@
1
-{
2
- "profile_definition": {
3
- "name": "apc-ups",
4
- "version": 10,
5
- "extends": [
6
- "apc.yaml"
7
- ],
8
- "sysobjectid": [
9
- "1.3.6.1.4.1.318.1.*"
10
- ],
11
- "metrics": [
12
- {
13
- "MIB": "PowerNet-MIB",
14
- "table": {
15
- "OID": "1.3.6.1.4.1.318.1.1.1.12.1.2",
16
- "name": "upsOutletGroupStatusTable"
17
- },
18
- "symbols": [
19
- {
20
- "name": "upsOutletGroupStatus",
21
- "constant_value_one": true
22
- },
23
- {
24
- "OID": "1.3.6.1.4.1.318.1.1.1.12.1.2.1.3",
25
- "name": "upsOutletGroupStatusGroupState"
26
- }
27
- ],
28
- "metric_tags": [
29
- {
30
- "tag": "ups_outlet_group_status_group_state",
31
- "symbol": {
32
- "OID": "1.3.6.1.4.1.318.1.1.1.12.1.2.1.3",
33
- "name": "upsOutletGroupStatusGroupState"
34
- },
35
- "mapping": [
36
- {"key": "1", "value": "ups_outlet_group_status_on"},
37
- {"key": "2", "value": "ups_outlet_group_status_off"},
38
- {"key": "3", "value": "ups_outlet_group_status_unknown"}
39
- ]
40
- }
41
- ]
42
- }
43
- ]
44
- }
45
-}
src/go/plugin/go.d/collector/snmp/ddsnmp/ddprofiledefinition/schema/testcases/valid_metric_tag_mapping_exp.json
deleted
-4
@@ -1,4 +0,0 @@
1
-{
2
- "error_patterns": [
3
- ]
4
-}
src/go/plugin/go.d/collector/snmp/ddsnmp/ddprofiledefinition/schema/testcases/valid_profile_apc_ups.json
deleted
-246
@@ -1,246 +0,0 @@
1
-{
2
- "profile_definition": {
3
- "name": "apc-ups",
4
- "version": 10,
5
- "extends": [
6
- "apc.yaml"
7
- ],
8
- "sysobjectid": [
9
- "1.3.6.1.4.1.318.1.*"
10
- ],
11
- "device": {
12
- "vendor": "abc"
13
- },
14
- "metrics": [
15
- {
16
- "MIB": "PowerNet-MIB",
17
- "symbol": {
18
- "OID": "1.3.6.1.4.1.318.1.1.1.2.2.5.0",
19
- "name": "upsAdvBatteryNumOfBattPacks"
20
- }
21
- },
22
- {
23
- "MIB": "POWERNET-MIB",
24
- "symbol": {
25
- "OID": "1.3.6.1.4.1.318.1.1.1.2.2.6.0",
26
- "name": "upsAdvBatteryNumOfBadBattPacks"
27
- }
28
- },
29
- {
30
- "MIB": "PowerNet-MIB",
31
- "symbol": {
32
- "OID": "1.3.6.1.4.1.318.1.1.1.2.2.4.0",
33
- "name": "upsAdvBatteryReplaceIndicator"
34
- }
35
- },
36
- {
37
- "MIB": "PowerNet-MIB",
38
- "symbol": {
39
- "OID": "1.3.6.1.4.1.318.1.1.1.2.2.3.0",
40
- "name": "upsAdvBatteryRunTimeRemaining"
41
- }
42
- },
43
- {
44
- "MIB": "PowerNet-MIB",
45
- "symbol": {
46
- "OID": "1.3.6.1.4.1.318.1.1.1.2.2.2.0",
47
- "name": "upsAdvBatteryTemperature"
48
- }
49
- },
50
- {
51
- "MIB": "PowerNet-MIB",
52
- "symbol": {
53
- "OID": "1.3.6.1.4.1.318.1.1.1.2.2.1.0",
54
- "name": "upsAdvBatteryCapacity"
55
- }
56
- },
57
- {
58
- "MIB": "PowerNet-MIB",
59
- "symbol": {
60
- "OID": "1.3.6.1.4.1.318.1.1.1.2.3.2.0",
61
- "name": "upsHighPrecExtdBatteryTemperature"
62
- }
63
- },
64
- {
65
- "MIB": "PowerNet-MIB",
66
- "symbol": {
67
- "OID": "1.3.6.1.4.1.318.1.1.1.3.2.1.0",
68
- "name": "upsAdvInputLineVoltage"
69
- }
70
- },
71
- {
72
- "MIB": "PowerNet-MIB",
73
- "symbol": {
74
- "OID": "1.3.6.1.4.1.318.1.1.1.3.2.4.0",
75
- "name": "upsAdvInputFrequency"
76
- }
77
- },
78
- {
79
- "MIB": "PowerNet-MIB",
80
- "symbol": {
81
- "OID": "1.3.6.1.4.1.318.1.1.1.3.3.4.0",
82
- "name": "upsHighPrecInputFrequency"
83
- }
84
- },
85
- {
86
- "MIB": "PowerNet-MIB",
87
- "symbol": {
88
- "OID": "1.3.6.1.4.1.318.1.1.1.3.3.1.0",
89
- "name": "upsHighPrecInputLineVoltage"
90
- }
91
- },
92
- {
93
- "MIB": "PowerNet-MIB",
94
- "symbol": {
95
- "OID": "1.3.6.1.4.1.318.1.1.1.4.3.4.0",
96
- "name": "upsHighPrecOutputCurrent"
97
- }
98
- },
99
- {
100
- "MIB": "PowerNet-MIB",
101
- "symbol": {
102
- "OID": "1.3.6.1.4.1.318.1.1.1.3.2.5.0",
103
- "name": "upsAdvInputLineFailCause"
104
- }
105
- },
106
- {
107
- "MIB": "PowerNet-MIB",
108
- "symbol": {
109
- "OID": "1.3.6.1.4.1.318.1.1.1.4.2.1.0",
110
- "name": "upsAdvOutputVoltage"
111
- }
112
- },
113
- {
114
- "MIB": "PowerNet-MIB",
115
- "symbol": {
116
- "OID": "1.3.6.1.4.1.318.1.1.1.4.2.2.0",
117
- "name": "upsAdvOutputFrequency"
118
- }
119
- },
120
- {
121
- "MIB": "PowerNet-MIB",
122
- "symbol": {
123
- "OID": "1.3.6.1.4.1.318.1.1.1.4.2.3.0",
124
- "name": "upsAdvOutputLoad"
125
- }
126
- },
127
- {
128
- "MIB": "PowerNet-MIB",
129
- "symbol": {
130
- "OID": "1.3.6.1.4.1.318.1.1.1.4.2.4.0",
131
- "name": "upsAdvOutputCurrent"
132
- }
133
- },
134
- {
135
- "MIB": "PowerNet-MIB",
136
- "symbol": {
137
- "OID": "1.3.6.1.4.1.318.1.1.1.4.2.8.0",
138
- "name": "upsAdvOutputActivePower"
139
- }
140
- },
141
- {
142
- "MIB": "PowerNet-MIB",
143
- "symbol": {
144
- "OID": "1.3.6.1.4.1.318.1.1.1.4.2.9.0",
145
- "name": "upsAdvOutputApparentPower"
146
- }
147
- },
148
- {
149
- "MIB": "PowerNet-MIB",
150
- "symbol": {
151
- "OID": "1.3.6.1.4.1.318.1.1.1.4.2.12.0",
152
- "name": "upsAdvOutputEnergyUsage"
153
- }
154
- },
155
- {
156
- "MIB": "PowerNet-MIB",
157
- "symbol": {
158
- "OID": "1.3.6.1.4.1.318.1.1.1.2.1.2.0",
159
- "name": "upsBasicBatteryTimeOnBattery"
160
- }
161
- },
162
- {
163
- "MIB": "PowerNet-MIB",
164
- "symbol": {
165
- "OID": "1.3.6.1.4.1.318.1.1.1.7.2.3.0",
166
- "name": "upsAdvTestDiagnosticsResults"
167
- }
168
- },
169
- {
170
- "MIB": "PowerNet-MIB",
171
- "table": {
172
- "OID": "1.3.6.1.4.1.318.1.1.1.12.1.2",
173
- "name": "upsOutletGroupStatusTable"
174
- },
175
- "symbols": [
176
- {
177
- "name": "upsOutletGroupStatus",
178
- "constant_value_one": true
179
- },
180
- {
181
- "OID": "1.3.6.1.4.1.318.1.1.1.12.1.2.1.3",
182
- "name": "upsOutletGroupStatusGroupState"
183
- }
184
- ],
185
- "metric_tags": [
186
- {
187
- "tag": "outlet_group_name",
188
- "symbol": {
189
- "OID": "1.3.6.1.4.1.318.1.1.1.12.1.2.1.2",
190
- "name": "upsOutletGroupStatusName"
191
- }
192
- },
193
- {
194
- "tag": "ups_outlet_group_status_group_state",
195
- "symbol": {
196
- "OID": "1.3.6.1.4.1.318.1.1.1.12.1.2.1.3",
197
- "name": "upsOutletGroupStatusGroupState"
198
- },
199
- "mapping": [
200
- {"key": "1", "value": "ups_outlet_group_status_on"},
201
- {"key": "2", "value": "ups_outlet_group_status_off"},
202
- {"key": "3", "value": "ups_outlet_group_status_unknown"}
203
- ]
204
- }
205
- ]
206
- },
207
- {
208
- "MIB": "PowerNet-MIB",
209
- "symbol": {
210
- "OID": "1.3.6.1.4.1.318.1.1.25.1.2.1.6.0",
211
- "name": "uioSensorStatusTemperatureDegC"
212
- }
213
- }
214
- ],
215
- "metric_tags": [
216
- {
217
- "tag": "model",
218
- "symbol": {
219
- "OID": "1.3.6.1.4.1.318.1.1.1.1.1.1.0",
220
- "name": "upsBasicIdentModel"
221
- }
222
- },
223
- {
224
- "tag": "serial_num",
225
- "symbol": {
226
- "OID": "1.3.6.1.4.1.318.1.1.1.1.2.3.0",
227
- "name": "upsAdvIdentSerialNumber"
228
- }
229
- },
230
- {
231
- "tag": "firmware_version",
232
- "symbol": {
233
- "OID": "1.3.6.1.4.1.318.1.1.1.1.2.1.0",
234
- "name": "upsAdvIdentFirmwareRevision"
235
- }
236
- },
237
- {
238
- "tag": "ups_name",
239
- "symbol": {
240
- "OID": "1.3.6.1.4.1.318.1.1.1.1.1.2.0",
241
- "name": "upsBasicIdentName"
242
- }
243
- }
244
- ]
245
- }
246
-}
src/go/plugin/go.d/collector/snmp/ddsnmp/ddprofiledefinition/schema/testcases/valid_profile_apc_ups_exp.json
deleted
-4
@@ -1,4 +0,0 @@
1
-{
2
- "error_patterns": [
3
- ]
4
-}
src/go/plugin/go.d/collector/snmp/ddsnmp/ddprofiledefinition/schema_cmd/main.go
deleted
-35
@@ -1,35 +0,0 @@
1
-// Unless explicitly stated otherwise all files in this repository are licensed
2
-// under the Apache License Version 2.0.
3
-// This product includes software developed at Datadog (https://www.datadoghq.com/).
4
-// Copyright 2016-present Datadog, Inc.
5
-
6
-// Package main holds main related files
7
-package main
8
-
9
-import (
10
- "flag"
11
- "fmt"
12
- "github.com/DataDog/datadog-agent/pkg/networkdevice/profile/profiledefinition/schema"
13
- "os"
14
-)
15
-
16
-//go:generate go run ./main.go ../schema/profile_rc_schema.json
17
-
18
-func main() {
19
- var output string
20
-
21
- flag.StringVar(&output, "output", "../schema/profile_rc_schema.json", "Generate JSON schema generated file")
22
- flag.Parse()
23
-
24
- schemaJSON, err := schema.GenerateJSONSchema()
25
- if err != nil {
26
- panic(err)
27
- }
28
-
29
- err = os.WriteFile(output, schemaJSON, 0664)
30
- if err != nil {
31
- panic(err)
32
- }
33
-
34
- fmt.Printf("File generated at %s\n", output)
35
-}