@@ -78,42 +78,42 @@ def _test_parse_device_info(self, fixture_name):
78
78
79
79
# The device_info line should exist for every device
80
80
device_info_found = any (
81
- line .startswith ("device_info {" ) and
81
+ line .startswith ("smartmon_device_info {" ) and
82
82
f'disk="{ dev_name } "' in line and
83
83
f'type="{ dev_iface } "' in line and
84
84
f'serial_number="{ dev_serial } "' in line
85
85
for line in metrics
86
86
)
87
87
self .assertTrue (
88
88
device_info_found ,
89
- f"Expected a device_info metric line for { dev_name } but didn't find it."
89
+ f"Expected a smartmon_device_info metric line for { dev_name } but didn't find it."
90
90
)
91
91
92
92
# If smart_capable is true, we expect device_smart_available = 1
93
93
if device_info .get ("smart_capable" ):
94
94
smart_available_found = any (
95
- line .startswith ("device_smart_available {" ) and
95
+ line .startswith ("smartmon_device_smart_available {" ) and
96
96
f'disk="{ dev_name } "' in line and
97
97
f'serial_number="{ dev_serial } "' in line and
98
98
line .endswith (" 1.0" )
99
99
for line in metrics
100
100
)
101
101
self .assertTrue (
102
102
smart_available_found ,
103
- f"Expected device_smart_available =1.0 for { dev_name } , not found."
103
+ f"Expected smartmon_device_smart_available =1.0 for { dev_name } , not found."
104
104
)
105
105
106
106
# If smart_enabled is true, we expect device_smart_enabled = 1
107
107
if device_info .get ("smart_enabled" ):
108
108
smart_enabled_found = any (
109
- line .startswith ("device_smart_enabled {" ) and
109
+ line .startswith ("smartmon_device_smart_enabled {" ) and
110
110
f'disk="{ dev_name } "' in line and
111
111
line .endswith (" 1.0" )
112
112
for line in metrics
113
113
)
114
114
self .assertTrue (
115
115
smart_enabled_found ,
116
- f"Expected device_smart_enabled =1.0 for { dev_name } , not found."
116
+ f"Expected smartmon_device_smart_enabled =1.0 for { dev_name } , not found."
117
117
)
118
118
119
119
# device_smart_healthy if assessment in [PASS, WARN, FAIL]
@@ -122,14 +122,14 @@ def _test_parse_device_info(self, fixture_name):
122
122
if assessment in ["PASS" , "WARN" , "FAIL" ]:
123
123
expected_val = float (1 ) if assessment == "PASS" else float (0 )
124
124
smart_healthy_found = any (
125
- line .startswith ("device_smart_healthy {" ) and
125
+ line .startswith ("smartmon_device_smart_healthy {" ) and
126
126
f'disk="{ dev_name } "' in line and
127
127
line .endswith (f" { expected_val } " )
128
128
for line in metrics
129
129
)
130
130
self .assertTrue (
131
131
smart_healthy_found ,
132
- f"Expected device_smart_healthy ={ expected_val } for { dev_name } , not found."
132
+ f"Expected smartmon_device_smart_healthy ={ expected_val } for { dev_name } , not found."
133
133
)
134
134
135
135
def test_parse_device_info (self ):
@@ -164,7 +164,7 @@ def _test_parse_if_attributes(self, fixture_name):
164
164
165
165
if isinstance (attr_val , (int , float )) and snake_key in SMARTMON_ATTRS :
166
166
expected_line = (
167
- f"{ snake_key } {{disk=\" { dev_name } \" ,serial_number=\" { dev_serial } \" ,type=\" { dev_iface } \" }} { float (attr_val )} "
167
+ f"smartmon_ { snake_key } {{disk=\" { dev_name } \" ,serial_number=\" { dev_serial } \" ,type=\" { dev_iface } \" }} { float (attr_val )} "
168
168
)
169
169
self .assertIn (
170
170
expected_line ,
@@ -175,7 +175,7 @@ def _test_parse_if_attributes(self, fixture_name):
175
175
# If it's not in SMARTMON_ATTRS or not numeric,
176
176
# we do NOT expect a line with that name+value
177
177
unexpected_line = (
178
- f"{ snake_key } {{disk=\" { dev_name } \" ,serial_number=\" { dev_serial } \" ,type=\" { dev_iface } \" }} { float (attr_val )} "
178
+ f"smartmon_ { snake_key } {{disk=\" { dev_name } \" ,serial_number=\" { dev_serial } \" ,type=\" { dev_iface } \" }} { float (attr_val )} "
179
179
)
180
180
self .assertNotIn (
181
181
unexpected_line ,
@@ -268,8 +268,8 @@ def run_command_side_effect(cmd, parse_json=False):
268
268
self .assertTrue (found , f"Expected metric '{ expected } ' not found" )
269
269
270
270
# Check that smartctl_version metric is present
271
- version_found = any (line .startswith ("smartctl_version {" ) for line in metrics_lines )
272
- self .assertTrue (version_found , "Expected 'smartctl_version ' metric not found in output file." )
271
+ version_found = any (line .startswith ("smartmon_smartctl_version {" ) for line in metrics_lines )
272
+ self .assertTrue (version_found , "Expected 'smartmon_smartctl_version ' metric not found in output file." )
273
273
274
274
# Check that the output file is not empty
275
275
self .assertTrue (metrics_lines , "Metrics output file is empty." )
0 commit comments