View Categories

Sequences: conditional multi-step jobs

Pro

What it is #

A sequence runs a snippet, reads the output, and reacts: raise or clear an alert, or run another snippet. It turns routine checks into automatic monitoring and fixes.

Example uses

  • Alert when a router’s NTP is not synchronised.
  • If an interface is disabled, run a snippet that re-enables it and alert the NOC.

Pro Included in MikroWizard Pro. Automate checks and follow-up actions without writing scripts.

Compare Free and Pro · Pricing

A sequence starts with a source snippet. MikroWizard checks the output with conditions and runs actions on match. Use it for checks that RouterOS or other devices don’t alert on by themselves.

Sequence condition flowchart
A condition with two actions and a nested condition.

Create a sequence #

  1. Go to Sequences and click Create Sequence.
  2. Enter a Sequence Name and select the Source Snippet (Entry Point).
  3. Options: Sequence Active, Store Execution History, Store Entry Output in Backups.
  4. Click Add Root Condition and choose:
    • Contains Content or Does Not Contain, with the text to look for. Tick Regex to use a regular expression.
  5. Under the condition, click Add Action:
    • Trigger Alert or Clear Alert with an alert definition.
    • Execute Another Snippet (optionally storing its output in Backups). Its output can be checked by a nested condition.
  6. Save.

Alerts #

Manage Alerts defines alert names with a severity: Warning, Error or Critical. A triggered alert becomes an open device event; Clear Alert fixes it. Like all events, it shows on the Monitoring Wall and the map, and is sent by matching alert rules.

Run it #

  • Now: the run button, then choose devices or groups and Execute.
  • On a schedule: a Task Planer task of type Alert Sequence.

The history button shows each run per device, with a trace of which conditions matched. Failed runs are kept for 90 days.

Example: NTP not synchronised #

  1. Snippet ntp-status: /system ntp client print.
  2. Sequence: source ntp-status, condition Does Not Contain synchronized.
  3. Action Trigger Alert NTP not synced (Warning).
  4. Second condition Contains Content synchronized, action Clear Alert NTP not synced.
  5. Task Planer: Alert Sequence, every hour, group All routers.

Example: re-enable a disabled uplink #

Source snippet /interface print where name=ether1. Condition Contains Content with Regex \d+\s+X (the X flag means disabled), actions Execute Another Snippet /interface enable ether1 and Trigger Alert Uplink was disabled.

Common problems #

ProblemCause and fix
A condition never matchesLook at the real output in the run history; RouterOS output differs between versions. Use Regex for flexible matching.
The alert never clearsAdd a condition with Clear Alert for the good case.