Repository navigation
Expand file tree
/
Copy pathconfig.example.yaml
More file actions
461 lines (441 loc) · 20.6 KB
/
Copy pathconfig.example.yaml
File metadata and controls
461 lines (441 loc) · 20.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
# monitoring.server: process configuration (reference, every key shown)
#
# Read by `monitor serve`, `monitor migrate` and `monitor admin`.
# Remote probes use a smaller file: see probe.example.yaml.
#
# Scope (ADR-0011): only process-level settings live here: node identity, roles,
# listeners, database, key provider, resource limits and platform-wide policies.
# Tenant-facing data (tenants, devices, checks, credentials, webhooks, routes,
# retention policies, tenant limits) lives in the database and is managed
# through the API, never in this file.
#
# Conventions
# - Values shown are the defaults. "required" marks keys without a default.
# - Environment override: MONITOR_ + key path in upper case, "__" between levels.
# database.app.dsn -> MONITOR_DATABASE__APP__DSN
# api.listen -> MONITOR_API__LISTEN
# Lists are comma-separated in environment variables.
# - Secrets: any key ending in `_file` reads the value from that file
# (container and systemd secrets). The inline key without `_file` also works,
# for development only. Setting both is a startup error.
# - Durations use Go syntax (500ms, 30s, 5m, 24h). Sizes use IEC units (KiB, MiB).
# - Unknown keys are a startup error, so typos fail loudly.
# - Changes need a restart, except logging.level (reloaded on SIGHUP).
node:
# Unique name of this process among running nodes. Recorded as owner of
# scheduler shard leases, MQTT sessions and the maintenance lock.
# Default: the hostname.
id: ""
# Roles this process runs (ADR-0001). `--roles` on the command line wins.
# In the MVP, runner requires engine in the same process.
roles: [api, runner, engine, notifier, ingest, maintenance]
# Time to finish in-flight checks, deliveries and flushes on SIGTERM.
shutdown_grace: 30s
logging:
level: info # debug | info | warn | error
format: json # json | text (text for local development)
# ---------------------------------------------------------------------------
# Database (ADR-0002, ADR-0008)
# ---------------------------------------------------------------------------
database:
# Three PostgreSQL roles, because RLS only works when the application is not
# the table owner and not BYPASSRLS.
owner:
# Owns the schema. Used only to run migrations (at startup and by
# `monitor migrate`), then closed.
dsn_file: /run/secrets/monitor_db_owner_dsn # required
app:
# Subject to RLS. Used by the api role for tenant requests.
# INSERT and SELECT only on audit_events.
dsn_file: /run/secrets/monitor_db_app_dsn # required with role api
max_conns: 20
system:
# BYPASSRLS. Used by runner, engine, notifier, ingest and maintenance.
# The api role never uses it: key lookup and just-in-time provisioning go
# through SECURITY DEFINER functions (ADR-0008).
dsn_file: /run/secrets/monitor_db_system_dsn # required except for api-only nodes
max_conns: 40
# One session connection per node for LISTEN/NOTIFY. It must not go through
# a transaction-mode PgBouncer. Default: the system DSN.
listen_dsn_file: ""
migrate_on_start: true # under an advisory lock; false = run `monitor migrate up` yourself
connect_timeout: 5s
statement_timeout: 30s
# ---------------------------------------------------------------------------
# Metrics store (ADR-0003, F07)
# ---------------------------------------------------------------------------
metrics:
backend: auto # auto | postgres | timescale (not implemented yet; auto uses postgres)
# Metrics share the config database in the MVP (ADR-0008). A separate
# metrics database is a later option.
write:
batch_rows: 5000
flush_interval: 1s
# Data held in memory while flushes fail. Beyond this the oldest rows are
# dropped and counted in metrics_dropped_total.
max_buffered: 60s
partitions_ahead: 72h
rollups:
five_minute_every: 1m
hourly_every: 10m
retention_every: 1h
# How long the Whoopsy! band of every result is kept for graphs.
whoopsy_band_retention: 168h
query:
max_points_per_series: 10000
# ---------------------------------------------------------------------------
# Encryption (ADR-0006)
# ---------------------------------------------------------------------------
crypto:
key_provider: file # file (MVP); vault and cloud KMS later
file:
# Key-encryption keys: 32 random bytes, base64. Every listed key can
# decrypt; `active` encrypts new secrets.
# Rotation: add a key, make it active, restart, run
# `monitor admin rewrap-credentials`, then remove the old key.
# Losing every KEK makes all stored credentials unrecoverable: back them up.
active: kek-2026-09 # required
keys:
- id: kek-2026-09
path: /run/secrets/monitor_kek_2026_09
# - id: kek-2026-03
# env: MONITOR_KEK_2026_03
# vault:
# address: https://vault.example.com
# transit_mount: transit
# key_name: monitor
# token_file: /run/secrets/vault_token
# ---------------------------------------------------------------------------
# TLS policy, shared by every listener and outgoing connection
# ---------------------------------------------------------------------------
tls:
min_version: "1.2" # 1.3 is always preferred when both sides support it
# TLS 1.2 cipher suites. Empty = built-in list (ECDHE with AES-GCM or
# ChaCha20-Poly1305 only). TLS 1.3 suites are fixed by Go.
cipher_suites: []
# Outgoing connections made on behalf of tenants (HTTP checks, webhooks).
outbound:
# Always refused for every tenant, including the platform tenant, checked
# after DNS resolution. Tenant allowed_target_networks apply on top.
deny_networks:
- 169.254.169.254/32 # cloud metadata
- fd00:ec2::254/128
# Proxy for webhook deliveries and heartbeats only. Checks always connect
# directly, since they measure the path to the target.
http_proxy: ""
user_agent: "monitor/{version}"
# ---------------------------------------------------------------------------
# api role (ADR-0007, F01)
# ---------------------------------------------------------------------------
api:
listen: ":8443"
# URL clients use to reach the API. Shown in probe install instructions.
public_url: "" # required with role api
# Omit tls only when a trusted proxy terminates TLS. A plain-text listener
# on a non-loopback address without trusted_proxies is a startup error.
tls:
cert_file: /etc/monitor/tls/api.crt
key_file: /etc/monitor/tls/api.key
# Proxies allowed to set X-Forwarded-For. The resulting client IP is used
# for audit source_ip, key IP allowlists and rate limits.
trusted_proxies: []
max_body: 4MiB # config/apply bodies are the largest
request_timeout: 90s # above the 60 s device test
idempotency_ttl: 24h
# Rate limit for platform keys. Tenant keys use the tenant's api_rate_per_minute.
platform_rate_per_minute: 6000
# API reference at /docs and the spec at /v1/openapi.json and
# /v1/openapi.yaml, without authentication (the spec is public).
docs: true
events:
replay_window: 10m # SSE Last-Event-ID replay
telemetry_tick_interval: 5s
# ---------------------------------------------------------------------------
# Probe service: core side of the probe protocol (ADR-0005, F09)
# Part of the engine role (ADR-0001), because probe results go straight to
# the engine.
# ---------------------------------------------------------------------------
probe_service:
enabled: true
listen: ":8444"
public_url: "" # URL probes connect to; required when enabled
tls: # server certificate; client certificates come from the probe CA
cert_file: /etc/monitor/tls/probe.crt
key_file: /etc/monitor/tls/probe.key
enrollment_token_ttl: 24h # one-time tokens from POST /v1/probes
# Preshared enrollment tokens, for automated deployments where calling the
# API per probe is not practical. A probe that presents one of these with a
# name (probe.name in probe.yaml) is created in the token's tenant and
# enrolled in one step.
# - Reusable until expires_at or max_probes is reached.
# - Never re-enrolls a probe that has already enrolled: a lost probe needs
# DELETE or rotate-token through the API, so a leaked token cannot take
# over an existing probe and its credentials.
# - Probes enrolled this way are never added to a failover group
# automatically; they run checks only after devices are assigned to them.
# - Every use is audited with the token name.
# Minimum 32 characters. Generate with `monitor admin gen-token`.
preshared_enrollment_tokens: []
# - name: ist-1-rollout
# token_file: /run/secrets/probe_enroll_ist1
# tenant: plusclouds:9b1c… # engine tenant ID, or <external_source>:<external_id>
# site: ist-1 # default site; the probe may send its own
# max_probes: 20
# expires_at: 2026-12-31T00:00:00Z
# allowed_networks: [203.0.113.0/24] # source addresses allowed to enroll
certificate_lifetime: 720h # renewed by the probe at 2/3 of lifetime
silence_after: 60s # missed heartbeats before a probe is silent
clock_offset_warning: 2s
max_results_per_push: 1000
# ---------------------------------------------------------------------------
# runner role (F04). Probes accept the same keys in probe.example.yaml.
# ---------------------------------------------------------------------------
runner:
shard_lease: 15s
shard_renew: 5s
resync_interval: 5m
# Concurrent executions per node, split into two pools so slow table walks
# and collectors never delay fast checks.
pools:
fast: 1500 # icmp, tcp, udp, http, tls, dns
slow: 500 # SNMP walks, Redfish, IPMI, XAPI, RTSP, collectors
per_target_concurrency: 4
timeouts:
fraction_of_interval: 0.8
check_max: 60s
collector_max: 5m
result_buffer: 10000 # bounded channel to the engine; full = backpressure
icmp:
mode: auto # auto | privileged (CAP_NET_RAW) | unprivileged (ping_group_range)
# Source addresses for outgoing checks on multi-homed hosts. Empty = OS choice.
# A check may set its own source address.
source_addresses:
ipv4: ""
ipv6: ""
dns_resolvers: [] # resolvers for check targets; empty = system resolver
# ---------------------------------------------------------------------------
# engine role (F05)
# The state rules themselves (late = 2x interval, stale = 3x interval,
# flapping at 30 %/20 %) are fixed by F05 and not configurable here.
# Per-check options (failure_count, recovery_count, ...) are set via the API.
# ---------------------------------------------------------------------------
engine:
state_writers: 16 # parallel state/incident transactions
# ---------------------------------------------------------------------------
# notifier role (ADR-0009, F06)
# ---------------------------------------------------------------------------
notifier:
workers: 32
claim_batch: 100
poll_interval: 1s
# An incident on a device with something upstream (a container, a
# dependency, its own host check) is notified this long after it opens,
# so an upstream failure found meanwhile suppresses it (F05).
dependency_grace: 30s
# Link to an incident in your panel, sent as data.links.incident. Empty:
# no link. Placeholders: {incident_id}, {account_id}, {tenant_id}.
incident_url_template: ""
# Finished deliveries (delivered, failed, cancelled) and routed events are
# deleted after this; the delivery log and bulk replay reach this far back.
delivery_retention: 720h # 30 days; 0 keeps them forever
# incident_url_template: https://panel.plusclouds.com/monitoring/incidents/{incident_id}
delivery_timeout: 10s # default when an endpoint sets no timeout
max_delivery_timeout: 30s # cap for endpoint timeouts
retry_schedule: [5s, 30s, 2m, 10m, 30m, 1h] # last value repeats
give_up_after: 24h
secret_rotation_overlap: 24h
response_capture: 1KiB
# ---------------------------------------------------------------------------
# ingest role (F08, ADR-0013, F12)
# ---------------------------------------------------------------------------
ingest:
http:
enabled: true
listen: ":9443"
public_url: ""
tls:
cert_file: /etc/monitor/tls/ingest.crt
key_file: /etc/monitor/tls/ingest.key
trusted_proxies: []
max_body: 64KiB
rate_limit: # per ingest token
per_second: 1
burst: 10
mqtt:
# Embedded broker. External-broker mode is configured per tenant through
# /v1/ingest/mqtt-brokers, not here.
enabled: true
listen: ":8883"
tls:
cert_file: /etc/monitor/tls/mqtt.crt
key_file: /etc/monitor/tls/mqtt.key
client_ca_file: "" # CA for device client certificates; empty = password auth only
# Plain-text listener for FixLean devices during migration (F12). Only
# tenants with a legacy credential can use it. Keep off unless migrating.
legacy:
enabled: false
listen: ":1883"
# Read the client IP from a PROXY protocol header, for layer 4 load
# balancers. Needed for per-IP connect limits behind a load balancer.
proxy_protocol: false
trusted_proxies: []
max_connections: 20000
max_packet_size: 64KiB
publish_rate: # per client
per_second: 10
burst: 50
connect_rate_per_ip:
per_second: 5
burst: 20
pipeline_buffer: 50000 # QoS 1 is acknowledged only after a message enters this buffer
credential_cache_ttl: 60s
# Argon2id for device passwords. A node restart reconnects every device at
# once, so hashing is capped by max_concurrent_auth.
password_hash:
memory: 19MiB
iterations: 2
parallelism: 1
max_concurrent_auth: 16
# Default cap on telemetry fields discovered per device (F12).
max_discovered_fields: 200
# PlusClouds VM agent telemetry from the platform's NATS (vm.agent checks).
# The engine subscribes to `subject` in a queue group, so several ingest
# nodes share the messages. Each message goes to the vm.agent check whose
# config names the VM's UUID; others are counted and dropped.
nats:
enabled: false
url: "" # nats://nats.example.com:4222, tls://...:4222 or wss://...:443
subject: vm.*.telemetry
queue: monitor-ingest
# One of: user and password_file, token_file, or creds_file (JWT + seed).
user: ""
password_file: ""
token_file: ""
creds_file: ""
ca_file: "" # CA of the server's certificate (e.g. a private NATS CA); empty = system roots
cert_file: "" # client certificate and key, when NATS verifies clients (mTLS)
key_file: ""
# Phase 2
# snmp_traps:
# enabled: false
# listen: ":162"
# syslog:
# enabled: false
# listen_udp: ":514"
# listen_tcp: ":6514"
# ---------------------------------------------------------------------------
# Tenant configuration files (ADR-0015)
# Used only by tenants whose config_source is `file`. Read by the node holding
# the maintenance lock; the result is stored in the database.
# ---------------------------------------------------------------------------
tenant_config:
directory: /etc/monitor/tenants # one <tenant>.yaml per file tenant
watch: true # apply on change; POST /v1/config/reload also works
# ---------------------------------------------------------------------------
# Platform-wide policies (F01, ADR-0012)
# ---------------------------------------------------------------------------
platform:
# external_source recorded on tenants and users created through the
# platform key. Standalone installs never use it.
identity_source: plusclouds
# Just-in-time provisioning for unknown accounts and users seen with the
# platform key. New tenants get these limits until leo4 sends real ones.
jit:
enabled: true
tenant_limits:
max_devices: 0
max_checks: 0
min_check_interval_seconds: 60
api_rate_per_minute: 600
# Starting values for tenants created without explicit limits
# (standalone bootstrap, provisioning calls that omit a field).
tenant_defaults:
max_devices: 1000
max_checks: 10000
max_webhooks: 20
max_alert_routes: 50
min_check_interval_seconds: 30
api_rate_per_minute: 1200
# Empty = everything except RFC 1918, loopback and link-local.
allowed_target_networks: []
metric_classes: [standard]
tenant_purge_grace: 720h # soft-deleted tenant data is purged after this
audit_retention: 8760h # applied by partition drop; source IPs are personal data
# Usage metering (F13). Kept apart from metric retention.
usage_retention: 9504h # 13 months
usage_close_delay: 5m # a UTC hour is closed this long after it ends
# ---------------------------------------------------------------------------
# Usage metering (F13)
# ---------------------------------------------------------------------------
# Billing weight per plugin type: a check counts weight x seconds. Prices are
# set by PlusClouds billing, never here. A change is recorded by the
# maintenance node at start and applies from the next full UTC hour; closed
# hours keep the weights they were computed with.
usage:
weights: # confirmed by PlusClouds billing, 2026-10-07
icmp: 1
http: 2
snmp.get: 1
snmp.system: 1
snmp.ups: 1
snmp.sensor: 1
snmp.pdu: 2
snmp.interfaces: 3
redfish.health: 2
xapi.pool: 0 # the pool itself is not billed...
xapi.pool:host: 3 # ...each of its hypervisor hosts is
elasticsearch.cluster: 0 # the cluster itself is not billed...
elasticsearch.cluster:node: 3 # ...each of its nodes is (TBD with billing)
camera.snapshot: 2
rtsp.stream: 2
mqtt.connection: 0 # an MQTT sensor bills once, through its push.mqtt check (confirmed 2026-10-07)
monitor.self: 0 # the engine's own health check (platform tenant)
box.agent: 2 # each monitored LLM box (TBD with billing)
vm.agent: 2 # each monitored PlusClouds VM (confirmed 2026-10-07)
host.agent: 2 # each monitoring agent: a container or host with its services (TBD with billing)
default_weight: 1 # plugins not listed (push.http, push.mqtt)
# A check with Whoopsy! (band alerting) on is billed as "<plugin>+whoopsy"
# at its plugin's weight times this (http: 2 x 5 = 10). A weights entry
# such as "http+whoopsy: 8" overrides it for one plugin.
whoopsy_multiplier: 5
# ---------------------------------------------------------------------------
# Monitoring the monitor (F11)
# ---------------------------------------------------------------------------
self_monitoring:
# Node status server, the core counterpart of the probe's status server.
# GET /healthz liveness, no authentication
# GET /readyz no authentication (load balancers)
# GET /status this node: roles, shards owned, pools, buffers, database
# pool, outbox depth, recent errors (JSON, HTML in a browser)
# GET /metrics Prometheus exposition
# /status and /metrics need `Authorization: Bearer <status token>`.
# No tenant data. Public listeners also answer /healthz and /readyz.
listen: "127.0.0.1:9090"
tls:
cert_file: ""
key_file: ""
disabled: true # plain HTTP is allowed only on a loopback listen address
# Minimum 32 characters. Empty on a loopback address = no authentication;
# required on any other address.
status_token_file: /run/secrets/monitor_status_token
allowed_networks: []
# Store self-metrics on the built-in "monitor" device in the platform
# tenant, so Grafana and the API show them without Prometheus. Its
# monitor.self check carries the built-in alerts (check lag, stuck
# notifications, dropped rows, rollups, partitions, failing webhooks,
# clock offset, authentication failures); they go to the platform
# tenant's alert routes, so give that tenant a webhook and a route.
store_as_metrics: true
clock_offset_warning: 2s # this node against the database clock
# Dead man's switch. Sent by the node holding the maintenance lock, only
# while the core loop is healthy: the database answers, the notifier loop
# turns, and the engine applied its own monitor.self result within 3
# minutes. POST of a monitoring.heartbeat event (Standard Webhooks
# headers, signed when secret_file is set; Bearer token_file when set).
heartbeat:
interval: 60s
targets: []
# - url: https://hc-ping.com/<uuid>
# - url: https://monitor-b.example.com/ingest/v1/<check_id>
# token_file: /run/secrets/heartbeat_token
# secret_file: /run/secrets/heartbeat_signing_secret # Standard Webhooks signature