Installing Additional Perl Libraries¶
Assure1 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¶
-
The Vendor Perl Application package (vendorPerl-app) must be installed on any server that will use the additional libraries. The package can be installed by running the following command on the command line:
$A1BASEDIR/bin/Package install vendorPerl-app
-
The additional libraries must be separately installed on each server that will use the libraries.
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 Assure1.
-
Login to the command line of the server using the root user.
-
Via the command line, run the cpan application.
$A1BASEDIR/vendor/perl/bin/cpan
-
Install the additional library using the following command.
install [LIBRARY]
For example, to install the Net::NTP library, the following command should be executed.
install Net::NTP
Wait for the installation to finish before continuing.
-
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.
-
Login to the Assure1 UI.
-
Navigate to Configuration -> Rules.
-
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
-
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 Assure1. This variable should be used instead of hard coding the paths to be included.
-
-
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.
-
Save the changes made to the base.load file.
-
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
-
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);
-
Save the changes made to the base.rules file or other modified files.
-
Restart the application via the Services UI.
-
Monitor the application log files to verify functionality.