-- This nas LUA script outputs active alarm information to a csv file. It can be edited to include more alarm data. It is "sorted"
-- by severity, Critical first, then Major, etc... It can be run manually from the NAS (scripts) or run from a NAS schedule.
Release: Any
Component: UIMNAS
-- This LUA script outputs active alarm information to a csv file. It can be edited to include more alarm data. It is "sorted"
-- by severity, Critical first, then Major, etc... It can be run manually from the NAS (scripts) or run from a NAS schedule.
local buffer = ""
-- Delete the target file so we don't keep appending to it.
file.delete ("C:\\myAlarm.csv")
-- Get all critical alarms
al = alarm.list ("severity","Critical")
if al ~= nil then
for i,a in pairs(al) do
buffer = (buffer .. a.nimid .. "," .. a.severity .. "," ..
a.message .. "\n")
end
end
-- now all major alarms
al = alarm.list ("severity","Major")
if al ~= nil then
for i,a in pairs(al) do
buffer = (buffer .. a.nimid .. "," .. a.severity .. "," ..
a.message .. "\n")
end
end
-- now all minor alarms
al = alarm.list ("severity","Minor")
if al ~= nil then
for i,a in pairs(al) do
buffer = (buffer .. a.nimid .. "," .. a.severity .. "," ..
a.message .. "\n")
end
end
-- now all warning alarms
al = alarm.list ("severity","Warning")
if al ~= nil then
for i,a in pairs(al) do
buffer = (buffer .. a.nimid .. "," .. a.severity .. "," ..
a.message .. "\n")
end
end
-- now all informational alarms
al = alarm.list ("severity","Informational") if al ~= nil then
for i,a in pairs(al) do
buffer = (buffer .. a.nimid .. "," .. a.severity .. "," ..
a.message .. "\n")
end
end
fstat=file.write ("C:\\myAlarm.csv",buffer) if fstat ~= false then
print("File written")
end