AnsweredAssumed Answered

Creating a NAS report showing the current filter status

Question asked by carstein.seeberg on Aug 7, 2008
Latest reply on Aug 20, 2008 by carstein.seeberg
Enclosing a little useful script that produces a report of the current states on the NAS pre-processing filters.  This can of course be modified to only list the ones that are currently active.

Hope you'll find it useful,

---8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<--
--
-- Generates a simple report with the current state on filters
--
function yesno(v)
   if (v==1) then return "yes" end
   return "no"
end
function print_filter(f)
   fmt = "%-40s %6s %10s %9s %7s"

   if f==nil then
      printf(fmt,"Name","Active","Type","Scheduled","Startup")
      printf("-------------------------------------------------------------------------------")
   else
      printf(fmt,f.name,yesno(f.active),f.type,yesno(f.schedule),yesno(f.startup))
   end
end

data = action.filter()
if data ~= nil then
   printf("Num filters: %d\n",data.num_filters)

   print_filter()
   for k,f in pairs(data) do
      print_filter(f)     
   end
else
   print("No filters in NAS.")
end

Outcomes