When you create a standalone script or daemon when not running as a probe there is a few things you need to make sure you do let me get a basic outline before hand or the alarm message and qos will be rejected .
You need to ensure the following variable is set :
# Reseting this value is very important or the script will use the old data to log back into the first environment even if you undefine the variables so setting this ensure which ip it may log into especially if your hitting multiple domains to get data from one domain and than sending data to another domain.
nimSetVarStr( $NIMV_CONTIP, $hubaddr );
The $hubaddr is the hub ip that you will be issuing a login into .
Since this is a dedicated script and not a probe you need to issue a login example :
Inside Perl let say the hub is on the local loopback:
#!/opt/nimsoft/bin/perl
use lib "/opt/nimsoft/perllib"; # CA Perl SDK library
use Nimbus::API;
use Nimbus::PDS;
use Nimbus::Session;
# Some Values I always set in my standalone Scripts / Daemons
# DEFINE NimVar Constant Field Codes
my $NIMV_CONTINFO = 1;
my $NIMV_CONTIP = 2;
my $NIMV_CONTPORT = 3;
my $NIMV_DEF_CONTPORT = 12;
my $NIMV_DEF_HUBPORT = 9;
my $NIMV_DEF_SPOOLPORT = 13;
my $NIMV_HUBADDR = 10;
my $NIMV_HUBDOMAIN = 11;
my $NIMV_HUBIP = 6;
my $NIMV_HUBNAME = 16;
my $NIMV_HUBPORT = 7;
my $NIMV_ROBOTIP = 15;
my $NIMV_ROBOTNAME = 8;
my $NIMV_SID = 14;
my $NIMV_SPOOLIP = 4;
my $NIMV_SPOOLPORT = 5
# DEFINE PDS DATA TYPE CONSTANTS
my $pds_I = 1;
my $pds_PPI = 3;
my $pds_PCH = 7;
my $pds_PPCH = 8;
my $pds_F = 16;
my $pds_PDS = 21;
my $pds_VOID = 22;
my $pds_PPDS = 24;
# DEFINE ERROR CODES
my $NIME_OK = 0; # OK
my $NIME_ERROR = 1; # ERROR
my $NIME_COMERR = 2; # Communication error
my $NIME_INVAL = 3; # Invalid argument
my $NIME_NOENT = 4; # Not found
my $NIME_ISENT = 5; # Allready defined
my $NIME_ACCESS = 6; # Permission denied
my $NIME_AGAIN = 7; # Temporarily out of resources
my $NIME_NOMEM = 8; # Out of resources
my $NIME_NOSPC = 9; # No space left
my $NIME_EPIPE = 10; # Broken connection
my $NIME_NOCMD = 11; # Command not found
my $NIME_LOGIN = 12; # Login failed
my $NIME_SIDEXP = 13; # SID expired
my $NIME_ILLMAC = 14; # Illegal MAC
my $NIME_ILLSID = 15; # Illegal SID
my $NIME_SIDSESS = 16; # Session id for hub is invalid
my $NIME_EXPIRED = 17; # Expired
my $NIME_NOLIC = 18; # No valid license
my $NIME_INVLIC = 19; # Invalid license
my $NIME_ILLLIC = 20; # Illegal license
my $NIME_INVOP = 21; # Invalid operation finv
my $NIME_USER = 100; # User error from this value and up
my $hubaddr = 127.0.0.1
my $username = user
my $passwrod = password
nimSetVarStr( $NIMV_CONTIP, $hubaddr );
sub login()
{
$sid = nimLogin($username, $password);
}
sub validateLogin()
{
my $current_sid = nimGetCurrentSid();
if ($sid ne $current_sid)
{
nimLogin($username, $password);
} else {
#print "Login OK ! \n";
}
}
login();
validateLogin();
#Now you should be able to utilize nimAlarm as example :
$suppkey = "Test";
$subsystemid = "4.1"; #Made up sub system you can define your own in the nas
$alarmsource = "localhost";
nimAlarm(NIML_CRITICAL, "Test Alarm ", $subsystemid, $suppkey, $alarmsource);
See Page 13
https://docops.ca.com/ca-unified-infrastructure-management/8-31/en/files/220339116/256214615/1/1438135607070/PERL--Perl%20SDK_12_14.pdf
Perl Version i am using this code on :
[root@362407-uim-mon cron]# /opt/nimsoft/bin/perl -v
This is perl 5, version 14, subversion 2 (v5.14.2) built for x86_64-linux-thread-multi
Copyright 1987-2011, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
[root@362407-uim-mon cron]#
[root@362407-uim-mon cron]# cat /opt/nimsoft/perllib/
5.14.2/ auto/ Nimbus/