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
Add support for device types and predictable device paths (rebased) (#257)
* Add better error logging on smartctl exec failure
We will now log a warning if smartctl path passed via command line is invalid.
Signed-off-by: Piotr Dobrowolski <[email protected]>
(cherry picked from commit 1c9c694)
* Add support for autoscan device types and predictable device paths
This adds a new command line option allowing for customization of
autodetected device types and enables use of special "by-id" device type
that forces use of predictable device paths (/dev/disk/by-id/...)
Relevant change to device name parsing regular expression is included
now, so predictable device paths are now also usable when directly
specified.
Signed-off-by: Piotr Dobrowolski <[email protected]>
(cherry picked from commit 4c5f721)
Conflicts:
- file: 'readjson.go'
comment: 'manually resolve new logger issues'
* Rework device label, fix SATA discovery, per-device type specification
Signed-off-by: Piotr Dobrowolski <[email protected]>
(cherry picked from commit 319184c)
Conflicts:
- file: 'main.go'
comment: 'manually resolve new logger issues'
- file: 'readjson.go'
comment: 'manually resolve new logger issues'
---------
Co-authored-by: Piotr Dobrowolski <[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.",
98
103
).Default("10m").Duration()
104
+
smartctlScan=kingpin.Flag("smartctl.scan", "Enable scanning. This is a default if no devices are specified").Default("false").Bool()
99
105
smartctlDevices=kingpin.Flag("smartctl.device",
100
-
"The device to monitor (repeatable)",
106
+
"The device to monitor. Device type can be specified after a semicolon, eg. '/dev/bus/0;megaraid,1' (repeatable)",
101
107
).Strings()
102
108
smartctlDeviceExclude=kingpin.Flag(
103
109
"smartctl.device-exclude",
@@ -107,6 +113,10 @@ var (
107
113
"smartctl.device-include",
108
114
"Regexp of devices to exclude from automatic scanning. (mutually exclusive to device-exclude)",
109
115
).Default("").String()
116
+
smartctlScanDeviceTypes=kingpin.Flag(
117
+
"smartctl.scan-device-type",
118
+
"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.Info_Name)
131
+
logger.Error("Command line did not parse", "device", device)
122
132
result=false
123
133
}
124
134
if (b& (1<<1)) !=0 {
125
-
logger.Error("Device open failed, device did not return an IDENTIFY DEVICE structure, or device is in a low-power mode", "device", device.Info_Name)
135
+
logger.Error("Device open failed, device did not return an IDENTIFY DEVICE structure, or device is in a low-power mode", "device", device)
126
136
result=false
127
137
}
128
138
if (b& (1<<2)) !=0 {
129
-
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.Info_Name)
139
+
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)
130
140
}
131
141
if (b& (1<<3)) !=0 {
132
-
logger.Warn("SMART status check returned 'DISK FAILING'", "device", device.Info_Name)
142
+
logger.Warn("SMART status check returned 'DISK FAILING'", "device", device)
133
143
}
134
144
if (b& (1<<4)) !=0 {
135
-
logger.Warn("We found prefail Attributes <= threshold", "device", device.Info_Name)
145
+
logger.Warn("We found prefail Attributes <= threshold", "device", device)
136
146
}
137
147
if (b& (1<<5)) !=0 {
138
-
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.Info_Name)
148
+
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)
139
149
}
140
150
if (b& (1<<6)) !=0 {
141
-
logger.Warn("The device error log contains records of errors", "device", device.Info_Name)
151
+
logger.Warn("The device error log contains records of errors", "device", device)
142
152
}
143
153
if (b& (1<<7)) !=0 {
144
-
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.Info_Name)
154
+
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)
0 commit comments