Sample Perl Script for Incident and Auto Submit Filters
The following is a sample Perl script for incident and auto submit filters implemented by using Perl module:
#!/usr/bin/perl use lib qw(/var/cache/jboss/SN/AdvancedFilters /usr/nma/lib /usr/lib/perl5/vendor_perl/5.8.8); use MyModule; #Custom_User_Module use NmaUtil; use filterUtilV1; #Input arguments passed from Service Now $eventType = $ARGV[0]; $deviceHostName = $ARGV[1]; $problemSynopsis = $ARGV[2]; $problemDescription = $ARGV[3]; $osPlatform = $ARGV[4]; # Argument not present in Incident Entity table; present only as part of JMB $entity = $ARGV[5]; $junosVersion = $ARGV[6]; $eventTime = $ARGV[7]; $deviceId = $ARGV[8]; #Supported values [devicePlatform,device_node,customerTrackingNumber,hostName,problemDesc, problemSynopsis,defectDesc,defectType,prbIdentifier,junosVersion, occurredTimeStartRange,occurredTimeEndRange] my %incident_hash = ('hostName'=>'RouterName', 'occurredTimeStartRange'=> '2018-01-23 10:47:47' ); print "MyModule = $MyVariable"; #Using user varibles inside MyModule print "CheckStatus = ". Verify_CheckStatus(); #Calling user Functions inside MyModule #getExistingIncidents() will return [PRBtime,Priority,Severity,defectDesc,defectType,device_node,hostName,prbIdentifier,problemDesc,problemSynopsis,junosVersion] my $incidents = filterUtilV1::getExistingIncidents(%incident_hash); print "\n$incidents\n"; if ( $deviceHostName eq 'RouterName' ){ print "\ntrue"; } else{ print "\nfalse"; }
Do not change the ARG value assigned to a JMB attribute.