Icinga Director and Grafana¶
Icinga Director: Service Set vs. Service Template¶
A Service Set activates one or more services on every host carrying its tag, with one default configuration each.
- Service Set when the check runs identically on every tagged host, or bundles several related checks (status + version + systemd unit). Examples:
chronyd,firewalld,Apache httpd,OS - RHEL 10 Basic Service Set. - Service Template only when the check needs per-instance parameters (URL, hostname, account, API token, page id, repository path); admins create those services manually or via Apply rules. Examples:
atlassian-statuspage,kemp-services,uptimerobot,virustotal-scan-url.
Ship the Service Template in build-basket either way, and add a Service Set to all-the-rest.json only for the generic or bundled shape.
Deliberate exception: a per-instance check whose subject is too important for an unconfigured host to stay silent may join a Set anyway. Its service reports UNKNOWN until the parameter is supplied; document that in the README so it is not read as a defect. Reference: wordpress-security-scan in the WordPress Service Set, where --url cannot be guessed.
Icinga Director: Cluster Zones¶
tpl-host-generic and tpl-service-generic in all-the-rest.json pin "zone": "master"; every other template sets no zone and inherits it. This security default keeps configuration and credentials on the master and its HA peers instead of on every agent.
- Keep the two base templates pinned to
master, every other zone unset. A distributed site unsets the base-template zone, accepting distribution to every agent (see ICINGA.md). - Never put a credential (password, SNMP community, API token) on a template or a Service Set: it applies to every importing or generated service and reaches every agent once the zone is unset. Keep secrets on the concrete host or service object.
Icinga Director Basket Config¶
Each plugin provides its Director config as a basket, usually at least one Command, one Service Template and some Datafields. Everything else (Host Templates, Service Sets, Notification Templates, Tag Lists, ...) goes into assets/icingaweb2-module-director/all-the-rest.json. Baskets are generated by build-basket.
Always review the basket before committing.
Create a Basket File from Scratch¶
./tools/build-basket --plugin-file check-plugins/new-check/new-check writes check-plugins/new-check/icingaweb2-module-director/new-check.json. Inspect especially the Command timeout and the ServiceTemplate check_interval, criticality, enable_perfdata, max_check_attempts and retry_interval.
Fine-tune a Basket File¶
Never directly edit a basket JSON file. Put adjustments into check-plugins/new-check/icingaweb2-module-director/new-check.yml and re-run build-basket, also after adding, changing or deleting a parameter:
---
variants:
- linux
- windows
overwrites:
'["Command"]["cmd-check-new-check"]["timeout"]': 30
'["ServiceTemplate"]["tpl-service-new-check"]["check_interval"]': 3600
'["ServiceTemplate"]["tpl-service-new-check"]["vars"]["criticality"]': 'C'
Any key of the generated JSON can be overwritten this way, e.g. command, check_command, enable_perfdata, max_check_attempts, retry_interval or use_agent.
Basket File for different OS¶
variants in the same .yml generate flavours of the command call:
linux(default if none is defined):cmd-check-...,tpl-service-...and the datafields.windows:cmd-check-...-windows,tpl-service-...-windowsand the datafields.sudo:cmd-check-...-sudoimportingcmd-check-...with/usr/bin/sudoprepended, andtpl-service...-sudousing it as check command.no-agent:tpl-service...-no-agentimportingtpl-service..., with the command endpoint set to the Icinga 2 master.
Create Basket Files for all Check Plugins¶
./tools/build-basket --auto, for example after a change to build-basket itself.
Service Sets¶
- Append new Service Sets to
assets/icingaweb2-module-director/all-the-rest.jsonwith new unique UUIDs, and check the syntax withcat assets/icingaweb2-module-director/all-the-rest.json | jq. - Moving a service to another Service Set needs a new UUID (impossible in the Director GUI).
- Every service in a set needs a unique
object_name, identical to the JSON key above it. The Director renders a set's services by name, so of two equal names only one runs, andicingacli director basket restoreaborts with a duplicate UUID on every later run. - Double every
$in a variable value (^linuxfabrik-monitoring-plugins$$), otherwise config validation fails with "Closing $ not found in macro format string" and rejects the whole deployment. The plugin receives a single$. - For a single-host exception, override the variable on that host's service instead of editing the set (
import DirectorOverrideTemplatemergeshost.vars._override_servicevars["<service name>"]over the set's values). Editing the set changes every tagged host.
Grafana Dashboards¶
Dashboards live in check-plugins/<plugin>/grafana/<plugin>.yml. The title is capitalized, file name and uid match the plugin directory. Spaces in a panel-name component become -, / is dropped (Network I/O → network-io). Define only properties that differ from Grafana defaults. Queries group with fill(null), panels set spanNulls to three times the basket's check_interval in milliseconds and the legend uses firstNotNull / lastNotNull, so periods without data stay empty instead of being bridged. Sibling dashboards (memory-usage, cpu-usage) line up time ranges, thresholds and labels for side-by-side comparison. Provisioning and the Grizzly → grafanactl migration are in GRAFANA.md.