Hello,
I am currently working on a script to generate an e-mail based on active CDM alarms. The alarms are for Disk Uitlization within my system. I am currently creating a csv file of disks over 80 % with the attached script. However, the file when opened has not formatting, and I want to have this data dumped to an e-mail with HTML formatting. This is not unlike the example that came with the NAS robot "example-html-email-alarms" However, I want to provide my own data as I show in my script. Can someone please assist with an example or help me out to configure the HTM script. I am not a programmer but have been digging deep into scripting in Lua, and actually enjoying it. Let me know if you need more information.
Im attaching an example of my csv file output and a screenshot of what I would like the e-mail to look like.
al = alarm.list("prid","%cdm%")
--Disk use Reports
recipient = "dhayes"
--Disk over 80% Report
fname = "\\\\server\\root\\CSG\\Nimsoft\\disksover80.csv"
file.create (fname)
file.write (fname,"Server,Disk,Free Space,Threshold,Size")
for i,a inpairs(al) do
s,e =string.find(a.message,"disk free on ")
if s ~= nil then
process1 = string.sub(a.message,s)
-- Get Current Disk Name
proctemp1 = string.sub(a.message,e+1)
s1,e1 = string.find(proctemp1," is now")
process1 = (string.sub(proctemp1,1,s1-1))
-- Get Current Disk Value
s,e =string.find(a.message,"is now ")
proctemp2 =string.sub(a.message,e+1)
s1,e1 =string.find(proctemp2,"%%, which is below")
process2 = (string.sub(proctemp2,1,s1-1))
-- Get configured Configured Threshold
s2,e2 =string.find(proctemp1,"threshold %(")
proctemp3 =string.sub(proctemp1,e2+1)
s3,e3 =string.find(proctemp3,"%%%)")
process3 = (string.sub(proctemp3,1,s3-1))
s,e =string.find(a.message,"total size ")
proctemp4 =string.sub(a.message,e+1)
file.write (fname, sprintf ("\n%s,%s,%s%%,%s%%,%s",a.hostname,process1,process2,process3,proctemp4))
else
end