DX Infrastructure Management

Expand all | Collapse all

Upload logmon.cfg file to UIM robots

  • 1.  Upload logmon.cfg file to UIM robots

    Posted 09-18-2018 01:48 PM

    Hi,

    I am trying to write a script that will create logmon.cfg files for specific robots based on ini files given by anoter monitoring software.

    Basically it goes trough a folder of ini files, one per robot, and creates a logmon.cfg file. (I tested this cfg files by uploading manually and they seem to be working fine) 

    The idea was to upload each file automatically after creation, and this is were I'm having trouble, finding a way to upload each file to it's specific host.


    I thought about using PU and the Controller probe's file_put_* functions but I don't seem to be able to send the specified file. It only creates an empty file in the destination folder.

     

    This is the command I'm gererating:

    pu -u user -p pass /mydom/my_hub/robot_host_name/controller probes/system/logmon/ logmon.cfg ascii 777

    How do I specify the source file?

    Is there any better way of doing this?

    Thanks!



  • 2.  Re: Upload logmon.cfg file to UIM robots

    Posted 09-18-2018 02:27 PM

    The pu command is not currently designed to transfer a file directly as you would a file copy.

    The process to send information is done programatically in a loop sending small chuncks of a file at a time.

    below is sample LUA script do do this.

     

    Here is an example of a LUA script (which can be run in NAS) that shows the appropriate usage:


    local args = pds.create() -- create data structure to pass arguments to probe callbacks
    pds.putString(args,"directory","C:")
    pds.putString(args,"file","test.txt")
    pds.putString(args,"buffer_size",300000000)


    local response = pds.create()

    response,rc = nimbus.request("/Domain/HubName/RobotName/controller", "text_file_get", args)

    for k,v in pairs(response) do
    print(k .. " " .. v)
    end

     

    not sure this will be of much use to you.



  • 3.  Re: Upload logmon.cfg file to UIM robots

    Posted 09-18-2018 02:51 PM

    An alternative would be to use the controller callback probe_config_set.

     

    You could use this with pu but instead of creating the logmon.cfg file locally, you'd use this to directly set the values in the logmon.cfg file on the destination server.

     

    -Garin



  • 4.  Re: Upload logmon.cfg file to UIM robots

    Posted 09-19-2018 06:13 AM

    Seems like a good option, I will keep it in mind for plan B.



  • 5.  Re: Upload logmon.cfg file to UIM robots

    Posted 09-19-2018 06:13 AM

    Thanks a lot, I will give it a try.



  • 6.  Re: Upload logmon.cfg file to UIM robots

    Posted 09-21-2018 11:39 AM

    I was able to upload a file with text_file_put, and I'm able to download a file with file_get_* (with the the text_file_get I was getting buffer issues)

     

    Now I'm trying to upload a file using file_put_* but I'm getting written -> 0

     

     

    upArgs = pds.create()

    pds.putString(upArgs, "directory", "probes/system/logmon/")

    pds.putString(upArgs, "file", "upload.me")

    pds.putString(upArgs, "type", "ascii")

    pds.putString(upArgs, "mode", "655")

    pds.putString(upArgs, "file_content", "Beam me up scotty!")

     

    response, rc = nimbus.request("/mydom/my_hub/robot_host_name/controller", "file_put_start", upArgs)

     

    for k,v in pairs(response) do

    print(k .. "-> " .. v)

    end

     

    I get:

    id -> 12

    written -> 0

     

    The file is created in the robot folder, but it's empty.

     

    Can you give some clue of what I'm doing wrong?



  • 7.  Re: Upload logmon.cfg file to UIM robots

    Posted 09-20-2018 04:35 AM

    You might also have a look at the mcs_cli utility which allows to import MCS profiles if you need.



  • 8.  Re: Upload logmon.cfg file to UIM robots

    Posted 09-21-2018 11:41 AM

    I will give a look at that option for plan C.

    Thanks for your help!