26
CONTENTS
8
Event notification
Certain power controller events can trigger configurable notifications over a variety of media:
• email;
• XMPP (Jabber, Google Talk, etc.);
• SNMPv1, SNMPv2c and SNMPv3 TRAPs;
• SNMPv2c and SNMPv3 INFORMs;
• webhook.
Notification is based on the
Lua
programming language.
8.1
Notification context
When an event happens, a notification thread is started, with event's properties being copied to global variables
(and thus constituting the context of further notification code snippets).
The most important of the rule action context (see below) is the
notify
function, which sends the current notifica-
tion context to matching targets.
All kinds of events share the following properties:
•
id
— the event type identifier,
•
message
— a human-readable message,
•
severity
— the event severity level.
By manipulating the context, rules can check for and adjust the event's properties and prepare it for sending.
For example, you can have a rule with an empty condition and an action altering the 'message' variable like this:
message="Server room power: "..message
All the following rules will include the "Server room power:" prefix in the generated notifications.
Some properties, e.g.
message_short
or
message_long
, are supported by notification targets but aren't
generated by any events; it's up to the action code to set them if necessary.
It's important to note that rules are processed linearly: adjustment of properties doesn't cause preceding rules to
be re-examined.
Additionally, different event types have more specific properties. All event properties can be checked for in the or
adjusted.
The following convenience severity level constants are defined:
•
EMERG
,
EMERGENCY
— "emergency" severity level,
•
ALERT
— "alert" severity level,
•
CRIT
,
CRITICAL
— "critical" severity level,
•
ERR
,
ERROR
— "error" severity level,
•
WARNING
,
WARN
— "warning" severity level,
•
NOTICE
— "notice" severity level,
•
INFO
,
INFORMATION
,
INFORMATIONAL
— "informational" severity level,
•
DEBUG
— "debug" severity level.
Their numeric values are defined so that a higher severity is larger, so condition like
severity
>
=CRITICAL
behaves like what you'd expect.
The
core Lua functions
are accessible from the context as well, should you need them.
DLI DIN4 User’s Guide: 20170809T111540Z
Summary of Contents for DIN4
Page 1: ...DLI DIN4 User s Guide 20170809T111540Z ...
Page 57: ......