DX Unified Infrastructure Management

  • 1.  LUA--help with probe_config_get

    Posted Aug 11, 2012 05:15 PM

    Hello-

     

    I am trying to pull the default configuration from a 'net_connect' probe, in order to create a template to push to a set of robots. I want to pull the /setup/default_host values. If I run the command in the probe utility, it gives me what I want and I can see the information. However, when I try to script it, I get a nil value and I have no idea what I am doing wrong.

     

    I thought nimbus.request returned a PDS which I would then have to iterate through to get the values I want. Why is it returning a nil value?

     

    I am new to programming and LUA, so I obviously don't understand the return call well enough but here is the script I have:

     

    probecmd = pds.create()
    pds.putString(probecmd, "net_connect", "/setup/default_host")

    response, retcode = nimbus.request("/Path/to/hub/controller", "probe_config_get", probecmd)

    for key, value in pairs(response["/setup/default_host"]) do
       print(value.active)
    end

     

    Any help is appreciated.

     

    Kind regards.



  • 2.  Re: LUA--help with probe_config_get
    Best Answer

    Posted Aug 11, 2012 09:35 PM

    I think you have your parameter in probecmd wrong. Try this:

     

    probecmd = pds.create()
    pds.putString(probecmd, "name", "net_connect")

    response, retcode = nimbus.request("/Path/to/hub/controller", "probe_config_get", probecmd)

    for key, value in pairs(response["/setup/default_host"]) do
       print(value.active)
    end

     



  • 3.  Re: LUA--help with probe_config_get

    Posted Aug 11, 2012 09:48 PM

    OMG!!

     

    Thank you. I am now able to iterate through the list. Everything returns 'nil', which is puzzling, but the script does not error out at least.

     

    Thanks again.



  • 4.  Re: LUA--help with probe_config_get

    Posted Aug 12, 2012 01:57 AM

    If you are only interested in the active option, replace the for loop with the following:

     

    print(response["/setup/default_host"].active)

     If you are intersted in all of the options, use the following for loop instead:

     

    for key, value in pairs(response["/setup/default_host"]) do
       print(key, " : ", value)
    end

     



  • 5.  Re: LUA--help with probe_config_get

    Posted Aug 12, 2012 02:28 PM

    Brilliant. That is exactly what I was looking for.

     

    Thank you, kindly.