Lines 59-65
def parseCmdLine(args):
Link Here
|
59 |
metavar="LEVEL", help="set verbosity level to LEVEL; defaults to 0 (quiet), \ |
59 |
metavar="LEVEL", help="set verbosity level to LEVEL; defaults to 0 (quiet), \ |
60 |
possible values go up to 3") |
60 |
possible values go up to 3") |
61 |
parser.add_option("-t", "--type", action="store", dest="devtype", default="ata", metavar="DEVTYPE", |
61 |
parser.add_option("-t", "--type", action="store", dest="devtype", default="ata", metavar="DEVTYPE", |
62 |
help="type of device (ATA|SCSI)") |
62 |
help="type of device (ata|scsi)") |
63 |
parser.add_option("-w", "--warning-threshold", metavar="TEMP", action="store", |
63 |
parser.add_option("-w", "--warning-threshold", metavar="TEMP", action="store", |
64 |
type="int", dest="warningThreshold", default=55, |
64 |
type="int", dest="warningThreshold", default=55, |
65 |
help="set temperature warning threshold to given temperature (defaults to 55)") |
65 |
help="set temperature warning threshold to given temperature (defaults to 55)") |
Lines 161-169
def parseOutput(healthMessage, temperatureMessage, dev
Link Here
|
161 |
lines = healthMessage.split("\n") |
161 |
lines = healthMessage.split("\n") |
162 |
getNext = 0 |
162 |
getNext = 0 |
163 |
for line in lines: |
163 |
for line in lines: |
|
|
164 |
vprint(3, "parseOutput: line is: '%s'" % line) |
164 |
if getNext: |
165 |
if getNext: |
165 |
statusLine = line |
166 |
if line <> "SMART STATUS RETURN: incomplete response, ATA output registers missing" and \ |
166 |
break |
167 |
line <> "SMART Status not supported: Incomplete response, ATA output registers missing" : |
|
|
168 |
statusLine = line |
169 |
break |
167 |
elif line == "=== START OF READ SMART DATA SECTION ===": |
170 |
elif line == "=== START OF READ SMART DATA SECTION ===": |
168 |
getNext = 1 |
171 |
getNext = 1 |
169 |
# fi |
172 |
# fi |
Lines 181-187
def parseOutput(healthMessage, temperatureMessage, dev
Link Here
|
181 |
parts = line.split() |
184 |
parts = line.split() |
182 |
if len(parts): |
185 |
if len(parts): |
183 |
# 194 is the temperature value id |
186 |
# 194 is the temperature value id |
184 |
if parts[0] == "194": |
187 |
if parts[0] == "194" or parts[0] == "190": |
185 |
temperature = int(parts[9]) |
188 |
temperature = int(parts[9]) |
186 |
break |
189 |
break |
187 |
# fi |
190 |
# fi |
Lines 225-230
def createReturnInfo(healthStatus, temperature, warnin
Link Here
|
225 |
|
228 |
|
226 |
# this is absolutely critical! |
229 |
# this is absolutely critical! |
227 |
if healthStatus not in [ "PASSED", "OK" ]: |
230 |
if healthStatus not in [ "PASSED", "OK" ]: |
|
|
231 |
vprint(2, "Health status: %s" % healthStatus) |
228 |
return (2, "CRITICAL: device does not pass health status") |
232 |
return (2, "CRITICAL: device does not pass health status") |
229 |
# fi |
233 |
# fi |
230 |
|
234 |
|
Lines 287-297
if __name__ == "__main__":
Link Here
|
287 |
# check device type, ATA is default |
291 |
# check device type, ATA is default |
288 |
vprint(2, "Get device type") |
292 |
vprint(2, "Get device type") |
289 |
devtype = options.devtype |
293 |
devtype = options.devtype |
|
|
294 |
vprint(2, "command line supplied device type is: %s" % devtype) |
290 |
if not devtype: |
295 |
if not devtype: |
291 |
devtype = "ATA" |
296 |
if device_re.search( device ): |
292 |
|
297 |
devtype = "scsi" |
293 |
if device_re.search( device ): |
298 |
else: |
294 |
devtype = "scsi" |
299 |
devtype = "ata" |
295 |
|
300 |
|
296 |
vprint(1, "Device type: %s" % devtype) |
301 |
vprint(1, "Device type: %s" % devtype) |
297 |
|
302 |
|