Skip to main content

ThreshdPackage

Declare one threshd package per document: the interfaces it selects and the services it thresholds. Targets /api/v2/threshd. Requires Horizon 37.0.0 (NMS-19837). Older servers fail with a version error.

YAML​

FieldTypeDefaultDescription
apiVersionstringrequiredthresholding.opennms.org/v1
kindstringrequiredThreshdPackage
metadata.namestringrequiredPackage name.
spec.filterstringrequiredFilter rule selecting interfaces, e.g. IPADDR != '0.0.0.0'.
spec.includeRangeslist[]{begin, end} inclusive IP ranges. Both ends in one address family.
spec.excludeRangeslist[]{begin, end} ranges excluded.
spec.specificslist[]Individual IP addresses always included.
spec.includeUrlslist[]URLs of files listing further addresses.
spec.serviceslist[]Services thresholded in this package.

Fields of a service:

FieldTypeDefaultDescription
namestringrequiredService name, unique in the package.
intervalduration or integerrequiredTime between evaluations: 30s, 5m, 1h, 1d, or milliseconds.
statusstringnoneon or off. Quote it ("on") for YAML 1.1 tools.
thresholdingGroupstringnoneThe ThresholdGroup to apply.
parameterslist[]Other {key, value} service parameters.

Not part of the document:

  • outageCalendars are managed by Maintenance. Apply keeps the server's value on every write.
  • userDefined is a server flag. Apply keeps it too.

Apply​

onmsctl apply -f ./thresholds/ --dry-run --diff
onmsctl apply -f ./thresholds/

Apply creates, replaces or leaves each package alone, exactly like ThresholdGroup. Updates carry the plan's ETag, unchanged packages get no request, and apply never deletes.

Plan gate: every thresholdingGroup must name a group on the server or a ThresholdGroup in the same apply. A typo aborts the whole apply before any write.

Order: ThreshdPackage applies after ThresholdGroup, so one apply can create a group and bind it, and before Maintenance, which attaches outages to packages.

Diff​

Services are matched by name. Ranges, specifics and include URLs are compared as sets.

ThreshdPackage/acme: update
~ services[SNMP]: interval 5m -> 10m
+ includeRanges: 10.1.0.1-10.1.255.254

Inspect and delete​

onmsctl threshold package list
onmsctl threshold package get mib2
onmsctl threshold package delete acme

The server refuses to delete its last package.

Errors​

MessageProbable causeRecovery
'<x>' names no threshold group on the server or as a ThresholdGroup in this applyA typo, or the group was deleted.Fix thresholdingGroup or add the ThresholdGroup document.
set the group with thresholdingGroupA thresholding-group key under parameters.Move it to thresholdingGroup.
duplicate serviceTwo services with one name in the package.Merge or rename them.
changed on the server since planThe package was edited between plan and write, for example by attaching an outage.Re-run the apply.

Example​

examples/threshd-package.yaml
# ThreshdPackage: which interfaces and services are thresholded, and with
# which group.
#
# thresholdingGroup names a ThresholdGroup on the server or in the same
# apply. Outage calendars are managed by kind: Maintenance and are kept as
# they are on every apply. Requires Horizon 37.0.0 (NMS-19837).
#
# onmsctl apply -f examples/ --dry-run --diff
#
apiVersion: thresholding.opennms.org/v1
kind: ThreshdPackage
metadata:
name: acme
spec:
filter: "IPADDR != '0.0.0.0' & catincAcme"
includeRanges:
- begin: 10.0.0.1
end: 10.0.255.254
services:
- name: SNMP
interval: 5m
status: "on"
thresholdingGroup: acme-cpu