opEvents releases after 1.1.0 include a facility to define your own templates for email notifications (ie. emails as part of an event action or because of an escalation).

The setup is very simple and requires basically just two steps:

  1. deciding on what information to present and in what order, and
  2. associating a contact with a particular template.

Defining custom email templates

The configuration file install/EventEmails.nmis contains the definitions of all email templates. As shipped it includes one special template named default, which is chosen for all email contacts without a template association, and one example for a very concise report. You can of course modify these existing templates or define your own. Here are these two example templates:

'default' => [
 	"Event Context:\n", "link.eventcontext", "\n\n",
 	"Node Properties:\n","node.*","\n\n",
 	"Event Properties:\n","event.*","\n","\n",
],
'veryshort' => [
	"The event \"","event.event", "\" for host \"", "node.name", 
	"\" occurred at ", "event.date",
	".\nAll event details can be found here: ", "link.eventcontext", 
	"\n",
	"All node details can be found here: ", "link.nodecontext", "\n\n",
 ],

The syntactic rules for templates are simple but  flexible: