Installing Additional Perl Libraries

Unified Assurance uses Perl to parse rules. While many Perl libraries are already included, some modules must be externally linked. This section documents how to link in 3rd party Perl modules.

Dependencies

Installing Additional Perl Libraries

This example will use cpan to install the Net::NTP Perl library. There are other methods of installing additional libraries, but will require verification to work within Unified Assurance.

  1. Login to the command line of the server using the root user.

  2. Via the command line, run the cpan application.

    $A1BASEDIR/vendor/perl/bin/cpan
    
  3. Install the additional library using the following command.

    install [LIBRARY]
    

    For example, to install the Net::NTP library, run the following command.

    install Net::NTP
    

    Wait for the installation to finish before continuing.

  4. After installation is complete, cpan can be stopped by running the exit command:

    exit
    

Using Additional Libraries

This example shows how to use the installed Net::NTP Perl library in a rules file for the Syslog Aggregator, but similar changes are also supported in the other rules-based applications, such as the SNMP Poller. Several updates must be made in order to use the new library.

  1. Login to the Unified Assurance UI.

  2. Navigate to the Rules UI.

    Configuration -> Rules

  3. Open the base.load file for the Syslog Aggregator. The path to the default base.load is below, and can be verified by checking the application configuration that is used by the application.

    Core Rules (core) -> Default read-write branch (default) -> collection -> event -> syslog -> base.load

  4. At the very top of the rules file, add the following line of code.

    BEGIN {
        use Assure1::Config;
        $Config //= Assure1::Config->new();
        unshift(@INC, $Config->{BaseDir}.'/vendor/perl/site/lib', $Config->{BaseDir}.'/vendor/perl/lib');
    }
    

    Note:

    • This change is made in base.load to avoid excessive unshifting within the application, which may cause slowness issues, especially on systems processing a large number of events.

    • By the time the rules files are loaded in the application, the variable $Config->{BaseDir} will contain the base directory that was used to install Unified Assurance. This variable should be used instead of hard coding the paths to be included.

  5. Under the BEGIN block, add the necessary use [LIBRARY] logic to include the additional libraries.

    use [LIBRARY];
    

    For example, to bring in the Net::NTP library, the following logic must be added.

    use Net::NTP;
    

    Note:

    This change is made in base.load to avoid excessive use calls within the application, which may cause slowness issues, especially on systems processing a large number of events.

  6. Save the changes made to the base.load file.

  7. Open the base.rules file for the Syslog Aggregator. The path to the default base.rules is below, and can be verified by checking the application configuration that is used by the application.

    Core Rules (core) -> Default read-write branch (default) -> collection -> event -> syslog -> base.rules

  8. Update the rules file (or files) to use the additional libraries. This example uses the new library to poll the specified NTP server. After the poll is complete, the data in the %response variable can be used as needed within the rules file.

    my %response = get_ntp_response('0.pool.ntp.org', 123);
    
  9. Save the changes made to the base.rules file or other modified files.

  10. Restart the application via the Services UI.

  11. Monitor the application log files to verify functionality.