DX Unified Infrastructure Management

  • 1.  probe_config_get

    Posted Feb 13, 2018 09:38 AM

    Hi,

     

    Am trying to retrieve active sql profiles via Controller call back (probe_config_get) in LUA.

     

    I need to iterate only /profiles and print the active profile name. have no idea on how to iterate probe_config_get .

     

    please help me.

     

    local robot,rc= nimbus.request("/Domain/HUB","getrobots")
    args = pds.create()
    pds.putString(args,"name","sqlserver")
    if (rc==0) then
    for i, j in pairs(robot.robotlist) do
    temp=j.addr
    if robot ~= nil then
    for k,l in pairs(robot) do
    probes=nimbus.request(temp.."/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(temp.."/controller", "probe_config_get", args)



  • 2.  Re: probe_config_get

    Posted Feb 13, 2018 10:29 AM

    Here is an example of sending configurations to a database, but it has the probe_config_get parsing. 



  • 3.  Re: probe_config_get

    Posted Feb 13, 2018 12:40 PM

    Hi,

     

    Could you please share example one more time please. am unable to see it.



  • 4.  Re: probe_config_get

    Posted Feb 13, 2018 04:21 PM


  • 5.  Re: probe_config_get

    Posted Feb 14, 2018 11:08 AM

    Hi Bryan,

    Actually am passing sqlserver in args and i need to retrieve/print  profile names. Need to understand how the below commands working, please help
    for section,tableid in pairs(probe_config_get) do
                            for key,value in pairs(probe_config_get[section]) do


  • 6.  Re: probe_config_get

    Posted Feb 14, 2018 07:46 PM

    Hopefully the following code will help. It prints out the section->key->value for each section entry that matches "profile"

     

    -- Get some information from each probe
    args = pds.create()
    pds.putString(args,"name","sqlserver")
    local probe_config_get = nimbus.request("/domain/hub/robot/controller","probe_config_get",args)
    if probe_config_get ~= nil then
       for section,tableid in pairs(probe_config_get) do
          for key,value in pairs(probe_config_get[section]) do
             if string.match(section, "profile") then
                print("Section: "..section.." Key: "..key.." Value: "..value)
             end       
          end
       end
    end


  • 7.  Re: probe_config_get

    Posted Feb 15, 2018 09:59 AM

    Hi Bryan,

     

    Thanks for help. I tried below code and it is running successfully, but output showing duplicate values.

     

    for section,tableid in pairs(probe_config_get) do
       for key,value in pairs(probe_config_get[section]) do
           if string.match(section, "/profiles") then
                 if string.match(key, "active") then
                      if string.match (value, "yes")then
                             print("Section: "..section.." Key: "..key.." Value: "..value)
                     end
               end
         end
      end
    end



  • 8.  Re: probe_config_get

    Posted Feb 16, 2018 07:06 AM

    It doesn't look like Bryan's code could return duplicates - the data returned by probe_config_get is essentially a table of tables. The outermost table is a list of the configuration file sections. individual sections are tagged by the key value. That tag by definition is unique and each section name is also by definition unique.

     

    You can, if you use IM, highlight the probe in question and hit ctrl-N to get the configuration in notepad - you could do a manual comparison to identify the correctness.

     

    Also lua-users.org and www.lua.org are excellent sources of information about the LUA language.

     

    -Garin