Get Hard disk S.M.A.R.T status report

It will help you to view your hard drive’s S.M.A.R.T(Self-Monitoring, Analysis, and Reporting Technology) data and see if it has started to develop problems.This script helps you to give in

detailed of Information, Health status and attributes of Hard Disk.

Note: This script uses the open source smart monitoring tool.



import urllib
import os
import sys
def information(workdir):
 os.chdir(workdir)
 out=os.popen("smartctl -a /dev/sda").readlines()
 for i in out:
  if 'Read SMART Log Directory failed:' in i:
   break
  else:
   sys.stdout.write(i)
 os.remove('smartctl.exe')
def downloadFile(DownTo, fromURL):
 try:
  fileName = fromURL.split('/')[-1]
  DownTo = os.path.join(DownTo, fileName)
  with open(DownTo, 'wb') as f:
   f.write(urllib.urlopen(fromURL).read())
  if os.path.isfile(DownTo):
   return '{} - {}KB'.format(DownTo, os.path.getsize(DownTo)/1000)
 except:
  return 'Please Check URL or Download Path!'




workdir=os.environ['PROGRAMDATA']+r'\c1_temp'
if not os.path.isdir(workdir):
 os.mkdir(workdir)
url='https://patchportal.one.comodo.com/portal/packages/spm/Wise Force Deleter/x86/smartctl.exe'
if not os.path.exists(workdir+r'\smartctl.exe'):
    print "********"
    downloadFile(workdir,url)
    information(workdir)
else:                   
    information(workdir)



20170622-SMART-Monitoring.json (1.64 KB)