[ZBX-23189] Patch up Proxmox VE by HTTP template Created: 2023 Aug 02 Updated: 2024 May 10 Resolved: 2024 May 09 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | Templates (T) |
Affects Version/s: | 6.4.5 |
Fix Version/s: | None |
Type: | Patch request | Priority: | Trivial |
Reporter: | MArk | Assignee: | Aleksejs Abrosimovs |
Resolution: | Won't fix | Votes: | 0 |
Labels: | Proxmox, lxc, qemu, template, uptime, vm | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified | ||
Environment: |
All |
Attachments: |
![]() ![]() ![]() ![]() |
Description |
The "Proxmox VE by HTTP" OOTB template includes an "LXC discovery" and a "QEMU discovery" with the following trigger prototypes: LXCName: Proxmox: LXC {#NODE.NAME}/{#LXC.NAME}: has been restarted QEMUName: Proxmox: VM {#NODE.NAME}/{#QEMU.NAME}: has been restarted
In both cases, the trigger identifies and generate an event when a discovered LXC/VM has an uptime of less than 10 minutes. However, there is a potential issue with this approach that could to be addressed. The issue arises when the item "Proxmox: LXC/VM {#LXC.NAME}/{#LXC.NAME}: Status" captures the LXC/VM's raw status, which includes the uptime even when it is stopped. In such cases, the uptime value remains at zero, causing the trigger expression to generate an event that won't be resolved.
To mitigate this issue, it is good to perform a status validation before generating the event. This validation should check the status of the LXC/VM and prevent the trigger from generating events for stopped instances. Here's a suggested version of the trigger expression that includes the status validation: LXC:
last(/Proxmox VE by HTTP/proxmox.lxc.uptime[{#LXC.ID}])<10m
and
last(/Proxmox VE by HTTP/proxmox.lxc.vmstatus[{#LXC.ID}],#1)="running"
QEMU:
last(/Proxmox VE by HTTP/proxmox.qemu.uptime[{#QEMU.ID}])<10m
and
last(/Proxmox VE by HTTP/proxmox.qemu.vmstatus[{#QEMU.ID}],#1)="running"
With this modified expression, the trigger will only fire when the LXC/VM has an uptime of less than 10 minutes and its status is "running," ensuring that events are generated and resolved accurately. |
Comments |
Comment by Aleksejs Abrosimovs [ 2024 May 07 ] |
Fixed in: ZBX-21455 |
Comment by MArk [ 2024 May 08 ] |
Hi. I appreciate the time taken to analyze this issue, but I think there's a misunderstanding. This patch request is newer than Again, as I described, if we use the OOTB template, the VM/LXC triggered event will remain active indefinitely. |
Comment by MArk [ 2024 May 08 ] |
Hi. I appreciate the time taken to analyze this issue, but I think there's a misunderstanding. This patch request is newer than Again, as I described, if we use the OOTB template, the VM/LXC triggered event will remain active indefinitely. |
Comment by Aleksejs Abrosimovs [ 2024 May 08 ] |
Triggers "* has been restarted" are dependent on corresponding triggers "* Not running", where the "running" status of the LXC/QEMU is already checked. Creating an additional check is unnecessary, and it will add extra load to the server.
Trigger "* has been restarted" will behave as intended if the following items works as they should: /{#LXC.NAME}|#LXC.NAME}/{#LXC.NAME}]: Status /{#LXC.NAME} ({#LXC.ID})|#NODE.NAME}/{#LXC.NAME} ({#LXC.ID})]: Status /{#LXC.NAME} ({#LXC.ID})|#NODE.NAME}/{#LXC.NAME} ({#LXC.ID})]: Uptime
Please, double-check your installation and configuration.
Tested with clean default installation of Proxmox
P.S. Misleading items names ("Status") are fixed in
As an example: LXC is not running and uptime is less than 10 min. Therefore both triggers has "problem" status: But, because "has been restarted" is dependent trigger, it is not shown in the "Problems menu/section": |
Comment by MArk [ 2024 May 10 ] |
Please, consider this scenario: My main point is that a dependency between the "not running" and "has been restarted" triggers does not address the scenario where a VM/LXC has been manually stopped. If an admin manually stops a Proxmox VM, and he disables the Zabbix "not running" trigger to avoid a permanent open problem, the "has been restarted" trigger then arises for the stopped VM. This event can be avoided by using the suggested expression. Another approach to prevent the "has been restarted" trigger from firing on a stopped VM/LXC is to check if the VM/LXC uptime is greater than 0, instead of checking 2 different items. LXC: last(/Proxmox VE by HTTP/proxmox.lxc.uptime[{#LXC.ID}])<10m and last(/Proxmox VE by HTTP/proxmox.lxc.uptime[{#LXC.ID}])>0 QEMU: last(/Proxmox VE by HTTP/proxmox.qemu.uptime[{#QEMU.ID}])<10m and last(/Proxmox VE by HTTP/proxmox.qemu.uptime[{#QEMU.ID}])>0
Of course, these are just suggestions for improving the template logic. |
Comment by Aleksejs Abrosimovs [ 2024 May 10 ] |
The current template's behavior suits the general needs of most Proxmox users. Unfortunately, we can't satisfy all possible variations of installations and situations. Or you can temporarily disable monitoring for stopped machines/containers. Proxmox: LXC [{#LXC.NAME}/{#LXC.NAME}]: Status or as it will be called in the following versions: 6.0.30rc1, 6.4.15rc1, 7.0.0rc1: Proxmox: LXC [{#NODE.NAME}/{#LXC.NAME}]: Get data
Thank you for your interest in improving Zabbix.
|