AnsweredAssumed Answered

Migrating existing LUA script from NAS to NSA

Question asked by amit_saxena on Jun 2, 2011
Latest reply on Jun 7, 2011 by amit_saxena

Hi all,

 

I have few scripts written and working fine in NAS. However now I need to execute them from some other robot where NSA is deployed already. Please suggest me if there is anything extra, apart from including nimbus.login, in the scripts so as to allow them getting executed successfully through NSA.

 

Please find screenshot of few scripts from NAS which I am trying to execute from NSA.

 

Script 1 : Clearing alarms from NAS except from distsrv probe

 

In NAS

 

printf ("Script starting...")
alarm1=alarm.list()
if alarm1 ~= nil then
   for i=1,#alarm1 do
      --printf ("%05d %s %s", i, alarm1[i].nimid, alarm1[i].prid)
      probe_name = alarm1[i].prid
      if probe_name ~= "distsrv" then
         --printf ("%05d %s %s", i, alarm1[i].nimid, alarm1[i].prid)        
         message_id = alarm1[i].nimid
         action.close (message_id)
      end
   end
end
printf ("Script completed....")

In NSA

 

printf ("Script starting...")
if not nimbus.login("administrator","pjHpjrlZCzegVPJ6e7zxPG2GikiSik8VeZLHjkgOp4gHJLUEoF/SrS1sabtfVQTc") then
   print("Failed to authenticate")
   return
end
alarm1=alarm.list()
if alarm1 ~= nil then
   for i=1,#alarm1 do
      printf ("%05d %s %s", i, alarm1[i].nimid, alarm1[i].prid)
      probe_name = alarm1[i].prid
      if probe_name ~= "distsrv" then
         --printf ("%05d %s %s", i, alarm1[i].nimid, alarm1[i].prid)        
         message_id = alarm1[i].nimid
         action.close (message_id)
      end
   end
end
printf ("Script completed....")

Output screenshot

 

C:\Users\Administrator\Desktop>nsa remove_all_alarms_from_nas_except_from_distsrv_probe.lua
Script starting...
Jun  1 23:12:22:484 nsa: Script error, ...ve_all_alarms_from_nas_except_from_distsrv_probe.lua:6: attempt to index global 'alarm' (a nil value)

C:\Users\Administrator\Desktop>
C:\Users\Administrator\Desktop>

 

Please suggest

 

Regards,

Amit Saxena

Outcomes