feat(inputs.smart): Add Power on Hours and Cycle Count (#16230)
This commit is contained in:
parent
e8b84ce6d9
commit
e4b2e927d7
|
|
@ -88,6 +88,8 @@ var (
|
||||||
"1": "read_error_rate",
|
"1": "read_error_rate",
|
||||||
"5": "reallocated_sectors_count",
|
"5": "reallocated_sectors_count",
|
||||||
"7": "seek_error_rate",
|
"7": "seek_error_rate",
|
||||||
|
"9": "power_on_hours",
|
||||||
|
"12": "power_cycle_count",
|
||||||
"10": "spin_retry_count",
|
"10": "spin_retry_count",
|
||||||
"184": "end_to_end_error",
|
"184": "end_to_end_error",
|
||||||
"187": "uncorrectable_errors",
|
"187": "uncorrectable_errors",
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ func TestGatherAttributes(t *testing.T) {
|
||||||
err := s.Gather(&acc)
|
err := s.Gather(&acc)
|
||||||
|
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, 68, acc.NFields(), "Wrong number of fields gathered")
|
require.Equal(t, 70, acc.NFields(), "Wrong number of fields gathered")
|
||||||
|
|
||||||
for _, test := range testsAda0Attributes {
|
for _, test := range testsAda0Attributes {
|
||||||
acc.AssertContainsTaggedFields(t, "smart_attribute", test.fields, test.tags)
|
acc.AssertContainsTaggedFields(t, "smart_attribute", test.fields, test.tags)
|
||||||
|
|
@ -172,7 +172,7 @@ func TestGatherNoAttributes(t *testing.T) {
|
||||||
err := s.Gather(&acc)
|
err := s.Gather(&acc)
|
||||||
|
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, 11, acc.NFields(), "Wrong number of fields gathered")
|
require.Equal(t, 13, acc.NFields(), "Wrong number of fields gathered")
|
||||||
acc.AssertDoesNotContainMeasurement(t, "smart_attribute")
|
acc.AssertDoesNotContainMeasurement(t, "smart_attribute")
|
||||||
|
|
||||||
for _, test := range testsAda0Device {
|
for _, test := range testsAda0Device {
|
||||||
|
|
@ -213,7 +213,7 @@ func TestGatherSATAInfo(t *testing.T) {
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
|
|
||||||
sampleSmart.gatherDisk(acc, "", wg)
|
sampleSmart.gatherDisk(acc, "", wg)
|
||||||
require.Equal(t, 106, acc.NFields(), "Wrong number of fields gathered")
|
require.Equal(t, 108, acc.NFields(), "Wrong number of fields gathered")
|
||||||
require.Equal(t, uint64(20), acc.NMetrics(), "Wrong number of metrics gathered")
|
require.Equal(t, uint64(20), acc.NMetrics(), "Wrong number of metrics gathered")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -229,7 +229,7 @@ func TestGatherSATAInfo65(t *testing.T) {
|
||||||
|
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
sampleSmart.gatherDisk(acc, "", wg)
|
sampleSmart.gatherDisk(acc, "", wg)
|
||||||
require.Equal(t, 96, acc.NFields(), "Wrong number of fields gathered")
|
require.Equal(t, 98, acc.NFields(), "Wrong number of fields gathered")
|
||||||
require.Equal(t, uint64(18), acc.NMetrics(), "Wrong number of metrics gathered")
|
require.Equal(t, uint64(18), acc.NMetrics(), "Wrong number of metrics gathered")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -294,7 +294,7 @@ func TestGatherSSD(t *testing.T) {
|
||||||
|
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
sampleSmart.gatherDisk(acc, "", wg)
|
sampleSmart.gatherDisk(acc, "", wg)
|
||||||
require.Equal(t, 110, acc.NFields(), "Wrong number of fields gathered")
|
require.Equal(t, 112, acc.NFields(), "Wrong number of fields gathered")
|
||||||
require.Equal(t, uint64(26), acc.NMetrics(), "Wrong number of metrics gathered")
|
require.Equal(t, uint64(26), acc.NMetrics(), "Wrong number of metrics gathered")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -310,7 +310,7 @@ func TestGatherSSDRaid(t *testing.T) {
|
||||||
|
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
sampleSmart.gatherDisk(acc, "", wg)
|
sampleSmart.gatherDisk(acc, "", wg)
|
||||||
require.Equal(t, 77, acc.NFields(), "Wrong number of fields gathered")
|
require.Equal(t, 79, acc.NFields(), "Wrong number of fields gathered")
|
||||||
require.Equal(t, uint64(15), acc.NMetrics(), "Wrong number of metrics gathered")
|
require.Equal(t, uint64(15), acc.NMetrics(), "Wrong number of metrics gathered")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1492,6 +1492,8 @@ var (
|
||||||
"wear_leveling_count": int64(185),
|
"wear_leveling_count": int64(185),
|
||||||
"pending_sector_count": int64(0),
|
"pending_sector_count": int64(0),
|
||||||
"reallocated_sectors_count": int64(0),
|
"reallocated_sectors_count": int64(0),
|
||||||
|
"power_cycle_count": int64(14879),
|
||||||
|
"power_on_hours": int64(2988),
|
||||||
},
|
},
|
||||||
map[string]string{
|
map[string]string{
|
||||||
"device": "ada0",
|
"device": "ada0",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue