From: Lukas Wagner <l.wagner@proxmox.com>
To: pbs-devel@lists.proxmox.com, pve-devel@lists.proxmox.com
Subject: [PATCH proxmox-backup v7 27/41] docs: notifications: rework matcher sections, describe expression option
Date: Tue, 3 Nov 2026 11:48:44 +0100 [thread overview]
Message-ID: <20261103104859.172466-28-l.wagner@proxmox.com> (raw)
In-Reply-To: <20261103104859.172466-1-l.wagner@proxmox.com>
In the matcher section, focus on the higher-level concepts first, as
this resembles what the user actually has to understand to use the UI.
Move configuration options that are used in the configuration file and
API to a separate subsection. Furthermore, add a brief section
demonstrating the JSON format used by match expressions.
Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
---
Notes:
New in v6.
docs/notifications.rst | 227 +++++++++++++++++++++++++++++++++--------
1 file changed, 184 insertions(+), 43 deletions(-)
diff --git a/docs/notifications.rst b/docs/notifications.rst
index 440c700a4..3e2b66ce5 100644
--- a/docs/notifications.rst
+++ b/docs/notifications.rst
@@ -195,63 +195,204 @@ Notification Matchers
Notification matchers route notifications to notification targets based on
their matching rules. These rules can match certain properties of a
-notification, such as the timestamp (``match-calendar``), the severity of the
-notification (``match-severity``) or metadata fields (``match-field``). If a
-notification is matched by a matcher, all targets configured for the matcher
-will receive the notification.
+notification, such as the timestamp, the severity of the notification or
+metadata fields, as well as arbitrary combinations of these. If a notification
+is matched by a matcher, all targets configured for the matcher will receive
+the notification.
-An arbitrary number of matchers can be created, each with with their own
-matching rules and targets to notify. Every target is notified at most once for
-every notification, even if the target is used in multiple matchers.
+An arbitrary number of matchers can be created, each with their own match rules
+and targets to notify. Every target is notified at most once for every
+notification, even if the target is used in multiple matchers.
-A matcher without rules matches any notification; the configured targets will
-always be notified.
+Match Rules
+^^^^^^^^^^^
+
+Notification matchers can be configured in the GUI under *Configuration →
+Notifications*. Matchers can be created, modified and deleted from this view.
+
+When editing a matcher, match rules can be edited under the *Match Rules* tab.
+Rules are represented as a tree. Each tree node can either match on properties
+of a notification (fields, severity or timestamp) or combine the results of
+child nodes (e.g. *All sub-rules match*). Combinator nodes can be nested, which
+makes it possible to compose arbitrarily complex matching behavior.
+
+The following node types are available:
+
+* **Always match**: Match any notification.
+
+* **All sub-rules match**: All direct children of this node must match.
+
+* **At least one sub-rule matches**: At least one direct child of this node
+ must match.
+
+* **Exactly one sub-rule matches**: Exactly one direct child of this node must
+ match.
+
+* **Match Field**: Match a metadata field of a notification. This node can
+ either match if the field value matches one of the values provided, or,
+ alternatively, if it matches a regular expression. Available fields are
+ listed in :ref:`notification_events`.
+
+* **Match Calendar**: Check if the timestamp of a notification is within a
+ configured time range, based on a selection of weekdays and one contiguous
+ time range within each day (e.g. Monday to Friday, 09:00 to 17:00). If
+ multiple time ranges within a day must be matched, use an **At least one
+ sub-rule matches** node with one **Match Calendar** child per time range.
+
+* **Match Severity**: Match the severity of a notification. The following
+ severity levels are available: ``info``, ``notice``, ``warning``, ``error``
+ and ``unknown``. Each **Match Severity** node can specify multiple severity
+ levels it matches on, for instance ``info`` and ``notice``.
+
+Each node in the tree can be inverted by checking **Invert Rule**. For instance,
+for a **Match Severity** node matching on ``info``, checking **Invert Rule**
+lets the node match on ``notice``, ``warning``, ``error`` and ``unknown``.
+
+Under the *Targets to Notify* tab, one or more notification targets can be
+selected. All selected targets are notified if a notification is matched.
+
+Matcher Configuration Options
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+This section gives an overview of the options used by matchers in the
+configuration file and in the API.
+
+The following options are used in configuration entries for matchers:
+
+* ``target``: Determine which target should be notified if the matcher
+ matches. Can be used multiple times to notify multiple targets.
+* ``disable``: Don't evaluate this matcher.
+* ``comment``: Comment for this matcher.
+* The matching behavior is defined either by the ``expression`` option or by
+ the deprecated options below; the two cannot be combined.
+
+ * Expression-based matchers (preferred):
+
+ * ``expression``: Ruleset for this matcher as a single JSON-serialized
+ object (:ref:`notification_match_expression_reference`).
+
+ * Deprecated matcher options:
+
+ * ``invert-match``: Inverts the result of the whole matcher.
+ * ``mode``: Determines how the individual match rules are evaluated to
+ compute the result for the whole matcher. If set to ``all``, all
+ matching rules must match. If set to ``any``, at least one rule must
+ match. Defaults to ``all``.
+
+ * ``match-calendar``: Match the notification's timestamp against a
+ schedule. Days can be specified as an inclusive range (e.g.
+ ``mon..wed``) or enumerated (e.g. ``mon,wed,sat``). If no days are
+ specified, the time range applies to every day of the week (e.g.
+ ``08:00-12:00``). Examples:
+
+ * ``match-calendar mon..wed 9-12``
+ * ``match-calendar mon,wed,sat 08:15-12:35``
+ * ``match-calendar 04:15-16:35``
+
+ * ``match-field``: Match a notification's metadata field, either against
+ a list of matched values, or as a regular expression. If the field does
+ not exist, the notification will not be matched. Examples:
+
+ * ``match-field exact:type=gc``
+ * ``match-field exact:type=prune,verify``
+ * ``match-field regex:datastore=^backup-.*$``
+
+ * ``match-severity``: Match the notification's severity. Examples:
+
+ * ``match-severity error``
+ * ``match-severity warning,error,unknown``
+
+A matcher without any matching rules always matches; the configured targets
+will always be notified.
+
+Starting with Proxmox Backup Server 4.3, match rules created and edited via the
+GUI are stored as a single option ``expression`` in the respective matcher
+configuration entry. The previously used options (``match-field``,
+``match-calendar``, ``match-severity``, ``mode`` and ``invert-match``) will
+continue to be supported at least until the next major release.
+
+.. NOTE:: Any existing matcher will be migrated to use the newer ``expression``
+ option when edited through the GUI.
See :ref:`notifications.cfg` for all configuration options.
-Calendar Matching Rules
-^^^^^^^^^^^^^^^^^^^^^^^
-A calendar matcher matches a notification's timestamp.
+.. _notification_match_expression_reference:
-Examples:
+Match Expression Reference
+^^^^^^^^^^^^^^^^^^^^^^^^^^
-* ``match-calendar 8-12``
-* ``match-calendar 8:00-15:30``
-* ``match-calendar mon-fri 9:00-17:00``
-* ``match-calendar sun,tue-wed,fri 9-17``
+This section describes the representation used to encode rules in the
+``expression`` parameter.
-Field Matching Rules
-^^^^^^^^^^^^^^^^^^^^
-Notifications have a selection of metadata fields that can be matched. When
-using ``exact`` as a matching mode, a ``,`` can be used as a separator. The
-matching rule then matches if the metadata field has **any** of the specified
-values.
+The ``expression`` option contains a JSON-formatted tree structure of rules,
+with leaf nodes matching on the properties of a notification (``field``,
+``severity``, ``calendar``) or representing constants (``constant``).
+Intermediate nodes and the root node encode the relationship between them
+(``all-of``, ``any-of``, ``one-of``, ``not``).
-Examples:
+============ ======================================================== ========= ===============================
+Node Type Description Leaf Node Example
+============ ======================================================== ========= ===============================
+``all-of`` Match if all child nodes match No ``{"all-of": [<expr>]}``
+``any-of`` Match if any child node matches No ``{"any-of": [<expr>]}``
+``one-of`` Match if exactly one child node matches No ``{"one-of": [<expr>]}``
+``not`` Invert the result of a single child node No ``{"not": <expr>}``
+``constant`` Always or never matches, depending on the boolean value Yes ``{"constant": true|false}``
+``match`` Match on a property of a notification Yes ``{"match": <match-expr>}``
+============ ======================================================== ========= ===============================
-* ``match-field exact:type=gc`` Only match notifications for garbage collection
- jobs
-* ``match-field exact:type=prune,verify`` Match prune job and verification job
- notifications.
-* ``match-field regex:datastore=^backup-.*$`` Match any datastore starting with
- ``backup``.
+``match`` leaf nodes can have the following variants (``<match-expr>``):
-If a notification does not have the matched field, the rule will **not** match.
-For instance, a ``match-field regex:datastore=.*`` directive will match any
-notification that has a ``datastore`` metadata field, but will not match if the
-field does not exist.
+============ =========================================================================== ===================================================================
+Match Type Description Example
+============ =========================================================================== ===================================================================
+``calendar`` Check if the notification's timestamp is within a configured time range ``{"type": "calendar", "schedule": "mon..fri 9-17"}``
+``field`` Check a notification's fields against a regex or a list of permitted values ``{"type": "field", "field": "job-id", "values": ["a", "b"]}`` or
+ ``{"type": "field", "field": "datastore", "regex": "^backup-.*$"}``
+``severity`` Check a notification's severity against a list of permitted values ``{"type": "severity", "severities": ["info", "notice"]}``
+============ =========================================================================== ===================================================================
-Severity Matching Rules
-^^^^^^^^^^^^^^^^^^^^^^^
-A notification has a associated severity that can be matched.
+A pretty-printed, full example of a non-trivial expression is shown below. It
+encodes an expression matching on garbage collection jobs (``gc``), but only
+within a given time range (``mon..fri 09:00-17:00``) or if it has a severity of
+``warning`` or ``error``. In the API and configuration file, the JSON is
+expected to be stored as a single line, as the value of the ``expression``
+option; the line breaks and indentation are only for demonstration purposes.
-Examples:
+.. code-block:: json
-* ``match-severity error``: Only match errors
-* ``match-severity warning,error``: Match warnings and error
-
-The following severities are in use:
-``info``, ``notice``, ``warning``, ``error``, ``unknown``.
+ {
+ "all-of": [
+ {
+ "any-of": [
+ {
+ "match": {
+ "type": "calendar",
+ "schedule": "mon..fri 09:00-17:00"
+ }
+ },
+ {
+ "match": {
+ "type": "severity",
+ "severities": [
+ "warning",
+ "error"
+ ]
+ }
+ }
+ ]
+ },
+ {
+ "match": {
+ "type": "field",
+ "field": "type",
+ "values": [
+ "gc"
+ ]
+ }
+ }
+ ]
+ }
.. _notification_events:
--
2.47.3
next prev parent reply other threads:[~2026-11-03 10:56 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 10:48 [PATCH many v7 00/41] notifications: add nested match expressions Lukas Wagner
2026-11-03 10:48 ` [PATCH proxmox v7 01/41] add new proxmox-match-expression crate Lukas Wagner
2026-11-03 10:48 ` [PATCH proxmox v7 02/41] notify: log which matchers matched on a notification Lukas Wagner
2026-11-03 10:48 ` [PATCH proxmox v7 03/41] notify: promote matcher to dir-style module Lukas Wagner
2026-11-03 10:48 ` [PATCH proxmox v7 04/41] notify: fix doc comment Lukas Wagner
2026-11-03 10:48 ` [PATCH proxmox v7 05/41] notify: matcher: break out severity matcher into submodule Lukas Wagner
2026-11-03 10:48 ` [PATCH proxmox v7 06/41] notify: matcher: break out field " Lukas Wagner
2026-11-03 10:48 ` [PATCH proxmox v7 07/41] notify: matcher: break out calendar " Lukas Wagner
2026-11-03 10:48 ` [PATCH proxmox v7 08/41] notify: matcher: calendar: add basic unit test Lukas Wagner
2026-11-03 10:48 ` [PATCH proxmox v7 09/41] notify: matcher: add InlineSeverityMatcher Lukas Wagner
2026-11-03 10:48 ` [PATCH proxmox v7 10/41] notify: matcher: add InlineFieldMatcher Lukas Wagner
2026-11-03 10:48 ` [PATCH proxmox v7 11/41] notify: matcher: add InlineCalendarMatcher Lukas Wagner
2026-11-03 10:48 ` [PATCH proxmox v7 12/41] notify: matcher: add expression support Lukas Wagner
2026-11-03 10:48 ` [PATCH proxmox v7 13/41] notify: api: support new expression parameter Lukas Wagner
2026-11-03 10:48 ` [PATCH proxmox v7 14/41] notify: api: add `get_matcher_as_expression` Lukas Wagner
2026-11-03 10:48 ` [PATCH proxmox v7 15/41] notify: move legacy matcher keys behind feature flag Lukas Wagner
2026-11-03 10:48 ` [PATCH proxmox v7 16/41] notify: matcher: don't allow empty field/severity matchers Lukas Wagner
2026-11-03 10:48 ` [PATCH proxmox v7 17/41] notify: matcher: re-serialize expression on create/update Lukas Wagner
2026-11-03 10:48 ` [PATCH proxmox v7 18/41] notify: matcher: ensure that field names match SAFE_ID_REGEX Lukas Wagner
2026-11-03 10:48 ` [PATCH proxmox v7 19/41] notify: matcher: expression: reject ambiguous field matchers Lukas Wagner
2026-11-03 10:48 ` [PATCH proxmox-widget-toolkit v7 20/41] notifications: increase matcher window width Lukas Wagner
2026-11-03 10:48 ` [PATCH proxmox-widget-toolkit v7 21/41] notifications: matcher: add support for match expressions Lukas Wagner
2026-11-03 12:57 ` Dominik Csapak
2026-11-03 15:23 ` Lukas Wagner
2026-11-03 10:48 ` [PATCH proxmox-widget-toolkit v7 22/41] notifications: matcher: add better calendar editor Lukas Wagner
2026-11-03 13:56 ` Dominik Csapak
2026-11-03 14:40 ` Lukas Wagner
2026-11-03 14:57 ` Dominik Csapak
2026-11-03 10:48 ` [PATCH proxmox-widget-toolkit v7 23/41] notifications: matcher: consistently use title case for UI elements Lukas Wagner
2026-11-03 10:48 ` [PATCH proxmox-backup v7 24/41] notification: opt into 'legacy-matchers' feature in proxmox-notify Lukas Wagner
2026-11-03 10:48 ` [PATCH proxmox-backup v7 25/41] api: notification: add 'migrate-to-expression' parameter to get_matcher Lukas Wagner
2026-11-03 10:48 ` [PATCH proxmox-backup v7 26/41] ui: notification: enable new matcher UI Lukas Wagner
2026-11-03 10:48 ` Lukas Wagner [this message]
2026-11-03 10:48 ` [PATCH proxmox-perl-rs v7 28/41] notify: move proxmox-notify bindings from common to pve-rs Lukas Wagner
2026-11-03 10:48 ` [PATCH proxmox-perl-rs v7 29/41] notify: matcher: pass matcher config / updater directly Lukas Wagner
2026-11-03 10:48 ` [PATCH proxmox-perl-rs v7 30/41] notify: opt into 'legacy-matchers' feature in proxmox-notify Lukas Wagner
2026-11-03 10:48 ` [PATCH proxmox-perl-rs v7 31/41] notify: add 'migrate_to_expression' parameter for get_matcher Lukas Wagner
2026-11-03 10:48 ` [PATCH proxmox-perl-rs v7 32/41] debian: document versioned break for PVE::RS::Notify changes Lukas Wagner
2026-11-03 10:48 ` [PATCH pve-cluster v7 33/41] notify: adapt to changed module prefix for PVE::RS::Notify Lukas Wagner
2026-11-03 10:48 ` [PATCH manager v7 34/41] vzdump: " Lukas Wagner
2026-11-03 10:48 ` [PATCH manager v7 35/41] api: notification: pass config/updater directly to rust bindings Lukas Wagner
2026-11-03 10:48 ` [PATCH manager v7 36/41] api: notification: get_matcher: add 'migrate-to-expression' parameter Lukas Wagner
2026-11-03 10:48 ` [PATCH manager v7 37/41] api: notification: add 'expression' to matcher parameter schema Lukas Wagner
2026-11-03 10:48 ` [PATCH manager v7 38/41] ui: notification: enable new matcher UI Lukas Wagner
2026-11-03 10:48 ` [PATCH manager v7 39/41] api: notification: reject matchers with expression if not supported by all nodes Lukas Wagner
2026-11-03 10:48 ` [PATCH docs v7 40/41] notifications: rework matcher sections, describe expression option Lukas Wagner
2026-11-03 10:48 ` [PATCH proxmox-mail-forward v7 41/41] cargo: opt into legacy-matchers feature Lukas Wagner
2026-11-04 22:57 ` [PATCH many v7 00/41] notifications: add nested match expressions Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261103104859.172466-28-l.wagner@proxmox.com \
--to=l.wagner@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.