You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Browse filesBrowse the repository at this point in the historyBrowse files
Thomas Rzen
committed
Numeric ZFS pool health, fragmentation trigger, APT triggers
zfs.health was a text item, so it could not be graphed or shown on a dashboard
and the trigger had to compare strings. It is now UNSIGNED with a value map:
0 ONLINE, 1 DEGRADED, 2 FAULTED, 3 OFFLINE, 4 REMOVED, 5 UNAVAIL, 6 SUSPENDED.
The mapping uses a chain of STR_REPLACE preprocessing steps, not a script. The
seven state names share no substring, so step order does not matter. A state
outside the list leaves text in place and the item turns visibly unsupported
instead of reporting a wrong number.
Three triggers were missing:
- ZFS pool fragmentation above {$ZFS.FRAG.WARN}. The macro was documented with
a default of 60 but no trigger used it, so it did nothing.
- APT repository configuration has warnings, Info severity. This is the common
case of the enterprise repository being enabled without a subscription. A
host on the no-subscription repository reports one warning permanently, hence
{$PVE.APT.REPO.WARN.MAX} to raise the tolerance there.
- Package updates pending, Info severity and disabled by default, matching the
item it depends on.
The replication failure trigger now carries the error message PVE reported in
its event name, so the reason is visible without opening the item.
Verified: no threshold macro is left without a trigger using it.
|`{$PVE.REPL.FAIL.MAX}`|`0`| Tolerated consecutive failures of a replication job. Context form `{$PVE.REPL.FAIL.MAX:"105-0"}`. |
109
109
|`{$PVE.NOTBACKEDUP.MAX}`|`0`| Tolerated number of guests without a backup job. Raise it if some guests are deliberately excluded. |
110
110
|`{$PVE.APT.REPO.ERRORS.MAX}`|`0`| Tolerated number of unparsable APT repository files. |
111
+
|`{$PVE.APT.REPO.WARN.MAX}`|`0`| Tolerated number of APT repository warnings. A host on the no-subscription repository permanently reports one warning, set this to 1 there. |
112
+
|`{$PVE.APT.UPDATES.MAX}`|`0`| Tolerated number of pending package updates. Only relevant if the disabled apt/update items are switched on. |
111
113
112
114
### Timing Macros
113
115
@@ -183,6 +185,8 @@ Set to `0` to suppress a trigger globally. Supports context macros for per-insta
183
185
| VMs/LXC not all running | Info | Cluster-wide: running count < total count |
184
186
| Guests not covered by any backup job | Warning | From `/cluster/backup-info/not-backed-up`. Catches the guest that was created after the backup job was defined. |
185
187
| APT repository files are broken | Warning | At least one repository file cannot be parsed, updates will fail |
188
+
| APT repository configuration has warnings | Info | For example the enterprise repository enabled without a subscription |
189
+
| Package updates pending | Info | Disabled by default, like the item it depends on |
186
190
| PVE subscription is not active | Warning | Disabled by default, see `{$PVE.SUBSCRIPTION.ALERT}`|
187
191
188
192
### VM / LXC Prototypes
@@ -221,6 +225,7 @@ Set to `0` to suppress a trigger globally. Supports context macros for per-insta
221
225
| SSD wearout below threshold | Warning |
222
226
| PVE service not running | Average |
223
227
| ZFS pool not ONLINE | High |
228
+
| ZFS pool fragmentation above `{$ZFS.FRAG.WARN}`| Warning |
224
229
| ZFS pool usage over warning / critical threshold | Average / High |
225
230
| Replication job failing | Average |
226
231
| Replication job has not synced within `{$PVE.REPL.LAG}`| Warning |
@@ -262,6 +267,7 @@ The template includes a pre-built dashboard **"Proxmox VE - Monitoring Dashboard
262
267
-**Replication:** The list endpoint already carries the job state, so no extra request per job is needed. Fields such as `last_sync` and `error` are absent before the first run or while the job is healthy; those items discard the value instead of turning unsupported.
263
268
-**Subscription:**`/nodes/{node}/subscription` needs no special permission and answers with HTTP 200 even without a subscription, reporting status `notfound`.
264
269
-**Permission errors:** The API answers with HTTP 403, so an item lacking permissions turns visibly unsupported rather than silently staying empty.
270
+
-**ZFS pool health:** Stored as a number with a value map rather than as text, so it can be graphed and shown on a dashboard. 0 is ONLINE, everything above is a fault. The mapping is done with preprocessing steps, not with a script. A state outside the seven known zpool states leaves text in place and the item turns visibly unsupported instead of reporting a wrong number.
265
271
-**Long term data:** Numeric performance and capacity items keep 365 days of trends. Timestamp items such as `last_sync` or `notafter` deliberately keep trends disabled, a trend over a Unix timestamp carries no meaning.
Copy file name to clipboardExpand all lines: Virtualization/template_proxmox-ve-rest-api-zabbix/7.0/template_proxmox-ve-rest-api.yaml
+81-6Lines changed: 81 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -4030,13 +4030,43 @@ zabbix_export:
4030
4030
type: DEPENDENT
4031
4031
key: 'zfs.health[{#ZPOOL}]'
4032
4032
delay: '0'
4033
-
value_type: CHAR
4034
-
trends: '0'
4035
-
description: 'zpool health: ONLINE, DEGRADED, FAULTED, OFFLINE, REMOVED or UNAVAIL.'
4033
+
value_type: UNSIGNED
4034
+
trends: 365d
4035
+
description: 'zpool health as a number so it can be graphed and used on a dashboard. 0 is ONLINE, everything above is a fault. The value map turns it back into the zpool wording.'
4036
+
valuemap:
4037
+
name: 'ZFS pool health'
4036
4038
preprocessing:
4037
4039
- type: JSONPATH
4038
4040
parameters:
4039
4041
- '$.data[?(@.name=="{#ZPOOL}")].health.first()'
4042
+
- type: STR_REPLACE
4043
+
parameters:
4044
+
- ONLINE
4045
+
- '0'
4046
+
- type: STR_REPLACE
4047
+
parameters:
4048
+
- DEGRADED
4049
+
- '1'
4050
+
- type: STR_REPLACE
4051
+
parameters:
4052
+
- FAULTED
4053
+
- '2'
4054
+
- type: STR_REPLACE
4055
+
parameters:
4056
+
- OFFLINE
4057
+
- '3'
4058
+
- type: STR_REPLACE
4059
+
parameters:
4060
+
- REMOVED
4061
+
- '4'
4062
+
- type: STR_REPLACE
4063
+
parameters:
4064
+
- UNAVAIL
4065
+
- '5'
4066
+
- type: STR_REPLACE
4067
+
parameters:
4068
+
- SUSPENDED
4069
+
- '6'
4040
4070
master_item:
4041
4071
key: pve.zfs.raw
4042
4072
tags:
@@ -4046,10 +4076,11 @@ zabbix_export:
4046
4076
value: '{#ZPOOL}'
4047
4077
trigger_prototypes:
4048
4078
- uuid: d65a4e365c134cea9cf48cfca9c173dc
4049
-
expression: 'last(/Template Proxmox VE REST API/zfs.health[{#ZPOOL}])<>"ONLINE"'
4079
+
expression: 'last(/Template Proxmox VE REST API/zfs.health[{#ZPOOL}])<>0'
4050
4080
name: 'ZFS pool {#ZPOOL} is not ONLINE on {HOST.NAME}'
4081
+
event_name: 'ZFS pool {#ZPOOL} is {ITEM.VALUE1} on {HOST.NAME}'
4051
4082
priority: HIGH
4052
-
description: 'zpool health is DEGRADED, FAULTED, OFFLINE, REMOVED or UNAVAIL. Check /nodes/{node}/disks/zfs/{pool} for the failing vdev.'
4083
+
description: 'zpool health left ONLINE. Check /nodes/{node}/disks/zfs/{pool} for the failing vdev, the detail endpoint reports read, write and checksum errors per device.'
4053
4084
- uuid: 60c15d2ea06e465897ef285127da047c
4054
4085
name: 'ZFS pool size {#ZPOOL}'
4055
4086
type: DEPENDENT
@@ -4130,6 +4161,12 @@ zabbix_export:
4130
4161
value: ZFS
4131
4162
- tag: PVE
4132
4163
value: '{#ZPOOL}'
4164
+
trigger_prototypes:
4165
+
- uuid: ed2b6ba1d4cb4b029e7b75c0ff414ea0
4166
+
expression: 'last(/Template Proxmox VE REST API/zfs.frag[{#ZPOOL}])>{$ZFS.FRAG.WARN:"{#ZPOOL}"}'
4167
+
name: 'ZFS pool {#ZPOOL} fragmentation above {$ZFS.FRAG.WARN}% on {HOST.NAME}'
4168
+
priority: WARNING
4169
+
description: 'Free space in the pool is heavily fragmented, which slows down writes. Usually a consequence of a pool kept too full for too long. Freeing space helps, defragmenting a zpool is not possible.'
4133
4170
- uuid: 2167f0fa32e24ac9803b5aa3cd346bbe
4134
4171
name: 'ZFS pool dedup ratio {#ZPOOL}'
4135
4172
type: DEPENDENT
@@ -4217,8 +4254,9 @@ zabbix_export:
4217
4254
- uuid: 9d0695a301e54a4dbb9590dd62e79a37
4218
4255
expression: 'last(/Template Proxmox VE REST API/repl.fail_count[{#REPL_ID}])>{$PVE.REPL.FAIL.MAX}'
4219
4256
name: 'Replication job {#REPL_ID} failing on {HOST.NAME}'
description: 'PVE counts consecutive failures of this replication job. The reason is in the corresponding error item.'
4259
+
description: 'PVE counts consecutive failures of this replication job. The event name carries the error message PVE reported for the last run.'
4222
4260
- uuid: 40786cb4039d42c8bc5703ca03635c1e
4223
4261
name: 'Replication last sync {#REPL_ID}'
4224
4262
type: DEPENDENT
@@ -4503,6 +4541,12 @@ zabbix_export:
4503
4541
- macro: '{$PVE.APT.REPO.ERRORS.MAX}'
4504
4542
value: '0'
4505
4543
description: 'Tolerated number of unparsable APT repository files before alerting.'
4544
+
- macro: '{$PVE.APT.REPO.WARN.MAX}'
4545
+
value: '0'
4546
+
description: 'Tolerated number of APT repository warnings. A host on the no-subscription repository permanently reports one warning, set this to 1 there.'
4547
+
- macro: '{$PVE.APT.UPDATES.MAX}'
4548
+
value: '0'
4549
+
description: 'Tolerated number of pending package updates. Only relevant if the disabled apt/update items are switched on.'
4506
4550
- macro: '{$PVE.CERT.EXPIRE.DAYS}'
4507
4551
value: 21d
4508
4552
description: 'Lead time before certificate expiry. Must include a time unit, for example 21d.'
@@ -5347,6 +5391,23 @@ zabbix_export:
5347
5391
newvalue: paused
5348
5392
- value: '3'
5349
5393
newvalue: unknown
5394
+
- uuid: 4edeb346d0d64155ad2e8063d7a4cab8
5395
+
name: 'ZFS pool health'
5396
+
mappings:
5397
+
- value: '0'
5398
+
newvalue: ONLINE
5399
+
- value: '1'
5400
+
newvalue: DEGRADED
5401
+
- value: '2'
5402
+
newvalue: FAULTED
5403
+
- value: '3'
5404
+
newvalue: OFFLINE
5405
+
- value: '4'
5406
+
newvalue: REMOVED
5407
+
- value: '5'
5408
+
newvalue: UNAVAIL
5409
+
- value: '6'
5410
+
newvalue: SUSPENDED
5350
5411
triggers:
5351
5412
- uuid: bdaeac3c76ec44ef96bf78ca83ba0dad
5352
5413
expression: 'min(/Template Proxmox VE REST API/pve.loadaverage.oneminute,900) >= last(/Template Proxmox VE REST API/pve.cpus)'
@@ -5399,6 +5460,20 @@ zabbix_export:
5399
5460
opdata: 'Broken files: {ITEM.LASTVALUE1}'
5400
5461
priority: WARNING
5401
5462
description: 'At least one APT repository file cannot be parsed. Updates will fail until this is fixed.'
5463
+
- uuid: 5fe993f6929a4e05ab7bca6e61c8b631
5464
+
expression: 'last(/Template Proxmox VE REST API/pve.apt.repos.warnings)>{$PVE.APT.REPO.WARN.MAX}'
5465
+
name: 'APT repository configuration has warnings on {HOST.NAME}'
5466
+
opdata: 'Warnings: {ITEM.LASTVALUE1}'
5467
+
priority: INFO
5468
+
description: 'PVE reports a problem with the repository configuration, for example the enterprise repository being enabled without a subscription. A host on the no-subscription repository reports one warning permanently, raise {$PVE.APT.REPO.WARN.MAX} to 1 there.'
5469
+
manual_close: 'YES'
5470
+
- uuid: 516ffe6de3804b97aa29d41e333deba3
5471
+
expression: 'last(/Template Proxmox VE REST API/pve.apt.updates.count)>{$PVE.APT.UPDATES.MAX}'
5472
+
name: '{ITEM.LASTVALUE} package update(s) pending on {HOST.NAME}'
5473
+
priority: INFO
5474
+
status: DISABLED
5475
+
description: 'Disabled by default, like the item it depends on. The master item needs Sys.Modify, which PVEAuditor does not grant.'
5476
+
manual_close: 'YES'
5402
5477
- uuid: 57b2f7fad21f4672874712a66208931a
5403
5478
expression: 'last(/Template Proxmox VE REST API/pve.subscription.status)<>"active" and {$PVE.SUBSCRIPTION.ALERT}=1'
5404
5479
name: 'PVE subscription is not active on {HOST.NAME} ({ITEM.LASTVALUE})'
0 commit comments