Language Extensions

Returns a string buffer with the formatted string.
uimpga-ga
sprintf ( Format [,Par1 [,Par2 […]] ] )
Returns a string buffer with the formatted string.
printf ( Format [,Par1 [,Par2 […]] ] )
Logs the formatted string to the output window (if in the editor) or the nas logfile.
print ( Par1[,Par2 […]] ] )
Logs the string to the output window (if in the editor) or the nas logfile. Used primarily for simple unformatted printing and debug output.
left ( String, Length )
Returns
Length
characters from the
String
, starting from the left.
right ( String, Length )
Returns
Length
characters from the
String
, starting from the right.
mid ( String, Start [, Length ] )
Returns
Length
characters from the
String
, starting from
Start
. If no
Length
is specified, the rest of the string will be returned.
substr ( String, Substring )
Returns true if the
Substring
is found, as well as the starting
Position
of the substring.
split ( String [, Separators ])
Returns a table of substrings separated by one or more of the Separator characters. The default separator is whitespace.
trim ( String [, Mode ])
Removes leading and/or trailing white space from String.
The Mode may be
  • 0: leading and trailing
  • 1: leading
  • 2: trailing
The default value is 0.
regexp ( String, Expression )
Returns true if the regular (or pattern matching) expression matches
String
.
setvariable ( Name, Value )
Stores the non-persistent variable
Name
. The value is retrievable until a cold-start of the nas clears the
Non-persistent data store. Use the equivalent database.setvariable for a persistent store.
getvariable ( Name )
Returns the non-persistent named variable
Name
or nil if non-existent.
exit ( ExitCode )
Terminates the script execution with an
ExitCode
. Non-zero
ExitCodes
will be recorded in the nas activity-log.
tonumber ( Value )
Converts
Value
into a number.
tostring ( Value )
Converts
Value
into a string.
type ( Value )
Returns the variable type as as string.
state ( TriggerName)
This is a shortcut for the trigger.state function.
sleep ( MilliSeconds )
Suspends execution for a given time.
Constants
NIML_CLEAR      = 0 
NIML_INFORMATION    = 1 
NIML_WARNING    = 2 
NIML_MINOR      = 3 
NIML_MAJOR      = 4 
NIML_CRITICAL   = 5 
 
QOS_ASYNCH      = -1    
NAS_AO_INTERVAL = from the current NAS configuration.   
NAS_NAME        = the name of the current NAS.  
NAS_ADDRESS     = the UIM address of the current NAS.   
SCRIPT_NAME     = the name of the executing script. 
SCRIPT_FILE     = the filename of the executing script. 
PROFILE_NAME    = the AO profile that executed the script (if any). 
PROFILE_STATE   = the state of the profile when using the   
on_trigger
 method.
Table structures
As returned from alarm.list(), alarm.get():
.nimid      - unique Nimsoft Id 
.nimts      - timestamp when the alarm was created (at source)  
.source     - source of the alarm (typically ip-address)    
.hostname       - resolved name (robotname or ip-address to name resolution)    
.level      - severity level (0-5)  
.severity       - textual representation of the severity    
level.
.supptime       - timestamp of last suppression.    
.sid        - subsystem identification. 
.subsys     - subsystem string resolved from    
sid.
.message        - alarm message text.   
.suppcount      - number of times event has been suppressed.    
.supp_key       - suppression identification key.   
.origin     - origin of the alarm (stamped by nearest hub, or in some cases the robot.) 
.domain     - name of originating Domain.   
.robot      - name of the sending robot.    
.hub        - name of the nearest hub to the sending robot. 
.nas        - name of originating alarm server. 
.prid       - name of probe issuing the alarm.  
.user_tag1      - user tag 1 (as set by robot). 
.user_tag2      - user tag 2 (as set by robot). 
.visible        - flag for visibility (1 = visible) 
.aots       - AO timestamp  
.arrival        - timestamp when alarm arrived at NAS.  
.time_arrival   - datetime of   
arrival.
.time_supp      - datetime of   
supptime
.
.time_origin    - datetime of   
nimts.
.assigned_at    - datetime at assignment.   
.assigned_to    - user alarm is assigned to.    
.assigned_by    - the user who assigned the alarm.  
.tz_offset      - timezone offset (seconds from GMT)    
.supp_id        - checksum of suppression information.  
.change_id      - checksum of message,severity and subsystem.   
As returned by alarm.transactions(),alarm.history():
.source     - source of the alarm (typically ip-address)    
.hostname       - resolved name (robotname or ip-address to name resolution)    
.level      - severity level (0-5)  
.severity       - textual representation of the severity    
level.
.time       - datetime of event.    
.sid        - subsystem identification. 
.subsys     - subsystem string resolved from    
sid.
.message        - alarm message text.   
.suppcount      - number of times event has been suppressed.    
.origin     - origin of the alarm (stamped by nearest hub, or in some cases the robot.) 
.domain     - name of originating Domain.   
.robot      - name of the sending robot.    
.hub        - name of the nearest hub to the sending robot. 
.nas        - name of originating alarm server. 
.prid       - name of probe issuing the alarm.  
.user_tag1      - user tag 1 (as set by robot). 
.user_tag2      - user tag 2 (as set by robot). 
.visible        - flag for visibility (1 = visible) 
.assigned_to    - user alarm is assigned to.    
.assigned_by    - the user who assigned the alarm.  
.acknowledged_by    - the user who acknowledged the alarm.  
.tz_offset  - timezone offset (seconds from GMT)    
 
type        - transaction type (New,Suppressed major/minor,Acknowledged,Assigned,Closed) only returned by   
alarm.transactions()
.
As returned by alarm.statistics():
.level_clear    - number of open alarms with severity level     
clear
.
.level_information  - number of open alarms with severity level     
information
.
.level_warning  - number of open alarms with severity level     
warning
.
.level_minor    - number of open alarms with severity level     
minor
.
.level_major    - number of open alarms with severity level     
major
.
.level_critical - number of open alarms with severity level     
critical
.
.alarm_count    - number of open alarms.    
.oldest_alarm   - timestamp of the oldest open alarm.   
.newest_alarm   - timestamp of the newest open alarm.   
Custom Pre-Processing
The event table is placed into the Lua context prior to executing the "custom" pre-processing rule. You may alter (launder) the event by setting these fields: message, level, sid, source, hostname, user_tag1, user_tag2, visible, custom_1 through _5, supp_key, and origin. The following fields are present for the script to use:
.source     - source of the alarm (typically ip-address)    
.hostname       - resolved name (robotname or ip-address to name resolution)    
.level      - severity level (0-5)  
.sid        - subsystem identification. 
.message        - alarm message text.   
.origin     - origin of the alarm (stamped by nearest hub, or in some cases the robot.) 
.domain     - name of originating domain.   
.robot      - name of the sending robot.    
.hub        - name of the nearest hub to the sending robot. 
.prid       - name of probe issuing the alarm.  
.user_tag1      - user tag 1 (as set by robot). 
.user_tag2      - user tag 2 (as set by robot). 
.supp_key       - suppression identification key.   
.visible        - flag for visibility (true = visible)  
The script is expected to return the event (modified or not) or nil. A nil indicates that the event is to be skipped.
Note that the user_tag1 and user_tag2 fields will be stored in the database when the inbound alarm translates into a new event.
Note that all pre-processing handling will, by nature, slow down the processing of inbound alarms.
Note that only a subset of the lua methods are available to the pre-processing script. The trigger.state method, through the state method, is available. These classes and methods are not available:
  • exit
  • sleep
  • Nimsoft
  • pds
  • trigger
  • action
  • database
  • alarm
  • note