20,919,685Total Points24,106Total Sites23,382Cell Towers69,500Racks Monitored56,753HVAC Units Monitored31,322UPS Units Monitored24,788Generators Monitored20,919,685Total Points24,106Total Sites23,382Cell Towers69,500Racks Monitored56,753HVAC Units Monitored31,322UPS Units Monitored24,788Generators Monitored20,919,685Total Points24,106Total Sites23,382Cell Towers69,500Racks Monitored56,753HVAC Units Monitored31,322UPS Units Monitored24,788Generators Monitored

Chapter 5: Events & AlarmsLesson 27 of 65

How to Configure Event Handlers: Email, Scripts, Set Points, and Process

Create and configure Mango by Radix IoT event handlers: email with escalation, set point actions, script callbacks, and the process handler, which is disabled until enabled in mango.properties.

  • 12 min read
  • Intermediate
  • Mango 4.x / 5.x

Overview

Event handlers define what happens when an event is raised. Mango by Radix IoT has seven handler types: four built into the core, Email, Set point, Script and Process, and three that come with modules, SNMP, Excel report and Slack message. This guide covers the four core handlers in depth and summarizes the other three.

Handler Types at a Glance

Handler TypeActionCommon Use
EmailSends an email when the event is raised, escalates, or returns to normalAlert operators and supervisors
Set pointWrites a value to a settable data pointAutomated shutdowns, mode changes
ScriptRuns script callbacks for the eventComplex logic, multi-step responses
ProcessRuns an operating system command (disabled until enabled in mango.properties)External integrations, file operations
SNMPSends an SNMP trap (SNMP module)Network monitoring integrations
Excel reportRuns an Excel report template when the event is raised or returns to normal (Excel Reports module)Alarm-driven reports
Slack messagePosts to a Slack channel (Slack module)Team chat notifications

SNMP, Excel report and Slack message appear only when their modules are installed. Slack has its own guide, Configuring Slack Notifications for Mango Alarms.

Creating a Handler

  1. Open Event Management > Event handlers and choose New (Create event handler)
  2. Pick the Event handler type and enter a Name
  3. On the Event types tab, tick the events the handler responds to. One handler can serve many event types, and one event type can have several handlers
  4. Configure the type-specific settings below, then Save. Disabled switches a handler off without deleting it

You can also start from the Events page: the link in an event's Event handlers column (Handle this event type) opens the Event handlers page for that event type.

Email Handler

The most common handler type. It sends an email when the event is raised, can escalate while the event stays active, and can send a follow-up when it returns to normal.

Configuration

  1. Choose Email as the Event handler type
  2. Add Email recipients: Mango users, mailing lists, or email addresses typed in directly
  3. Choose the Subject line: Include handler name or Include event message. The rest of the subject is fixed: {alarm level} - {name or message} ({notification type}) - id:{event id}
  4. Optionally add context: Include system information, Include previous point values for point events, Include logfile
  5. Optionally add Escalation entries, each with an Escalation delay/interval, an Escalation mode (Until inactive (return to normal) or Until acknowledged or inactive (return to normal)), a Maximum emails to send (or Send unlimited emails), and its own Escalation email recipients
  6. Optionally tick Send inactive email. It goes to everyone who received the active or an escalation email; tick Override inactive recipients to choose different ones

There is no email on acknowledgement; acknowledging an event only stops escalation in the Until acknowledged or inactive mode.

Custom Email Templates

The email body comes from Mango's FreeMarker templates. To change it, provide a Custom email template. The event is available as evt:

  • ${evt.message}: the event message text
  • ${evt.alarmLevel}: the alarm level
  • ${evt.activeTimestamp}: when the event was raised, in milliseconds; format it with ?number_to_datetime
  • ${evt.rtnTimestamp}: when the event returned to normal

Prerequisites

Email handlers need working outbound email under Administration > System settings > Email settings; use Send test email there before relying on them. Setting that up is covered in Configuring Event Handlers and Email Alerts.

Set Point Handler

Writes a value to a settable data point when the event is raised and, optionally, when it returns to normal. Used for automated responses.

Configuration

  1. Choose Set point as the Event handler type
  2. Choose the Target point. It must be settable
  3. Choose the Active action, applied when the event is raised: None, Set to point value (copy another point's current value, which must be the same data type), Set to static value (enter the Value to set), or Set to scripted value
  4. Optionally choose an Inactive action from the same list, applied when the event returns to normal

If the write cannot happen (the target point is missing or not settable, or a copied value has the wrong data type), Mango raises a Set point event handler failure system event naming the cause.

Examples

ScenarioTarget PointActive ActionInactive Action
Emergency shutdown on high tempEquipment Enable (binary)Static value: falseNone (manual restart required)
Switch to backup modeOperating Mode (multistate)Static value: 2 (Backup)Static value: 1 (Normal)
Open cooling valve on alarmValve Position (numeric)Static value: 100Static value: 0

Warning

Set point handlers write to real equipment. Test thoroughly in a safe state before deploying automated control actions on production equipment.

Script Handler

Runs script callbacks when the event changes state. Use it for logic that goes beyond a single set-point operation.

Configuration

  1. Choose Script as the Event handler type and pick a Script engine
  2. Write the callbacks: eventRaised(event) and eventInactive(event) are required; eventAcknowledged(event) is optional
  3. Set Script roles (permission groups). The script reads and writes points with these roles

Example Use Cases

  • Multi-step shutdown sequence: Disable equipment in a specific order with delays between steps
  • Conditional notification: Send different notifications based on time of day or which device alarmed
  • Data logging: Write alarm details to an external system or log file
  • Calculated response: Read multiple point values to determine the appropriate action

Process Handler

Runs an operating system command on the Mango server. Use it for integrations with external systems.

Warning

The Process handler is disabled by default because it allows remote code execution if the wrong person can configure it. It runs nothing until event-handlers.process.enabled=true is set in mango.properties; until then Mango only logs a warning. Never run Mango as root if you enable it.

Configuration

  1. Choose Process as the Event handler type
  2. Enter the Active process command, run when the event is raised, and its Active process timeout (s)
  3. Optionally enter the Inactive process command, run when the event returns to normal, and its Inactive process timeout (s)
  4. Use Test command to try a command before saving

To put event details into a command, tick Interpolate commands (access event properties) and use ${event.property}, for example ${event.id} or ${event.alarmLevel}. Interpolation is also off by default and needs event-handlers.process.interpolation-enabled=true in mango.properties. It is the riskier setting, because text from an event message ends up in a shell command.

Example Commands

  • /usr/local/bin/send_sms.sh +15551234567 "High temp alarm on Gen-1"
  • python3 /opt/scripts/log_alarm.py --event-id ${event.id} (needs interpolation)

Warning

Process handlers run with the same OS permissions as the Mango service account. Limit permissions on the Mango service account and validate all external scripts.

Handler Timing

Each handler type acts at its own points in the event lifecycle:

HandlerWhen the event is raisedWhile it stays activeWhen it is acknowledgedWhen it returns to normal
EmailEmail to recipientsEscalation entriesStops escalation in Until acknowledged or inactive modeOptional inactive email
Set pointActive action——Inactive action
ScripteventRaised—eventAcknowledged (optional)eventInactive
ProcessActive process command——Inactive process command

Multiple Handlers per Event

Several handlers can respond to the same event type. A common combination:

  1. Email handler with an escalation entry (operator now, supervisor after 15 minutes)
  2. Set point handler (automated safety response)
  3. Script handler whose eventInactive does logging and cleanup

Testing Handlers

  • Use a virtual data source to simulate alarm conditions safely
  • Verify email delivery with Send test email first
  • For Set point handlers, test against a virtual point before a real equipment point
  • Check ma.log for handler execution errors

Troubleshooting

IssueCauseFix
Email not receivedOutbound email not configured, disabled, or unreachableUse Send test email under Email settings; check the handler's recipients and the spam folder
Set point handler doesn't writeTarget point missing or not settable, or a copied value of the wrong typeRead the Set point event handler failure system event; fix the target point or action
Script handler errorScript error, a missing required callback, or Script roles that cannot reach a pointCheck ma.log; check Script roles
Process handler does nothingThe handler (or interpolation) is disabled in mango.propertiesLook for "Process event handler is disabled" in ma.log
Process handler times outCommand runs longer than its timeoutIncrease the timeout or optimize the external command

Tips from the Field

Warning

A script inside a handler (a Script handler, or a Set point handler’s scripted value) runs with the handler’s Script roles, not with the permissions of whoever is logged in. Give those roles access to every point the script reads or sets, and nothing more.

Note

Mango does not include a built-in SMS handler. To send SMS notifications on alarm, either (1) use an SNMP handler to send a trap to an SMS gateway appliance, or (2) use a script handler (for example with the HttpBuilder script utility) or a process handler to call an external SMS API (e.g., Twilio, AWS SNS).

Tip

For complex event response logic that goes beyond what a process handler can do in a single OS command, use a script handler instead. Script handlers can read multiple points, apply conditional logic, and take different actions based on system state, all within a single handler.

Summary

Mango provides seven event handler types: Email, Set point, Script and Process in the core, and SNMP, Excel report and Slack message from modules. Create them under Event Management > Event handlers and tick the event types they respond to. Use email for notifications (with escalation for follow-up), set point for automated control, scripts for complex logic, and process, once deliberately enabled, for external integrations. Combine several handlers on one event type for layered response strategies, and always test handlers safely before deploying to production.

Get free access to all 65 Mango by Radix IoT training lessons

One short form unlocks every lesson and its video in this browser.

This form is hosted by Zoho. It loads only after you enable support cookies or choose to load it below.

We honored your browser’s Global Privacy Control signal — optional cookies are off and nothing is tracked.