DX Infrastructure Management

Expand all | Collapse all

Apply a *.cfx file to a probe programmatically

  • 1.  Apply a *.cfx file to a probe programmatically

    Posted 08-17-2018 11:56 AM

    I want to apply *.cfx files (that I create via a script) to a probe (logmon specifically, but would like to be able to do this generally).  

     

    CA support has no clue how to do this and thinks it is impossible.  Anyone know a way?



  • 2.  Re: Apply a *.cfx file to a probe programmatically

    Posted 08-17-2018 12:31 PM

    If you've created the logmon.cfg (from the logmon.cfx) via a script, then you just need to push the file to the robot, to the relevant probe directory overwriting the existing cfg and restart the probe (or robot which is probably easier).

    I know you can do this with a lua script and with other languages as well using the nimbus api.

    What is your language of choice?



  • 3.  Re: Apply a *.cfx file to a probe programmatically

    Posted 08-17-2018 12:39 PM

    Thanks, Rowan.

    I have created the logmon.cfx file via shell script, based on the contents of certain application files on each server, and want to use it to update the existing logmon.cfg file in a manner similar to what happens when a package is pushed via IM.  Currently, I create the cfx file via a shell script.  

    Do you have an example LUA script you can share?



  • 4.  Re: Apply a *.cfx file to a probe programmatically

    Posted 08-17-2018 12:59 PM

    I don't unfortunately but in lua you would have to create the package using a callback to the distsrv and then distribute the package using the job_add callback.

    Alternatively if you can create the whole cfg file (not just the updated keys) then you could use the controller callbacks text_file_put to push the file to the robot and restart the probe.

    Just some ideas…



  • 5.  Re: Apply a *.cfx file to a probe programmatically

    Posted 08-17-2018 01:05 PM

    Since I want to do this based on files on the robot itself, distsrv would probably be more trouble than it is work.

    What would happen if I use text_file_put to push a cfx file?  Would it just copy the file and ignore its presence?



  • 6.  Re: Apply a *.cfx file to a probe programmatically

    Posted 08-18-2018 05:34 AM

    If you generate the full cfx file, why not replacing the existing cfg file and restarting the probe?



  • 7.  Re: Apply a *.cfx file to a probe programmatically

    Posted 08-19-2018 06:29 PM

    I'd suggest doing this in LUA - you have more control but you could do it using shell script. My examples will be from LUA so take that into account

     

    To get the contents of the config file you'd use a callback to the controller like:

     

    local probecmd = pds.create()
    pds.putString(probecmd, "name", "cdm")
    response, retcode = nimbus.request(RobotPath .. "/controller", "probe_config_get", probecmd)

     

    This will allow you to use the response table to determine if you need to do whatever it is that you are doing.

     

    To make changes you do something like:

     

    local options = pds.create()
    pds.putString(options, "/disk/ignore_filesystem", "/.*snap.*/")

     

    local args = pds.create()
    pds.putString(args, "name", "cdm")
    pds.putPDS(args, "as_pds", options)

    local resp,rc = nimbus.request(RobotPath.. "/controller", "probe_config_set", args)
    pds.delete(args)

     

    Then restart to put into effect:

     

    output2,return_status2 = nimbus.request ( RobotPath .. "/cdm", "_restart" )