You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cleanup: better logging for device & type, use Kingpin to check option values
* use kingpin to check `smartctl.powermode-check` option value
* better help message for `smartctl.powermode-check` with possible values
* better logging labels, with device name & type, without device path
Signed-off-by: Konstantin Shalygin <[email protected]>
"The interval between rescanning for new/disappeared devices. If the interval is smaller than 1s no rescanning takes place. If any devices are configured with smartctl.device also no rescanning takes place.",
104
+
"The interval between rescanning for new/disappeared devices. If the interval is smaller than 1s no rescanning takes place. If any devices are configured with smartctl.device also no rescanning takes place",
106
105
).Default("10m").Duration()
107
-
smartctlScan=kingpin.Flag("smartctl.scan", "Enable scanning. This is a default if no devices are specified").Default("false").Bool()
106
+
smartctlScan=kingpin.Flag("smartctl.scan", "Enable scanning. This is a default if no devices are specified",
107
+
).Default("false").Bool()
108
108
smartctlDevices=kingpin.Flag("smartctl.device",
109
109
"The device to monitor. Device type can be specified after a semicolon, eg. '/dev/bus/0;megaraid,1' (repeatable)",
110
110
).Strings()
111
111
smartctlDeviceExclude=kingpin.Flag(
112
112
"smartctl.device-exclude",
113
-
"Regexp of devices to exclude from automatic scanning. (mutually exclusive to device-include)",
113
+
"Regexp of devices to exclude from automatic scanning (mutually exclusive to device-include)",
114
114
).Default("").String()
115
115
smartctlDeviceInclude=kingpin.Flag(
116
116
"smartctl.device-include",
117
-
"Regexp of devices to exclude from automatic scanning. (mutually exclusive to device-exclude)",
117
+
"Regexp of devices to exclude from automatic scanning (mutually exclusive to device-exclude)",
118
118
).Default("").String()
119
119
smartctlScanDeviceTypes=kingpin.Flag(
120
120
"smartctl.scan-device-type",
121
-
"Device type to use during automatic scan. Special by-id value forces predictable device names. (repeatable)",
121
+
"Device type to use during automatic scan. Special by-id value forces predictable device names (repeatable)",
logger.Error("Command line did not parse", "device", device)
142
+
logger.Error("Command line did not parse", "device", device.Label, "type", device.Type)
143
143
result=false
144
144
}
145
145
if (b& (1<<1)) !=0 {
146
-
logger.Error("Device open failed, device did not return an IDENTIFY DEVICE structure, or device is in a low-power mode", "device", device)
146
+
logger.Error("Device open failed, device did not return an IDENTIFY DEVICE structure, or device is in a low-power mode", "device", device.Label, "type", device.Type)
147
147
result=false
148
148
}
149
149
if (b& (1<<2)) !=0 {
150
-
logger.Warn("Some SMART or other ATA command to the disk failed, or there was a checksum error in a SMART data structure", "device", device)
150
+
logger.Warn("Some SMART or other ATA command to the disk failed, or there was a checksum error in a SMART data structure", "device", device.Label, "type", device.Type)
151
151
}
152
152
if (b& (1<<3)) !=0 {
153
-
logger.Warn("SMART status check returned 'DISK FAILING'", "device", device)
153
+
logger.Warn("SMART status check returned 'DISK FAILING'", "device", device.Label, "type", device.Type)
154
154
}
155
155
if (b& (1<<4)) !=0 {
156
-
logger.Warn("We found prefail Attributes <= threshold", "device", device)
156
+
logger.Warn("We found prefail Attributes <= threshold", "device", device.Label, "type", device.Type)
157
157
}
158
158
if (b& (1<<5)) !=0 {
159
-
logger.Warn("SMART status check returned 'DISK OK' but we found that some (usage or prefail) Attributes have been <= threshold at some time in the past", "device", device)
159
+
logger.Warn("SMART status check returned 'DISK OK' but we found that some (usage or prefail) Attributes have been <= threshold at some time in the past", "device", device.Label, "type", device.Type)
160
160
}
161
161
if (b& (1<<6)) !=0 {
162
-
logger.Warn("The device error log contains records of errors", "device", device)
162
+
logger.Warn("The device error log contains records of errors", "device", device.Label, "type", device.Type)
163
163
}
164
164
if (b& (1<<7)) !=0 {
165
-
logger.Warn("The device self-test log contains records of errors. [ATA only] Failed self-tests outdated by a newer successful extended self-test are ignored", "device", device)
165
+
logger.Warn("The device self-test log contains records of errors. [ATA only] Failed self-tests outdated by a newer successful extended self-test are ignored", "device", device.Label, "type", device.Type)
0 commit comments