Feature Overview
opEvents has the ability to notify people via email and conduct other actions based on criteria the administrator selects.
Order of operation:
- An event matches criteria defined in an action rule.
- An action fires an escalation policy.
- The Escalation policy initiates email or some other action. The email action calls a 'contact' variable.
- The contact variable is resolved to an email address or multiple addresses.
- Emails are sent via an associated email server.
Configuration
Declare an Email Server
opEvents requires an email server in order to sent notifications via email. This email server is associated in /usr/local/omk/conf/opCommon.nmis.
'email' => { 'mail_domain' => 'yourdomain.com', 'mail_from' => 'yourmailname@yourdomain.com', 'mail_password' => 'your_password', 'mail_server' => 'smtp.yourdomain.com', 'mail_server_port' => 25, 'mail_use_sasl' => 'false', 'mail_use_tls' => 'true', 'mail_user' => 'your_user_account@your_domain.com' },
Find the email section in opCommon.nmis and updated the values to match the email server that opEvents should utilise.
Optional - Create an Email Template
It's possible to customise the email format by updating /usr/local/omk/conf/EventEmails.nmis. This article explains how to do this: Email templates in opEvents
Configure a Contact
A 'contact' in variable that can represent one or many email addresses. opEvents can utilize the NMIS contacts file or the OMK contacts file. In order to determine which file your system is using look in opCommon.nmis; find the opevents section then look for the opevents_contacts attribute.
'opevents' => { 'black_list_enabled' => 'true', 'log_archive_enabled' => 'true', 'nmis_non_stateful_events' => 'Node Configuration Change|Node Reset', 'opevents_action_max_runtime' => 30, 'opevents_action_policy' => '<omk_conf>/EventActions.nmis', 'opevents_application_heading' => undef, 'opevents_archivelogs_purge_older_than' => undef, 'opevents_auto_acknowledge' => 'true', 'opevents_auto_acknowledge_up' => 'true', 'opevents_auto_create_nodes' => 'true', 'opevents_contacts' => '<omk_conf>/Contacts.nmis',
In the example above (last line) the OMK contacts file is being used.
In Contacts.nmis create a new contact or modify and existing one with the desired email address(es). If desired an email template may be associated with the contact. Multiple emails may be assigned to the Email attribute, simply separate them by a comma.
%hash = ( 'contact1' => { 'Contact' => 'Contact1', 'Phone' => '', 'DutyTime' => '06:20:MonTueWedThuFri', 'Level' => '(Fatal|Critical|Major|Minor|Warning|Normal)', 'TimeZone' => '0', 'Pager' => '', 'Mobile' => '5555551234', 'Location' => 'default', 'Email' => 'nobody@localhost', 'EmailTemplate' => 'default', } );
Create an Escalation Policy
Escalation policies are created in /usr/local/omk/conf/EventActions.nmis. Find the 'escalate' section and add or modify an existing policy. This is an example of a new escalation policy with the minimum required information.
'escalate' => { 'exampleEmailPolicy' => { 'name' => 'exampleEmailPolicy', 'IF' => { priority => '>= 0', }, '10' => 'email(Contact1)', },
This example states that 10 seconds after the policy is invoked it will email and email addresses associated with 'Contact1' if the priority of the event is greater than zero.