Lines 1-6
Link Here
|
1 |
--- check_smartmon.orig 2019-02-01 04:28:13.000000000 +0000 |
1 |
--- check_smartmon.orig 2019-03-04 19:42:22 UTC |
2 |
+++ check_smartmon 2019-02-04 22:27:35.297345000 +0000 |
2 |
+++ check_smartmon |
3 |
@@ -161,9 +161,12 @@ |
3 |
@@ -161,9 +161,12 @@ def parseOutput(healthMessage, temperatureMessage, dev |
4 |
lines = healthMessage.split("\n") |
4 |
lines = healthMessage.split("\n") |
5 |
getNext = 0 |
5 |
getNext = 0 |
6 |
for line in lines: |
6 |
for line in lines: |
Lines 15-21
Link Here
|
15 |
elif line == "=== START OF READ SMART DATA SECTION ===": |
15 |
elif line == "=== START OF READ SMART DATA SECTION ===": |
16 |
getNext = 1 |
16 |
getNext = 1 |
17 |
# fi |
17 |
# fi |
18 |
@@ -181,7 +184,7 @@ |
18 |
@@ -181,7 +184,7 @@ def parseOutput(healthMessage, temperatureMessage, dev |
19 |
parts = line.split() |
19 |
parts = line.split() |
20 |
if len(parts): |
20 |
if len(parts): |
21 |
# 194 is the temperature value id |
21 |
# 194 is the temperature value id |
Lines 24-31
Link Here
|
24 |
temperature = int(parts[9]) |
24 |
temperature = int(parts[9]) |
25 |
break |
25 |
break |
26 |
# fi |
26 |
# fi |
27 |
@@ -225,6 +228,7 @@ |
27 |
@@ -190,9 +193,11 @@ def parseOutput(healthMessage, temperatureMessage, dev |
|
|
28 |
# if devType == ata |
28 |
|
29 |
|
|
|
30 |
if devType == "scsi": |
31 |
- stat_re = re.compile( r'SMART Health Status:' ) |
32 |
+ vprint(3, "parseOutput: searching for 'SMART Health Status' section") |
33 |
+ stat_re = re.compile( r'SMART Health Status:|SMART overall-health self-assessment test result:' ) |
34 |
lines = healthMessage.split("\n") |
35 |
for line in lines: |
36 |
+ vprint(3, "parseOutput: line is: '%s'" % line) |
37 |
if stat_re.search( line ): |
38 |
parts = line.split() |
39 |
healthStatus = parts[-1] |
40 |
@@ -201,14 +206,20 @@ def parseOutput(healthMessage, temperatureMessage, dev |
41 |
# done |
42 |
|
43 |
# get temperature from temperatureMessage |
44 |
- stat_re = re.compile( r'Current Drive Temperature:' ) |
45 |
+ temperature = 0 |
46 |
+ vprint(3, "parseOutput: searching for temperature line section") |
47 |
+ stat_re = re.compile( r'Current Drive Temperature:|Temperature_Celsius' ) |
48 |
lines = temperatureMessage.split("\n") |
49 |
for line in lines: |
50 |
+ vprint(3, "parseOutput: line is: '%s'" % line) |
51 |
if stat_re.search( line ): |
52 |
parts = line.split() |
53 |
- temperature = int(parts[-2]) |
54 |
+ vprint(3, "parseOutput: we are very keen on this line: '%s'" % line) |
55 |
+ temperature = int(parts[-3]) |
56 |
+ vprint(3, "parseOutput: Is this the temperature? '%s'" % temperature) |
57 |
break |
58 |
# fi |
59 |
+ |
60 |
# done |
61 |
|
62 |
# if devType == scsi |
63 |
@@ -225,6 +236,7 @@ def createReturnInfo(healthStatus, temperature, warnin |
64 |
|
29 |
# this is absolutely critical! |
65 |
# this is absolutely critical! |
30 |
if healthStatus not in [ "PASSED", "OK" ]: |
66 |
if healthStatus not in [ "PASSED", "OK" ]: |
31 |
+ vprint(2, "Health status: %s" % healthStatus) |
67 |
+ vprint(2, "Health status: %s" % healthStatus) |
Lines 32-42
Link Here
|
32 |
return (2, "CRITICAL: device does not pass health status") |
68 |
return (2, "CRITICAL: device does not pass health status") |
33 |
# fi |
69 |
# fi |
34 |
|
70 |
|
35 |
@@ -287,6 +291,7 @@ |
71 |
@@ -287,6 +299,7 @@ if __name__ == "__main__": |
36 |
# check device type, ATA is default |
72 |
# check device type, ATA is default |
37 |
vprint(2, "Get device type") |
73 |
vprint(2, "Get device type") |
38 |
devtype = options.devtype |
74 |
devtype = options.devtype |
39 |
+ vprint(2, "command line supplied device type is: %s" % devtype) |
75 |
+ vprint(2, "command line supplied device type is: %s" % devtype) |
40 |
if not devtype: |
76 |
if not devtype: |
41 |
if device_re.search( device ): |
77 |
devtype = "ATA" |
42 |
devtype = "scsi" |
78 |
|