2 ## Grabs status from SMART to see if your hard drives are ok
3 ## Returns in the format of (return code, [line1, line2, line3,...])
5 ## Copyright 2007, Red Hat, Inc
6 ## Michael DeHaan <mdehaan@redhat.com>
8 ## This software may be freely redistributed under the terms of the GNU
9 ## general public license.
11 ## You should have received a copy of the GNU General Public License
12 ## along with this program; if not, write to the Free Software
13 ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 # =================================
24 class SmartModule(func_module
.FuncModule
):
28 description
= "Grabs status from SMART to see if your hard drives are ok."
30 def info(self
,flags
="-q onecheck"):
32 Returns a struct of hardware information. By default, this pulls down
33 all of the devices. If you don't care about them, set with_devices to
37 flags
.replace(";","") # prevent stupidity
39 cmd
= sub_process
.Popen("/usr/sbin/smartd %s" % flags
,stdout
=sub_process
.PIPE
,shell
=True)
40 data
= cmd
.communicate()[0]
44 for x
in data
.split("\n"):
47 return (cmd
.returncode
, results
)