Develop a custom Perl probe with this kickstarter - Part 1

Document created by pmatt on Feb 3, 2017Last modified by pmatt on Feb 3, 2017
Version 2Show Document
  • View in full screen mode

Hi folks,

 

This is the first part in a series that will help you get up and running with developing a custom Perl probe for UIM on Windows. I have been running several probes this way for a few years. The reliability has been excellent and the flexibility that the code enables has allowed us to provide some highly bespoke monitoring.

 

Part 1 deals with installing Perl and a package creator, making a copy of the code template and compiling it.

 

On the machine that you want to develop from, download and install Strawberry Perl MSI edition. Note that 5.14 is the only version currently supported by the Perl SDK. You must use Strawberry rather than ActiveState becuase the CPAN install of PAR::Packer below does not work with ActiveState. This is a known issue logged on their website. I have also had problems when ActiveState and Strawberry are installed side by side. Either remove ActiveState if possible, or start with a clean OS and install Strawberry only. You should also have the Nimsoft robot installed on the same machine, with the SDK_Perl 5.06 package installed.

 

http://strawberryperl.com/download/5.14.4.1/strawberry-perl-5.14.4.1-64bit.msi

 

Once installed, drop into the command line and run the following command from the Perl bin directory: -

 

perl -MCPAN -e "install PAR::Packer"

 

 

This is used later to compile a Perl script into an executable file. This removes the need for the full installation of Perl on a robot that is going to be running the custom probe. You can run a custom Perl probe without installing Perl on every single robot.

 

The output from the CPAN install command above is quite baffling and takes about 20 minutes to finish. I have attached a successful output (ParPackerInstall.txt) to hopefully help with troubleshooting. There are 3 packages on which PAR::Packer is depenedent, and these are installed first.

 

Warning: prerequisite Getopt::ArgvFile 1.07 not found.
Warning: prerequisite Module::ScanDeps 1.21 not found.
Warning: prerequisite PAR 1.014 not found. We have 1.007.

 

These are installed in turn, so if you get any errors, try and see which pacakge is failing. Once they are done, PAR::Packer itself is installed. The last three lines should look like this: -

 

Appending installation info to C:\strawberry\perl\lib/perllocal.pod
  RSCHUPP/PAR-Packer-1.036.tar.gz
  C:\strawberry\c\bin\dmake.exe install UNINST=1 -- OK

 

You can test PAR::Packer like this: -

 

echo print "\n\nHello world!\n\n" > helloWorld.pl

pp -o helloWorld.exe helloWorld.pl

helloWorld.exe

 

 

Next you need to choose a name for your probe and a group for it to live in. In this example, the probe will be called 'perfmonWindow' and it will live in the 'Custom' probe group.

 

On your dev machine, drop into the probes folder; 32bit C:\Program Files (x86)\Nimsoft\probes; 64bit C:\Program Files\Nimsoft\Nimsoft Robot x64\probes

 

Create a folder with the same name as the group you have chosen if it does not already exist. Within that folder, create another folder with the same name as the probe and add '_dev' to the end. Copy the attached files 'example_probe.pl' and 'example_probe.cfg' into this folder. Rename both them, replacing example_probe with your probe name. Then use the pp command to compile the .pl file into an executable.

 

 

Then run the executable, wait for a couple of minutes and hit Ctrl-C. Then look at the log file and hopefully you should have something like this: -

 

 

Congratulations if you have got this far. You can move on to the next part.

 

If you see any errors when running the probe, check that you have the SDK_Perl package installed and you are working with the directory structure as seen above. If the system cannot find or reference the API libraries, the probe will not run. You must make sure they are installed, and your use statement at the top of code points to the perllib directory.

 

5 people found this helpful

Outcomes