Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zabbix/zabbix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEriks Sneiders <eriks.sneiders@zabbix.com>2022-03-24 10:44:49 +0300
committerEriks Sneiders <eriks.sneiders@zabbix.com>2022-03-31 17:47:12 +0300
commit06eca3fa072ce4d9fc2fab9ce2eb5b7635ef339a (patch)
treec8473e5bfc96d2287cc2630405d679ff7ff8e36b /src/go/plugins
parent4d5c3e359024af23d2706802e4440d51d6005bf4 (diff)
...G...... [ZBXNEXT-7559] fixed smart.disk.get[path] attribute raw field json key
Diffstat (limited to 'src/go/plugins')
-rw-r--r--src/go/plugins/smart/smart.go2
-rw-r--r--src/go/plugins/smart/smart_test.go16
-rw-r--r--src/go/plugins/smart/smartfs.go5
3 files changed, 14 insertions, 9 deletions
diff --git a/src/go/plugins/smart/smart.go b/src/go/plugins/smart/smart.go
index bdb28fe01b2..793d9591ff5 100644
--- a/src/go/plugins/smart/smart.go
+++ b/src/go/plugins/smart/smart.go
@@ -269,7 +269,7 @@ func setSingleDiskFields(dev []byte) (out map[string]interface{}, err error) {
}
for _, a := range sd.SmartAttributes.Table {
- out[strings.ToLower(a.Name)] = a.Raw
+ out[strings.ToLower(a.Name)] = singleRequestAttribute{a.Raw.Value, a.Raw.Str}
}
return
diff --git a/src/go/plugins/smart/smart_test.go b/src/go/plugins/smart/smart_test.go
index 250454165c3..464b7a39695 100644
--- a/src/go/plugins/smart/smart_test.go
+++ b/src/go/plugins/smart/smart_test.go
@@ -247,13 +247,13 @@ func Test_setSingleDiskFields(t *testing.T) {
"self_test_passed": &selftestSuccess,
"serial_number": "Z4Y7SJBD",
"temperature": 30,
- "raw_read_error_rate": rawField{
+ "raw_read_error_rate": singleRequestAttribute{
Value: 182786912,
- Str: "182786912",
+ Raw: "182786912",
},
- "spin_up_time": rawField{
+ "spin_up_time": singleRequestAttribute{
Value: 0,
- Str: "0",
+ Raw: "0",
},
},
false,
@@ -274,13 +274,13 @@ func Test_setSingleDiskFields(t *testing.T) {
"self_test_passed": &selftestSuccess,
"serial_number": "D486530350",
"temperature": 18,
- "raw_read_error_rate": rawField{
+ "raw_read_error_rate": singleRequestAttribute{
Value: 0,
- Str: "0",
+ Raw: "0",
},
- "reallocated_sector_ct": rawField{
+ "reallocated_sector_ct": singleRequestAttribute{
Value: 10,
- Str: "10",
+ Raw: "10",
},
},
false,
diff --git a/src/go/plugins/smart/smartfs.go b/src/go/plugins/smart/smartfs.go
index a485a947e45..7fe0d8cad65 100644
--- a/src/go/plugins/smart/smartfs.go
+++ b/src/go/plugins/smart/smartfs.go
@@ -116,6 +116,11 @@ type singelRequestRaw struct {
Raw rawField `json:"raw"`
}
+type singleRequestAttribute struct {
+ Value int `json:"value"`
+ Raw string `json:"raw"`
+}
+
type rawField struct {
Value int `json:"value"`
Str string `json:"string"`