jim.douglas

LUA script to walk sqlserver probes and find a specific active profile

Discussion created by jim.douglas on Nov 15, 2013
Latest reply on Nov 20, 2013 by 1_keithk

Hello.  I've written a LUA script to walk through and identify which robots are running the sqlserver probe with an active profile name of "daily".  Below is the script, which I think should work.  However, given the amount of work it has to do, as a result of the large number of robots in our environment, I think the script is timing out.  The error received when I attempt to run it is: 

 

"The execute request failed: communication error"

 

print('List of Managed SQL Servers')
print('==============================')
print(' ')

 

hublist = nimbus.request("hub","gethubs");
hubs = hublist.hublist
args = pds.create()
pds.putString(args,"name","sqlserver")
for hub_key,hub_table in pairs(hubs) do
   hub = hubs[hub_key]

 

   robots = nimbus.request(hub.addr,"getrobots")
   if robots ~= nil then
      for r_key,r_value in pairs(robots.robotlist) do
         controller = r_value.addr.."/controller"
         probes = nimbus.request(controller,"probe_list")
         if probes ~= nil then
            for p_key,p_value in pairs(probes) do
               if p_key == "sqlserver" then
                  if p_value.active == 1 then
                     sql = nimbus.request(controller,"probe_config_get",args)
                     for s_key,s_value in pairs(sql) do
                        if s_key == "/profiles/daily" then
                           if s_value.active == "yes" then
                              print(r_value.name)
                           end
                        end
                     end
                  end
               end
            end
         else
            print(r_value.name.." is BROKEN!")
         end
      end
   end
end

 

 

Is there a timeout associated with scripts that I need to extend?  Is there something terribly wrong with my script?  Any help would be greatly appreciated.

Outcomes