View | Details | Raw Unified | Return to bug 236227 | Differences between
and this patch

Collapse All | Expand All

(-)check_smartmon (-6 / +19 lines)
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 190-198 def parseOutput(healthMessage, temperatureMessage, dev Link Here
190
        # if devType == ata
193
        # if devType == ata
191
194
192
        if devType == "scsi":
195
        if devType == "scsi":
193
                stat_re = re.compile( r'SMART Health Status:' )
196
                vprint(3, "parseOutput: searching for 'SMART Health Status' section")
197
                stat_re = re.compile( r'SMART Health Status:|SMART overall-health self-assessment test result:' )
194
                lines = healthMessage.split("\n")
198
                lines = healthMessage.split("\n")
195
                for line in lines:
199
                for line in lines:
200
                        vprint(3, "parseOutput: line is: '%s'" % line)
196
                        if stat_re.search( line ):
201
                        if stat_re.search( line ):
197
                               parts = line.split()
202
                               parts = line.split()
198
                               healthStatus = parts[-1]
203
                               healthStatus = parts[-1]
Lines 201-214 def parseOutput(healthMessage, temperatureMessage, dev Link Here
201
                # done
206
                # done
202
207
203
                # get temperature from temperatureMessage
208
                # get temperature from temperatureMessage
204
                stat_re = re.compile( r'Current Drive Temperature:' )
209
                temperature = 0
210
                vprint(3, "parseOutput: searching for temperature line section")
211
                stat_re = re.compile( r'Current Drive Temperature:|Temperature_Celsius' )
205
                lines = temperatureMessage.split("\n")
212
                lines = temperatureMessage.split("\n")
206
                for line in lines:
213
                for line in lines:
214
                        vprint(3, "parseOutput: line is: '%s'" % line)
207
                        if stat_re.search( line ):
215
                        if stat_re.search( line ):
208
                               parts = line.split()
216
                               parts = line.split()
209
                               temperature = int(parts[-2])
217
                               vprint(3, "parseOutput: we are very keen on this line: '%s'" % line)
218
                               temperature = int(parts[-3])
219
                               vprint(3, "parseOutput: Is this the temperature? '%s'" % temperature)
210
                               break
220
                               break
211
                       # fi
221
                       # fi
222
                
212
                # done
223
                # done
213
                                
224
                                
214
        # if devType == scsi
225
        # if devType == scsi
Lines 225-230 def createReturnInfo(healthStatus, temperature, warnin Link Here
225
236
226
        # this is absolutely critical!
237
        # this is absolutely critical!
227
        if healthStatus not in [ "PASSED", "OK" ]:
238
        if healthStatus not in [ "PASSED", "OK" ]:
239
                vprint(2, "Health status: %s" % healthStatus)
228
                return (2, "CRITICAL: device does not pass health status")
240
                return (2, "CRITICAL: device does not pass health status")
229
        # fi
241
        # fi
230
242
Lines 287-292 if __name__ == "__main__": Link Here
287
        # check device type, ATA is default
299
        # check device type, ATA is default
288
        vprint(2, "Get device type")
300
        vprint(2, "Get device type")
289
        devtype = options.devtype
301
        devtype = options.devtype
302
        vprint(2, "command line supplied device type is: %s" % devtype)
290
        if not devtype:
303
        if not devtype:
291
                devtype = "ATA"
304
                devtype = "ATA"
292
305

Return to bug 236227