DX Infrastructure Manager

Expand all | Collapse all

Looking for a Perl Example Script for Net_connect

Jump to Best Answer
  • 1.  Looking for a Perl Example Script for Net_connect

    Posted 06-11-2012 07:26 PM

    Hi,

     

    I'm new to Nimsoft and we have recently gotten it installed and running. I am  now trying to create scripts to add servers automatically to net_connect (among other probes but want to start with net_connect). We are using Perl. Does anyone have an example script I might be able to take a look at?

     

    Thank you in advance.

     

    Stuart H.

    Carinet NOC Technician



  • 2.  Re: Looking for a Perl Example Script for Net_connect

    Posted 06-15-2012 08:34 PM

    Or if anyone has the Nimbus syntax for perl.  Documentation on perl API seems to be scarce.



  • 3.  Re: Looking for a Perl Example Script for Net_connect

    Posted 06-16-2012 12:38 AM

    Your best source for sample Perl code is probably the Code Wizard. It is especially applicable if you are writing a custom probe in Perl, which is probably not true in your case. But you can still see what libraries to use and such.

     

    Invoking a callback from Perl should look something like this:

     

    my $pds_out = pdsCreate();
    pdsPut_PCH($pds_out, 'name',    'cdm'     );
    pdsPut_PCH($pds_out, 'section', '/setup'  );
    pdsPut_PCH($pds_out, 'key',     'loglevel');
    pdsPut_PCH($pds_out, 'value',   '5'       );
    
    my($rc, $pds_in) = nimNamedRequest($robot_addr, 'probe_config_set', $pds_out, 10);
    
    if ( $rc ) {
        print "ERROR updating config: ", nimError2Txt($rc), "\n";
    } else {
        print "Config updated\n";
    }


  • 4.  Re: Looking for a Perl Example Script for Net_connect

    Posted 06-17-2012 05:53 PM

    That's the confusing part, where is code wizard? We have a linux setup for our Hubs and the only windows machine is for Infrasrtucture Manager.

     

    As of right now we are not making any custom probes. although, we will in the future. Right now, we just want to get servers added to net_connect automatically using perl scripts. With the API information I think we will be able to figure all the rest out.

     

    And thank you for the example.



  • 5.  Re: Looking for a Perl Example Script for Net_connect

    Posted 06-17-2012 07:57 PM
    The Code Wizard is in the Internet archive. You can download it to your archive and distribute it to any Windows robot.. Then it should be available in the Start Menu on that host.


  • 6.  Re: Looking for a Perl Example Script for Net_connect

    Posted 06-19-2012 07:04 PM
      |   view attached

    Here is a Perl API document that I got from somewhere. It did help me in developing some tools.

    Attachment(s)

    pdf
    Perl_API.pdf   350K 1 version


  • 7.  Re: Looking for a Perl Example Script for Net_connect

    Posted 06-21-2012 06:38 PM

    Thank you for all your help. I appreciate it.

     

    I think we pretty much have the API info we need, there seems to be something missing though. for szCmd the service command. where can we get a list of these. Some I found  are: gethubs, getrobots, probe_config_get. I also found a list in /opt/nimsoft/bin/pu /maindomain/hub1 -L but was wondering if this is the entire list or is there some documentation for this particle info. thanks in advanced. 

     

    Stuart H.



  • 8.  Re: Looking for a Perl Example Script for Net_connect
    Best Answer

    Posted 06-21-2012 07:42 PM
    The pu command is one of the best ways to find out what callbacks are available. But the command you used only showed you the callbacks on the hub. You can also direct the pu command to a robot or probe by specifying a longer nimaddress. The example above uses a callback on the controller/robot.

    The other good way to explore is with the Probe Utility GUI. In Infrastructure Manager, select a probe and press Ctrl+P.

    For some probes, including the hub and controller/robot, have their callbacks documented in whitepapers (or technical briefs). Finding them can be tricky, but I think the are in the main documentation now (or should be).


  • 9.  Re: Looking for a Perl Example Script for Net_connect

    Posted 06-29-2012 06:34 PM

    Thank you everyone for your reply. I think we have everfything we need now.