The following procedures explain how to change the columns displayed in all list views for a particular object type, such as hosts or services. If you want to create new list view definitions, see Manage list view filters.
For more information on how list views are used in OP5 Monitor, see List views.
The format of each list view type is defined in a specific table. For example, the table for host list views is called
Hosts, so you specify changes to the host list views in that table.
For a complete reference of the columns available for each table, see List view filter column reference.
You specify which columns to display in list views in your OP5 Monitor account settings. For more information, see Customise list views.
By default, all the table definitions have
default column settings, which sets them to display all non-custom columns. You can change the default settings to a comma-separated column list.
The format for adding new columns to tables is
"<label>" = <data>, where:
<label>is the column name.
<data>is the source of data.
You can add the text above with or without spaces between the values and the equals sign.
For example, to add a host notes column, you add
"Notes" = notes to the Table Hosts field in your account settings:
You can also add host notes to service list views by adding the object field variable
host.notes to the
For more information about object field variables, see Object field variables.
You can create clickable links in list views by adding a column definition containing HTML code, for example, adding the text in Table Hosts creates a column called
Asset ID in hosts list views, with a clickable link to an external inventory system:
"Asset ID" = "<a href=\"http://inventory.example.org/?asset=" + notes + "\">Asset " + notes + "</a>"
You can add a custom variable to a column in the format
custom_variable.<VARIABLE_NAME>. For more information on custom variables and how to create them, see Create a new custom variable.
In list view syntax, custom variables are written without the underscore prefix. In the following example, custom variable
_ASSETID is added to the HTML code example in the Add clickable links to list view columns procedure above:
"Asset ID" = "<a href=\"http://inventory.example.org/?asset=" + custom.variable.ASSETID + "\">Asset " + custom.variable.ASSETID + "</a>"
You can remove a column from a list view by adding the column name with a minus sign before it, as in the following example:
OP5 Monitor includes a language for creating column definitions as expressions. An expression can return a value of type string, number, boolean, or list. Expressions can include any of the elements listed below.
|Operator||Example||Description||Order of priority|
||Compares the values, true if
||Computes the sum of
||Computes the difference of
||Computes the product of
You can use variables to access field information about objects. Many of the variables return information about other objects, for example, the host
name field is accessible to services by using the
You can construct column definitions using field variables, such as in the following services table example:
"Identifier" = host.name + ";" + description
For a complete reference of field variables you can use, see List view filter column reference.
You can use function calls to manipulate and format data. The syntax is as follows:
functionname(arg, arg, arg, ...)
The functions available are listed in the table below.
||Joins each element in the list to a string, with
||Converts atimestamp to a human readable time. Many columns return a timestamp, which needs to be processed with this function to be readable.|
||Returns the value of an argument, given the value of
||Escapes a string to be used as an attribute in a URL. Useful when building links.|
||Escapes a string to be visible on the page. Useful, for example, for plugin output to be visible without interfering with the rest of the custom column style.|
Builds a link to an internal OP5 Monitor page.
|| Convert newlines to linebreaks. This is useful for formatting long plugin outputs as a custom column. For example:
You can use
if statements for conditional processing. The syntax is as follows:
if test-expression then expression-if-true else expression-if-false
if has_been_checked then "yes" else "no"
You can use list comprehension to apply an expression to each element of a list. The syntax is as follows:
[ for-every-element-expression for variable in list-expression ]
OP5 Monitor applies
for-every-element-expression to each element in the
list-expression list in turn, setting
variable to the element value.
The following example creates a link to the
extinfo for each of a host's services in the host table.
[ link( "/extinfo/details?host=" + urlencode(name) + "&service=" + urlencode(svc), htmlescape(svc) ) for svc in services ]
name comes from the host, which also includes the
services field, and the
svc variable value is set by the list comprehension in the first expression which generates the link.
You can apply filters in a list comprehension to limit the number of values returned, such as an
for-every-element-expression for variable in list-expression if filter-expression ]
You can rewrite the earlier statement with an
if statement filter, to output only services named "PING", as follows:
[ link( "/extinfo/details?host=" + urlencode(name) + "&service=" + urlencode(svc), htmlescape(svc) ) for svc in services if svc = "PING" ]
You can access an indexed element of a list by adding
[id] as an integer value. The first attribute of the statement needs to be a variable, not an expression. For example:
"First service" = services
You can use this in combination with host field
services_with_info and a list comprehension.
You can find a complete reference of the custom column language syntax on your OP5 Monitor server, by entering URL