Add a Custom Script Condition
- Click 'Assets' > 'Monitoring & Management' > 'Monitors', open a monitor, click 'Edit', open the 'Conditions' tab, then click 'Add Condition' > 'Custom script'.
The condition runs a script of your own on the device and lets that script decide whether to raise the alert.
You can test anything the shipped condition types do not cover, and supply your own alert text.

The fields
| Field | Type | Options / default | Required |
| Name | Text box | Empty by default. | Yes |
| Description | Textarea | Empty by default. | No |
| Check Period | Number box and unit | Pre-filled '5', with a unit dropdown offering 'min' (selected), 'hours' and 'days'. | No |
| Trigger monitoring alert if custom script failed | Checkbox | Clear by default. Raises the alert when the script itself errors rather than returning a verdict. | No |
| Triggering Method | Dropdown | 'By status change' (default), 'By status'. | No |
| (the script editor) | Code editor | A line-numbered editor pre-filled with a template that checks User Account Control. It carries its own 'Add Existing Procedure', 'Undo' and 'Redo' buttons. | Yes |
The dialog's own note: 'This monitor will be triggered if status is changed from OFF to ON.'
It adds: 'Please write your code on below box to create your own custom script condition. Please use "alert(1)" to turn on the condition (trigger an alert) and "alert(0)" to turn off the condition (disable an alert). Please define the custom alert text inside the code with "Print" function.'
Add the condition
- Type a name into 'Name' and a description if it helps.
- Set how often the script runs in 'Check Period'.
- Decide whether a failing script should itself raise an alert with 'Trigger monitoring alert if custom script failed'.
- Choose 'By status change' or 'By status' in 'Triggering Method'.
- Write the script in the editor, calling alert(1) to raise the alert and alert(0) to clear it.
- Click 'Create'.
- Click 'Save' on the monitor header to store the change.
Note: 'By status change' raises the alert only when the verdict flips from clear to triggered, which is usually what you want. 'By status' raises it on every check while the condition holds.
