Alarm Functions

The N2 Logic Node allows you to raise alarms of the appropriate as required at runtime. To fit in with the NCC alarm severity schema, the SDK supports only the following severities:

In most cases, the 'notice' severity is ignored by operations staff and the 'critical' severity will cause phone calls to be made to Important People, often at inopportune times. Bear this in mind.

Alarm Function Parameters

All alarm methods take identical parameters:

Alarm Function Errors

If the provided message is unable to be turned into a string, the following error will be raised:

Alarm text must be of type string, not <target type>.

If code is provided, it must be able to be turned into a number, and must be in the range 0-9999. The following errors are possible:

Alarm code must be a number or not provided. Alarm code must be between 0 and 9999.


Functions


ncc.alarm.critical (message, code)
  Parameters As for Alarm Function Parameters.
  Returns Nothing.
  Errors As for Alarm Function Errors.
Usage Use this function to raise an alarm on the SLC with the severity of 'critical'. For example:

ncc.alarm.critical ("Test CRITICAL alarm (no code)")
Sep 18 17:00:00.000000 n2LogicNode(12345) CRITICAL: {10000000} SDK: Test CRITICAL alarm (no code)

Values provided can be dynamic:

x = 5
if (x < y)
    ncc.alarm.critical ("x (" .. x .. ") is less than y!", 3 * x)
end
Sep 18 17:00:00.000000 n2LogicNode(12345) CRITICAL: {10000015} SDK: x (5) is less than y!


ncc.alarm.error (message, code)
  Parameters As for Alarm Function Parameters.
  Returns Nothing.
  Errors As for Alarm Function Errors.
Usage Use this function to raise an alarm on the SLC with the severity of 'error'. For example:

ncc.alarm.error ("Yes, we have no bananas", 0)
Sep 18 17:00:00.000000 n2LogicNode(12345) ERROR: {10000000} SDK: Yes, we have no bananas


ncc.alarm.warning (message, code)
  Parameters As for Alarm Function Parameters.
  Returns Nothing.
  Errors As for Alarm Function Errors.
Usage Use this function to raise an alarm on the SLC with the severity of 'warning'. For example:

ncc.alarm.warning ("I'm sorry, Dave. I can't allow you to do that.", 9000)
Sep 18 17:00:00.000000 n2LogicNode(12345) WARNING: {10009000} SDK: I'm sorry, Dave. I can't allow you to do that.


ncc.alarm.notice (message, code)
  Parameters As for Alarm Function Parameters.
  Returns Nothing.
  Errors As for Alarm Function Errors.
Usage Use this function to raise an alarm on the SLC with the severity of 'notice'. For example:

ncc.alarm.notice ("Spam, spam, spam, spam, eggs, and spam")
Sep 18 17:00:00.000000 n2LogicNode(12345) Notice: {10000000} SDK: Spam, spam, spam, spam, eggs, and spam