vADC Docs

Tech Tip: Running Perl code on the Stingray Virtual Appliance

by on ‎02-22-2013 03:39 AM (646 Views)

You can create monitors, event action scripts and other utilities using Perl, but if you install them on a system that does not have a suitable Perl interpreter, they will not function correctly. For example, the Stingray Virtual Appliance does not have a system-wide Perl interpreter.

The Stingray product includes a slightly cut-down version of Perl that is used to run many parts of the Stingray Administration Server. You can modify an existing perl script to use the Stingray distribution if necessary.

Replace the standard Perl preamble:

#!/usr/bin/perl -w

... with the following:

#!/bin/sh

exec $ZEUSHOME/perl/miniperl -wx $0 ${1+"$@"}

    if 0;

#!/usr/bin/perl

#line 7

BEGIN{

       # The Stingray-provided perl uses its own libraries

       @INC=("$ENV{ZEUSHOME}/zxtmadmin/lib/perl","$ENV{ZEUSHOME}/perl");

}

Note that Stingray's Perl distribution contains a limited set of libraries, and it is not possible to add further libraries to it. Nevertheless, it is complete enough for many of the common administration tasks that you may wish to perform on a Stingray Virtual Appliance, including using the Control API (SOAP::Lite).