xyOps Expression Format

June 7, 2026 ยท View on GitHub

Overview

xyOps uses a custom expression syntax built upon the open-source JavaScript Expression Language (or JEXL). We extend JEXL by adding a set of custom functions you can call from inside your expressions (see below), and also allow for inline macro expansion in string evaluations, using the popular {{ mustache }} syntax. This is used to power the following xyOps subsystems:

  • Monitor Expressions
  • Alert Trigger Expressions
  • Alert Messages
  • Plugin Parameters
  • Workflow Decision Controllers
  • Workflow Split Controllers
  • Web Hook Messages
  • Email Templates

The xyOps Expression Format is a JavaScript-style syntax with dot paths, array indexing, arithmetic and boolean operators. Using it you can traverse deep object trees (e.g. ServerMonitorData), pull out individual values, and perform operations on one or more values.

Since it is built upon JEXL you can easily traverse arrays of objects, and select items from an array based on sub-object keys. See examples below for details.

Examples

  • Monitor Expression: processes.list[.command == 'ffmpeg'].memRss
  • Alert Expression: monitors.load_avg >= (cpu.cores + 1)
  • Alert Message: Less than 5% of total memory is available ({{bytes(memory.available)}} of {{bytes(memory.total)}})

Custom Functions

In addition to the standard JEXL operators, the following custom functions are available to use inside expressions:

Math and Array

FunctionUsageDescription
minmin(4, 5) == 4See Math.min.
maxmin(4, 5) == 5See Math.max.
floorfloor(1.2) == 1See Math.floor.
ceilceil(1.2) == 2See Math.ceil.
roundround(1.2) == 1See Math.round.
clampclamp(50, 0, 100) == 50Clamps a numerical value between a lower and upper limit.
countcount(array)Returns the number of items in an array (as JEXL arrays don't have a length inside expressions).

Searching

FunctionUsageDescription
findfind(array, key, value)Finds objects in an array using a named property and a substring match.
includesincludes(array, key)Find a substring in a string, or an element in an array.
matchmatch(string, pattern)Perform a regex match on a string. The pattern itself must also be specified as a string.

String Formatting

FunctionUsageDescription
bytesbytes(1048576) == "1 MB"Returns a human-friendly size given a raw byte count.
numbernumber(1048576) == "1,048,576"Returns a human-friendly localized number (in the server's locale).
pctpct(0.5, 1.0) == "50%"Returns a human-friendly percentage given a value and a maximum.
integerinteger("1abc") == "1"Attempts to coerce an integer out of a string.
floatfloat(1.33333333) == "1.33"Shortens a float to a maximum of 2 digits after the decimal.

Misc

FunctionUsageDescription
encodeencode("a b") == "a%20bCalls encodeURIComponent to encode a string.
stringifystringify(obj) == "{...}"Calls JSON.stringify to serialize an object into a string.
serverserver("smog7ph67nvh6891z") == "myhostname.domain.com"Resolve a server ID to its label (or hostname if no label is set).
eventevent("emq3y5434ggm74ezk") == "Backup Database"Resolve an Event ID or Job ID to the event title.

See Also