{
    "name"  : "硬盘是否存在SMART异常日志",
    "problems" : {
        "flowError" : {
            "desc"      : "【问题】硬盘存在SMART异常日志。",
            "advice"    : "【建议】请联系400协助处理。"
        }
    }
}
---------------------------code-------------------------------
if get_share_value("IsOrNotEG2000K")=="yes" :
    return 'skip'
end

cli("run-system-shell")
cli("smartctl -s on /dev/sda")
res = cli("smartctl -a /dev/sda1")
print res

if res.match(/SMART support is: Unavailable/ig)!=null || res.match(/SMART support is: Disabled/ig)!=null :
	cli("smartctl -s off /dev/sda")
	cli("exit")
	return 'skip'
end	

if res != null :
    if res.indexOf("/bin/sh: smartctl: not found")!=-1 :
		cli("exit")
	   return 'skip'
    end	
	noError = res.match(/\bNo Errors Logged\b/)
	if noError == null :
		print 'warn'
		add_problem("flowError")
		cli("exit")
		return 'warn'
	end
	resAr = res.match(/\bCurrent_Pending_Sector\s+\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+\S+\b/)
	print resAr
	resAr = resAr[0]
	resA = resAr.split(/\s+/g)
	print 'resA[8]='+resA[8]
	if resA[8] != 0 :
		print 'warn'
		add_problem("flowError")
		cli("exit")
		return 'warn'
	end	
end
cli("exit")
print 'success'
return 'success'