Manage list view filters
Overview
Filters are used by OP5 Monitor to filter out content in list views, based on information such as names, states, and comments. All OP5 Monitor list view definitions are based on filters.
You can use filters to filter existing list views and to create new list view definitions. OP5 Monitor list views come with a filter builder feature, where you can enter filter queries either graphically or manually.
For more information on how list views are used in OP5 Monitor, see List views in Introduction to monitoring hosts, services, and groups.
Filter builder
You can filter list view content using the filter builder, then save your filter in the OP5 Monitor menus if you want to use it again. The filter builder includes both a manual input field and a graphical input section with drop-down lists. The manual and graphical sections are linked, so that if you update one, it dynamically updates the other. Updating the filter builder also dynamically updates the list view you can see in the background, or shows an error in the background if the filter definition is incorrectly specified.
Filter definitions
Rules
You build filter definitions from rules, which are sets of tests run against the column attributes of the list view object, to determine whether to display an object in the list view or not. For example, the rule [services] check_freshness = 1
results in a list view displaying services with the check_freshness
option enabled.
For a complete list of column attributes available for each table, see List view filter column reference.
Note: Attribute values can have different meanings for different objects. For example, host states are 0
for down and 1
for up, whereas for services, 0
is an OK state and 1
is a warning state. For more information, see List view filter column reference.
Negation
Negating a rule has the effect of placing a not
in front of the whole rule, testing for the opposite condition. For the above example, the negated rule results in a list view displaying services without the check_freshness
option enabled.
Groups
Filter groups provide a way to group sets of two or more rules. You can define groups with AND
operators, where all of the rules in the group must be true for the group to be true, or OR
operators where any of the rules in the group must be true for the group to be true. You can also negate groups, with the same effect as negating rules.
Both rules and groups can be nested, so that the results of the tests in a nested rule or group can be used for tests at the level above.
Date and time
When filtering on fields with either a date or time, it is possible to use relative time or specific time. It is also possible to use both relative and specific time in combination.
Some examples of time you can use are as follows:
- now
- yesterday
- today
- this week
- 2 hours ago
- one month ago
- 16:30:00
These can also be used in combination, for example:
- last week + 1 hour
- yesterday 16:30:00
Create a filter
This procedure explains how to create a filter by specifying rules and groups. For an explanation of these advanced concepts, see Filter definitions. When you finish creating the filter, you can save it for yourself and others to access later, in the relevant Monitor sub-menu. You can save up to ten filtered list views in each sub-menu.
You need to open the filter builder from an existing list view, but you can define a different list view altogether and save it with a new name.
To create a filter:
- Open a list view, such as Monitor > Hosts > All Hosts.
- Click the filter icon at the top right.
- Enter the filter definition using the manual input, or use the graphical input to enter the definition as follows:
- Select the list view object from the first graphical input drop-down list. OP5 Monitor automatically updates the manual input and loads the view relating to the definition in the background.
- Update the rule fields. For the All Hosts view there are no other criteria. If, however, you start by opening the Monitor > Services > acknowledged services view, you can see additional criteria set for the filter:
- Create other rules or groups in the same group, as follows:
- Add rule to add another rule.
- Add and group to add another group with an
AND
operator. You can create other rules and groups inside this group in the same way. - Add or group to add another group with an
OR
operator. You can create other rules and groups inside this group in the same way. - Negate group to negate the group.
- Add other groups at the top level, as follows:
- Add and group, to add another group with an
AND
operator. - Add or group to add another group with an
OR
operator.
- Add and group, to add another group with an
You can also click Negate next to the rule to negate it. In this example, this has the effect of changing the manual input to
[services] not(acknowledged) = 1
and changing the list view to display unacknowledged services. - When you have finished adding the rules and groups, you can save the filter, if required, as follows:
- Enter a name in the Filter Name field.
- Check the Make global checkbox, if the filter is to be available to other OP5 Monitor users.
- Click Save Filter.
- Click Close filter builder.
OP5 Monitor opens the filter builder, displaying the filter definition for the current view, which is the All Hosts view in the example below:
Examples
Example 1
This list view shows all hosts in a host group called network
, which send notifications to a contact group called support-group
.
Example 2
This list view shows all services that use the check command check_tcp
.
Although you can use the equals sign (=
) for an exact string match, you can also use ~~
for a more flexible string match, including any strings containing the string, case-insensitive.
Manage filters
You can use the function Manage > Manage filters for viewing and deleting all the filtered list views defined for your OP5 Monitor instance. You an click any filter in the list to be redirected to its associated list view.
To delete a filter:
- Click Manage > Manage filters.
- Click the delete icon next to the filter that you want to remove.