Skip to main content

Maintenance

Plan a maintenance window: for a period, suppress OpenNMS polling, thresholds, collection or notifications on chosen devices. Each document is one window, mapped to one OpenNMS scheduled outage. Targets /rest/sched-outages. See the compatibility table for supported servers.

YAML​

FieldTypeDefaultDescription
apiVersionstringrequiredmaintenance.opennms.org/v1
kindstringrequiredMaintenance
metadata.namestringrequiredOutage name. Must not be empty. Must be unique within one apply.
spec.schedule.typestringrequiredspecific, daily, weekly or monthly.
spec.schedule.timeslist of time windowsrequiredAt least one window.
spec.devices.interfaceslist of strings[]IP addresses (IPv4 or IPv6), or the single literal match-any for every interface.
spec.devices.nodeslist of node references[]Nodes by foreign reference, resolved to a nodeId at apply.
spec.devices.categorieslist of strings[]Every node in any listed category.
spec.devices.locationslist of strings[]Every node at any listed monitoring (Minion) location.
spec.devices.assetasset selectornoneNodes whose asset-record field equals a value.
spec.suppress.pollingdaemon suppressionnoneSuppress pollerd for the listed packages.
spec.suppress.thresholdsdaemon suppressionnoneSuppress threshd for the listed packages.
spec.suppress.collectiondaemon suppressionnoneSuppress collectd for the listed packages.
spec.suppress.notificationsbooleanfalseSuppress notifd. Global, no package.

spec.devices must declare at least one selector. The selectors are a union: every matched node is covered once. match-any cannot be combined with any other interface or selector. To cover every interface, use interfaces: [match-any] alone. Values in categories, locations, asset.field and asset.value must not be empty and must not contain , ; = ( ) or *.

Each daemon under spec.suppress is opt-in. Enable at least one. polling, thresholds and collection each require a non-empty packages list, because there is no default package.

Fields of a time window (spec.schedule.times[]):

FieldTypeDefaultDescription
beginsstringrequiredWindow start. Must be before ends.
endsstringrequiredWindow end.
daystringnoneRequired for weekly (a weekday, sunday to saturday, any case) and monthly (a day of month, "1" to "31"). Forbidden for specific and daily.

The time format depends on spec.schedule.type:

Typebegins and ends formatExample
specificdd-MMM-yyyy HH:mm:ss20-Jun-2026 22:00:00
daily, weekly, monthlyHH:mm:ss22:00:00

Each field is two digits, except the four-digit year. The month abbreviation is case-insensitive. Because begins must be before ends, a daily, weekly or monthly window cannot cross midnight. Times are in the server's timezone.

Fields of a node reference (spec.devices.nodes[]):

FieldTypeDefaultDescription
foreignSourcestringrequiredRequisition the node belongs to. Must not be empty.
foreignIdstringrequiredNode's foreign ID in that requisition. Must not be empty.

Fields of the asset selector (spec.devices.asset):

FieldTypeDefaultDescription
fieldstringrequiredAsset-record field, such as city.
valuestringrequiredExact value to match.

Node meta-data is not searchable through the node API, so it is not a selector.

Fields of a daemon suppression (spec.suppress.polling, .thresholds, .collection):

FieldTypeDefaultDescription
packageslist of stringsrequiredDaemon packages the window applies to. At least one entry.

Apply​

onmsctl apply -f examples/maintenance.yaml --dry-run --diff
onmsctl apply -f examples/maintenance.yaml

Apply reconciles each window in two steps:

  1. Write the outage definition. Apply creates an absent window, updates a changed one, and leaves a matching one untouched. The comparison ignores list order, IP spelling and case.
  2. Attach the window to each daemon in spec.suppress: pollerd, threshd and collectd once per package, notifd once.

If the definition write fails, apply skips the attachments for that window.

Attachments are ensure-present. The API cannot read which daemons an outage is attached to. Apply therefore re-issues every attachment on every apply, and never detaches. Removing a suppress entry does not detach it. To reduce suppression, run onmsctl maintenance delete <name>, then re-apply.

Apply never deletes. Windows no document declares are left alone.

Node selectors are resolved on every apply:

  • An explicit nodes entry that does not resolve fails that window. The other windows still apply.
  • categories, locations and asset are resolved through one node search. The result is a snapshot. Re-apply to follow membership changes.
  • A search that matches nothing prints a warning.
  • A window that covers no devices after resolution fails.

A specific window that already ended prints a warning, and is still created. The check compares against UTC, so it is approximate near the boundary.

--diff prints a fixed note on attachment behaviour, not a field-level diff. The plan row lists the attachments apply will ensure, such as ensure pollerd/production, notifd.

Plan gates: every document is parsed and validated, and names are checked for duplicates, before any HTTP request. A node search that returns fewer nodes than it matched aborts the apply rather than cover a subset.

Order: Maintenance applies after ThreshdPackage and Requisition, so one apply can create the packages it attaches to and import the nodes it names. Requisition import is asynchronous, so a node imported by the same apply can still fail to resolve. Re-run the apply in that case.

Inspect and delete​

onmsctl maintenance list
onmsctl maintenance status 192.168.8.8 12
onmsctl maintenance delete weekend-patching

Expected output:

$ onmsctl maintenance list
+------+------+-------+------------+-------+
| NAME | TYPE | TIMES | INTERFACES | NODES |
+==========================================+
+------+------+-------+------------+-------+
$ onmsctl maintenance status 192.168.8.8 12
+-------------+-----------+
| DEVICE | IN OUTAGE |
+=========================+
| 192.168.8.8 | false |
|-------------+-----------|
| 12 | false |
+-------------+-----------+
  • maint is an alias for maintenance.
  • list shows each window's name, type, and number of times, interfaces and nodes.
  • status takes IP addresses and numeric nodeIds, and reports whether each is in a window now.
  • delete removes the window from every daemon and deletes its definition.

Errors​

MessageProbable causeRecovery
spec.schedule.times must declare at least one windowtimes is empty.Add a window.
is not in the expected formatbegins or ends does not match the format for spec.schedule.type.Use dd-MMM-yyyy HH:mm:ss for specific, HH:mm:ss otherwise.
must be before endsbegins is equal to or later than ends.Swap the times, or split a window that crosses midnight in two.
weekly windows require a `day` (a weekday)A weekly window has no day.Add day: monday (or another weekday).
monthly windows require a `day` (1–31)A monthly window has no day.Add day: "15" (or another day of month).
is not a weekday (sunday…saturday)A misspelled weekday.Spell the weekday in full.
must be a day-of-month in 1–31A monthly day outside 1 to 31.Fix the day.
`day` is only valid for weekly/monthly windowsA specific or daily window sets day.Remove day.
spec.devices must declare at least one selectorspec.devices is empty.Add interfaces, nodes, categories, locations or asset.
spec.devices: `match-any` selects every interface and cannot be combined withmatch-any appears next to another interface or selector.Keep match-any alone, or list explicit selectors instead.
spec.devices.interfaces: invalid IPAn interface is not an IP address.Fix the address.
foreignSource and foreignId must both be non-emptyA node reference is incomplete.Set both fields.
spec.devices.asset.field and asset.value must both be non-emptyThe asset selector is incomplete.Set both fields.
contains the disallowed characterA selector value contains , ; = ( ) or *.Remove the character. Selectors match exact values.
spec.suppress must enable at least one of polling / thresholds / collection / notificationsspec.suppress is empty.Enable at least one daemon.
requires a non-empty `packages` listpolling, thresholds or collection has no packages.List the daemon packages.
kind: Maintenance names must be unique within an applyTwo documents share a metadata.name.Rename one.
not found / not yet importedA nodes entry names a node the server does not have yet.Import the node, or fix the reference, then re-apply.
window covers no devices after resolutionNo interfaces, and the node selectors matched nothing.Fix the selectors.
were returned (truncated)The node search matched more nodes than it returned.Narrow the selectors.
attachments not attemptedThe definition write failed.Check connectivity, then re-apply.
FAILED to attachA daemon rejected an attachment, often an unknown package.Check the package names exist, then re-apply.
is neither an IP address nor a numeric nodeIdmaintenance status got another kind of argument.Pass IP addresses or nodeIds.

Example​

examples/maintenance.yaml
# yaml-language-server: $schema=https://raw.githubusercontent.com/no42-org/onmsctl/main/schemas/maintenance.schema.json
#
# kind: Maintenance. It declares a maintenance window (OpenNMS scheduled
# outage). For the
# window, OpenNMS stops the chosen daemons (polling / thresholds / collection /
# notifications) for the chosen devices. NAMED + multi-instance: one document per
# window, metadata.name = the outage name. `onmsctl apply -f` reconciles it
# against /rest/sched-outages:
#
# onmsctl apply -f examples/maintenance.yaml --dry-run --diff
# onmsctl maintenance list
# onmsctl maintenance status 192.168.8.8
# onmsctl maintenance delete weekend-patching
#
# Notes:
# - Times are interpreted in the OpenNMS SERVER's timezone.
# - `suppress` requires EXPLICIT packages for polling/thresholds/collection
# (there is no default package); `notifications` is a global boolean.
# - Attachments are ensure-present: apply never detaches. To reduce suppression,
# `onmsctl maintenance delete <name>` then re-apply.
#
apiVersion: maintenance.opennms.org/v1
kind: Maintenance
metadata:
name: weekend-patching
spec:
schedule:
type: specific # specific | daily | weekly | monthly
times:
# specific → full datetimes "dd-MMM-yyyy HH:mm:ss"
- begins: "20-Jun-2026 22:00:00"
ends: "21-Jun-2026 04:00:00"
# daily → { begins: "HH:mm:ss", ends: "HH:mm:ss" }
# weekly → { day: monday, begins: "HH:mm:ss", ends: "HH:mm:ss" }
# monthly → { day: "15", begins: "HH:mm:ss", ends: "HH:mm:ss" }
devices:
# All selectors below are ADDITIVE (union), deduped to nodeIds at apply.
# An IP, or the single literal `match-any` (= every interface).
interfaces: [192.168.8.8]
# Nodes by foreign reference (resolved to the server nodeId at apply).
nodes:
- { foreignSource: labmonkeys-hq, foreignId: web01 }
# Every node in ANY of these OpenNMS categories (resolved at apply via the
# v2 nodes search). The result is a snapshot. Re-apply to refresh as
# membership changes.
categories: [Routers, Core]
# Every node at ANY of these monitoring (Minion) locations. Selects whole
# nodes by id. The outage model has no location field, so an interface IP
# cannot be scoped to a location.
locations: [Berlin]
# Nodes whose OpenNMS asset-record field matches (the searchable key/value).
# NOTE: node meta-data (context:key=value) is NOT searchable by the node API,
# so `asset` is the supported key/value selector.
asset: { field: city, value: Berlin }
suppress:
polling: { packages: [production] } # → pollerd package(s)
thresholds: { packages: [production] } # → threshd package(s)
# collection: { packages: [production] } # → collectd package(s)
notifications: true # global (no package)