Skip to content

Commit f746c01

Browse files
committed
Add swap monitoring, fix memory source, macro docs and polling intervals
1 parent 2dbf74e commit f746c01

2 files changed

Lines changed: 103 additions & 19 deletions

File tree

Virtualization/template_proxmox-ve-rest-api-zabbix/7.0/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ PVEAPIToken=zabbix@pam!Zabbix=<token-secret>
8989
| `{$CPU_USAGE_HIGH}` | `99` | CPU critical threshold (%) |
9090
| `{$LXC.CPU.WARN}` | `85` | LXC CPU warning threshold (%) |
9191
| `{$LXC.CPU.HIGH}` | `99` | LXC CPU critical threshold (%) |
92-
| `{$MEMORY.UTIL.MAX}` | `90` | Memory warning threshold (%) |
92+
| `{$MEMORY.UTIL.MAX}` | `90` | Host memory warning threshold (%) |
93+
| `{$SWAP.UTIL.MAX}` | `80` | Host swap warning threshold (%). The trigger stays silent on hosts without swap. |
9394
| `{$ROOTFS.UTIL.WARN}` | `90` | Root filesystem warning threshold (%) |
9495
| `{$ROOTFS.UTIL.CRIT}` | `95` | Root filesystem critical threshold (%) |
9596
| `{$STORAGE.UTIL.WARN}` | `80` | Storage pool warning threshold (%) |

Virtualization/template_proxmox-ve-rest-api-zabbix/7.0/template_proxmox-ve-rest-api.yaml

Lines changed: 101 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ zabbix_export:
2020
name: 'PVE backup raw'
2121
type: HTTP_AGENT
2222
key: pve.backup.raw
23+
delay: '300'
2324
history: '0'
2425
value_type: TEXT
2526
trends: '0'
@@ -645,11 +646,11 @@ zabbix_export:
645646
delay: '0'
646647
trends: '0'
647648
units: Bytes
648-
description: 'Free (available) RAM on the PVE host in bytes. Source: /nodes/{node}/status → data.memory.free.'
649+
description: 'RAM available for new workloads on the PVE host in bytes, cache and reclaimable memory included. Source: /nodes/{node}/status → data.memory.available. Together with the used value this adds up to the installed total, which data.memory.free does not.'
649650
preprocessing:
650651
- type: JSONPATH
651652
parameters:
652-
- $.data.memory.free
653+
- $.data.memory.available
653654
master_item:
654655
key: pve.status
655656
tags:
@@ -712,6 +713,7 @@ zabbix_export:
712713
name: 'PVE lxc raw'
713714
type: HTTP_AGENT
714715
key: pve.nodes.lxc.raw
716+
delay: '300'
715717
history: '0'
716718
value_type: TEXT
717719
trends: '0'
@@ -747,6 +749,7 @@ zabbix_export:
747749
name: 'PVE qemu raw'
748750
type: HTTP_AGENT
749751
key: pve.nodes.qemu.raw
752+
delay: '300'
750753
history: '0'
751754
value_type: TEXT
752755
trends: '0'
@@ -764,6 +767,7 @@ zabbix_export:
764767
name: 'PVE nodes raw'
765768
type: HTTP_AGENT
766769
key: pve.nodes.raw
770+
delay: '300'
767771
history: '0'
768772
value_type: TEXT
769773
trends: '0'
@@ -850,6 +854,7 @@ zabbix_export:
850854
name: 'PVE status raw'
851855
type: HTTP_AGENT
852856
key: pve.status
857+
delay: '60'
853858
history: '0'
854859
value_type: TEXT
855860
trends: '0'
@@ -875,6 +880,7 @@ zabbix_export:
875880
name: 'PVE storage raw'
876881
type: HTTP_AGENT
877882
key: pve.storage.raw
883+
delay: '60'
878884
history: '0'
879885
value_type: TEXT
880886
trends: '0'
@@ -927,10 +933,62 @@ zabbix_export:
927933
tags:
928934
- tag: PVE
929935
value: Boot
936+
- uuid: b3016c59c0024f8fa5306198d1d1b73b
937+
name: 'PVE swap free'
938+
type: DEPENDENT
939+
key: pve.swap.free
940+
delay: '0'
941+
trends: '0'
942+
units: Bytes
943+
description: 'Free swap space on the PVE host in bytes. Source: /nodes/{node}/status → data.swap.free. Reports 0 on hosts without swap.'
944+
preprocessing:
945+
- type: JSONPATH
946+
parameters:
947+
- $.data.swap.free
948+
master_item:
949+
key: pve.status
950+
tags:
951+
- tag: PVE
952+
value: Memory
953+
- uuid: f2ae0c9f82084184954595f19a9ed722
954+
name: 'PVE swap total'
955+
type: DEPENDENT
956+
key: pve.swap.total
957+
delay: '0'
958+
trends: '0'
959+
units: Bytes
960+
description: 'Configured swap space on the PVE host in bytes. Source: /nodes/{node}/status → data.swap.total. Reports 0 on hosts without swap.'
961+
preprocessing:
962+
- type: JSONPATH
963+
parameters:
964+
- $.data.swap.total
965+
master_item:
966+
key: pve.status
967+
tags:
968+
- tag: PVE
969+
value: Memory
970+
- uuid: 9d49a6ae2695427a84790e829970669d
971+
name: 'PVE swap used'
972+
type: DEPENDENT
973+
key: pve.swap.used
974+
delay: '0'
975+
trends: '0'
976+
units: Bytes
977+
description: 'Used swap space on the PVE host in bytes. Source: /nodes/{node}/status → data.swap.used. Swap filling up while memory is not tight usually means pages were evicted during an earlier peak and never came back.'
978+
preprocessing:
979+
- type: JSONPATH
980+
parameters:
981+
- $.data.swap.used
982+
master_item:
983+
key: pve.status
984+
tags:
985+
- tag: PVE
986+
value: Memory
930987
- uuid: 8cbc645bf73d4654afa40ff9245ac67c
931988
name: 'PVE tasks raw'
932989
type: HTTP_AGENT
933990
key: pve.tasks.raw
991+
delay: '60'
934992
history: '0'
935993
value_type: TEXT
936994
trends: '0'
@@ -1094,6 +1152,7 @@ zabbix_export:
10941152
name: 'PVE user raw'
10951153
type: HTTP_AGENT
10961154
key: pve.user.raw
1155+
delay: '3600'
10971156
history: '0'
10981157
value_type: TEXT
10991158
trends: '0'
@@ -1111,22 +1170,26 @@ zabbix_export:
11111170
value: Raw
11121171
- uuid: 6ab7180a35904b229e889d93696c65ad
11131172
name: 'PVE version'
1114-
type: HTTP_AGENT
1173+
type: DEPENDENT
11151174
key: pve.version
1175+
delay: '0'
11161176
history: '0'
11171177
value_type: CHAR
11181178
trends: '0'
1119-
description: 'Proxmox VE version string (e.g. 8.3.2). Source: /nodes/{node}/version → data.version.'
1179+
description: 'Proxmox VE version string, for example 9.2.10. Source: /nodes/{node}/status → data.pveversion, which carries it as pve-manager/9.2.10/<repoid>. Read from the host status instead of the separate version endpoint, so no extra request per interval is needed.'
11201180
preprocessing:
11211181
- type: JSONPATH
11221182
parameters:
1123-
- $.data.version
1124-
url: 'https://{$PVE_IP}:{$PVE_PORT}/api2/json/nodes/{$PVE_NODE}/version'
1125-
headers:
1126-
- name: Authorization
1127-
value: 'PVEAPIToken={$PVE_API_USER}!{$PVE_API_TOKEN_ID}={$PVE_API_TOKEN}'
1128-
- name: Accept
1129-
value: application/json
1183+
- $.data.pveversion
1184+
- type: REGEX
1185+
parameters:
1186+
- 'pve-manager/([0-9][0-9.]*)'
1187+
- \1
1188+
- type: DISCARD_UNCHANGED_HEARTBEAT
1189+
parameters:
1190+
- 1d
1191+
master_item:
1192+
key: pve.status
11301193
tags:
11311194
- tag: PVE
11321195
value: Version
@@ -1922,6 +1985,10 @@ zabbix_export:
19221985
parameters:
19231986
- paused
19241987
- '2'
1988+
- type: STR_REPLACE
1989+
parameters:
1990+
- unknown
1991+
- '3'
19251992
master_item:
19261993
key: pve.cluster.resources.raw
19271994
tags:
@@ -2460,9 +2527,8 @@ zabbix_export:
24602527
name: 'CPU usage of VM {#VMID} over {$CPU_USAGE_AVERAGE:"{#VMID}"}% for 5 minutes'
24612528
priority: AVERAGE
24622529
description: |
2463-
To permanently suppress the "CPU high" trigger warning on the host, set the host macro:
2464-
{$CPU_USAGE_AVERAGE:"{#VMID}"}=1 Enable the "VM stopped" trigger.
2465-
{$CPU_USAGE_AVERAGE:"{#VMID}"}=0 will disable the alert for that item.
2530+
{$CPU_USAGE_AVERAGE} is a percentage threshold, not a switch. Setting it to 0 makes the trigger fire on any load above zero.
2531+
Use the context form to change it for a single guest, for example {$CPU_USAGE_AVERAGE:"{#VMID}"}=95, or set it to 100 to silence that guest.
24662532
dependencies:
24672533
- name: 'CPU usage of VM {#VMID} over {$CPU_USAGE_HIGH:"{#VMID}"}% for 5 minutes'
24682534
expression: 'min(/Template Proxmox VE REST API/vm.cpuusage[{#VMID}],300)>{$CPU_USAGE_HIGH:"{#VMID}"}'
@@ -2471,9 +2537,8 @@ zabbix_export:
24712537
name: 'CPU usage of VM {#VMID} over {$CPU_USAGE_HIGH:"{#VMID}"}% for 5 minutes'
24722538
priority: HIGH
24732539
description: |
2474-
To permanently suppress the "CPU high" trigger warning on the host, set the host macro:
2475-
{$CPU_USAGE_HIGH:"{#VMID}"}=1 Enable the "VM stopped" trigger.
2476-
{$CPU_USAGE_HIGH:"{#VMID}"}=0 will disable the alert for that item.
2540+
{$CPU_USAGE_HIGH} is a percentage threshold, not a switch. Setting it to 0 makes the trigger fire on any load above zero.
2541+
Use the context form to change it for a single guest, for example {$CPU_USAGE_HIGH:"{#VMID}"}=100.
24772542
- uuid: 4c6878c9c5a945a8810c1d5c3fac9c5f
24782543
name: 'Disk read rate of {#VMID}'
24792544
type: DEPENDENT
@@ -2766,6 +2831,10 @@ zabbix_export:
27662831
parameters:
27672832
- paused
27682833
- '2'
2834+
- type: STR_REPLACE
2835+
parameters:
2836+
- unknown
2837+
- '3'
27692838
master_item:
27702839
key: pve.cluster.resources.raw
27712840
tags:
@@ -3585,7 +3654,7 @@ zabbix_export:
35853654
description: 'Warning threshold for LXC CPU utilization (%) over 5 minutes.'
35863655
- macro: '{$MEMORY.UTIL.MAX}'
35873656
value: '90'
3588-
description: 'Warning threshold for VM/LXC memory utilization (%). Triggers when memory used exceeds this value.'
3657+
description: 'Warning threshold for memory utilization of the PVE host itself (%). Guest memory is not covered by this macro.'
35893658
- macro: '{$PVE.USER.EXPIRE.TIME}'
35903659
value: '172800'
35913660
description: 'Seconds before user account expiration to trigger warning (default 172800 = 2 days).'
@@ -3613,6 +3682,9 @@ zabbix_export:
36133682
- macro: '{$ROOTFS.UTIL.WARN}'
36143683
value: '90'
36153684
description: 'Warning threshold for root filesystem utilization (%).'
3685+
- macro: '{$SWAP.UTIL.MAX}'
3686+
value: '80'
3687+
description: 'Warning threshold for swap utilization of the PVE host (%). The trigger stays silent on hosts that have no swap configured.'
36163688
- macro: '{$STORAGE.UTIL.CRIT}'
36173689
value: '90'
36183690
description: 'Critical threshold for storage utilization (%). Triggers when storage used exceeds this value.'
@@ -4434,12 +4506,23 @@ zabbix_export:
44344506
newvalue: running
44354507
- value: '2'
44364508
newvalue: paused
4509+
- value: '3'
4510+
newvalue: unknown
44374511
triggers:
44384512
- uuid: bdaeac3c76ec44ef96bf78ca83ba0dad
44394513
expression: 'min(/Template Proxmox VE REST API/pve.loadaverage.oneminute,900) >= last(/Template Proxmox VE REST API/pve.cpus)'
44404514
name: 'High CPU average'
44414515
opdata: 'Current cpu average: {ITEM.LASTVALUE1}'
44424516
priority: AVERAGE
4517+
- uuid: e63733b354ef41c4aa800990b8f2ae73
4518+
expression: |
4519+
last(/Template Proxmox VE REST API/pve.swap.total)>0
4520+
and last(/Template Proxmox VE REST API/pve.swap.used) / last(/Template Proxmox VE REST API/pve.swap.total) * 100 > {$SWAP.UTIL.MAX}
4521+
name: 'High swap usage on {HOST.NAME} (>{$SWAP.UTIL.MAX}%)'
4522+
opdata: 'Swap used: {ITEM.LASTVALUE1} of {ITEM.LASTVALUE2}'
4523+
priority: WARNING
4524+
description: 'Swap on the PVE host is filling up. The first condition keeps the trigger silent on hosts without swap instead of turning it unsupported.'
4525+
manual_close: 'YES'
44434526
- uuid: d7b8381cedda4cd0bcb28053cd731ddf
44444527
expression: '(last(/Template Proxmox VE REST API/pve.memory.used) / last(/Template Proxmox VE REST API/pve.memory.total)) * 100 > {$MEMORY.UTIL.MAX}'
44454528
name: 'High memory usage on {HOST.NAME} (>{$MEMORY.UTIL.MAX}%)'

0 commit comments

Comments
 (0)