Zabbix template

I alway got the problem that I'm only using the latest LTS release and zabbix isn't backwards compatible. So your template can't be used with a zabbix 5.0 LTS and I would need to wait for the 6.0 LTS to run it but then you are probably already releasing that template for 6.1+.

So would be really great if you could release a LTS version too...especially if you don't need any new features.
I'm still thinking about porting this template to Zabbix 5.0, but so far I have a lot of tasks at work besides this. When I transfer this template to Zabbix 5.0, I will definitely write!

Updated. By the way, now my colleague from another company is working on transferring this template to 5.0. if he does, I will update my repository.
 
Last edited:
  • Like
Reactions: UdoB and Dunuin
Monitoring missing updates would be useful too if thats possible using the api. Once I tried a apt template for that but didn't get that working.

And a PBS template would be very useful too.
Ok, I'll add update monitoring to TODO.

I haven't planned PBS monitoring yet, since I don't use PBS at work ...
 
Started to port to Zabbix 5.0.

Ported:
  • Log warning search and triggers
  • Container autodiscovery, metrics and triggers
All changes you may find in git (see https://forum.proxmox.com/threads/zabbix-template.76058/post-435338)

Perhaps tomorrow I will finish it, if I have free time, and change the requirements to Zabbix 5.0+

If anyone has a desire to test this template - download, import and attach the template to the host according to the instructions in README.md

If you find any problems in the template - please write here or in private messages, I will fix it as free time becomes available
 
I alway got the problem that I'm only using the latest LTS release and zabbix isn't backwards compatible. So your template can't be used with a zabbix 5.0 LTS and I would need to wait for the 6.0 LTS to run it but then you are probably already releasing that template for 6.1+.

So would be really great if you could release a LTS version too...especially if you don't need any new features.

Monitoring missing updates would be useful too if thats possible using the api. Once I tried a apt template for that but didn't get that working.

And a PBS template would be very useful too.
Ported the template to Zabbix 5.0. Can you try it to monitor your PVE?

p.s. There may be bugs.

Template and readme is in attachment and in my git (https://git.isaev.tech/IsaevTech/zbx-tmplt-pve)

UPD. Add apt updates. Maybe its works)
 

Attachments

  • zbx-tmplt-pve-master(2).zip
    17 KB · Views: 28
Last edited:
Sure, will try it.

Edit:
Working fine so far.

What I'm missing is a macro to exclude storages. I'm for example already monitoring my ZFS on that node using the zabbix_zfs-on-linux template which gives way more detailed statistics (showing ARC stats and so on) so it would be nice to have a macro to exclude storages from discovery so I could monitor my LVM-thin using your template but keep using the other template for my ZFS pool. Zabbix is really torturing the SSDs with its permanent sync writes so I would prefert not logging stuff twice.
A macro to exclude LXCs/VMs by VMIDs (and/or to only include specific VMIDs) from discovery would also be nice to have in case you are already running a zabbix agent inside the guest. I personally prefer to monitor my guests by running the zabbix agent inside the guest. This allows me for example to define sheduled maintain intervals (so that when guests get shutdown by a weekly backup job zabbix won't spam me with alerts that a guest isn't available). And I'm not running all my guests all the time. In case I don't want to use a guest I will disable it in zabbix, so zabbix doesn't need to monitor it anymore and won'r complain that it isn'T reachable.
But is some cases (for example an appliance like TrueNAS) you can't install a zabbix agent to your guest so it would be nice to monitor these with your template.

Edit:
Monitoring failed backup tasks could be useful too.
 
Last edited:
  • Like
Reactions: vashvampir
Sure, will try it.

Edit:
Working fine so far.

What I'm missing is a macro to exclude storages. I'm for example already monitoring my ZFS on that node using the zabbix_zfs-on-linux template which gives way more detailed statistics (showing ARC stats and so on) so it would be nice to have a macro to exclude storages from discovery so I could monitor my LVM-thin using your template but keep using the other template for my ZFS pool. Zabbix is really torturing the SSDs with its permanent sync writes so I would prefert not logging stuff twice.
A macro to exclude LXCs/VMs by VMIDs (and/or to only include specific VMIDs) from discovery would also be nice to have in case you are already running a zabbix agent inside the guest. I personally prefer to monitor my guests by running the zabbix agent inside the guest. This allows me for example to define sheduled maintain intervals (so that when guests get shutdown by a weekly backup job zabbix won't spam me with alerts that a guest isn't available). And I'm not running all my guests all the time. In case I don't want to use a guest I will disable it in zabbix, so zabbix doesn't need to monitor it anymore and won'r complain that it isn'T reachable.
But is some cases (for example an appliance like TrueNAS) you can't install a zabbix agent to your guest so it would be nice to monitor these with your template.

Edit:
Monitoring failed backup tasks could be useful too.
Ol, I'll add macro for excluding storages, vms and containers soon.

Monitoring failed backup jobs is a good thing, but I haven't yet been able to figure out how to get the status of the last run of a backup job from the API.

So far, a workaround has been implemented. Since PVE writes about the failure of the backup job in the log, you can understand that something went wrong by the trigger "PVE Log Warnings - New warning"
 
  • Like
Reactions: Dunuin
What I'm missing is a macro to exclude storages.


I've updated the template to include the ability to filter the generated items and triggers.

Now you can add macro {$PVE_IGNORE_ID} and macro {$PVE_IGNORE_STORAGE} containing regexp to filter VM/LXC IDs and storages.

Examples:
  • {$PVE_IGNORE_ID} = ^(100\|90[0-9])$ - Autodiscover will include virtual machines and containers with IDs that do not match this regular expression, that is, everything except 100, 900, 901, 902, 903, 904, 905, 906, 907, 908 and 909
  • {$PVE_IGNORE_STORAGE} = ^z.*$ - Autodiscover will include storages with name do not match this regular expression, that is, everything except those whose name begins with a small letter z
The template and readme are in the attached archive or in my git (the link is a few topics earlier)
 

Attachments

  • zbx-tmplt-pve-master.zip
    17.4 KB · Views: 14
Last edited:
  • Like
Reactions: Dunuin
Looks like my regex is wrong. I added the new template, edited the new macros, clicked on "unlink & clear" to remove all the old autodiscovered stuff and added the template again.

Wanted to exclude my VMs: ^(102\|103\|105\|106\|107\|108\|109\|110\|111\|113\|115\|116\|117\|118\|119\|120\|122\|123\|124\|125\|134)$

And to excluce my PBS/NFS/SMB/ZFS storages that I'm already monitoring with other templates (PBS, PBS2, PBSOffsite, PVE_Iso, PVE_Snippets, PVE_ConTmp, VMpool_VLT_VM):
^(PVE.*\|PBS.*\|VMpool.*)$

But all of them got discovered again.

And thanks again for sharing your template with us. :)
 
Looks like my regex is wrong. I added the new template, edited the new macros, clicked on "unlink & clear" to remove all the old autodiscovered stuff and added the template again.

Wanted to exclude my VMs: ^(102\|103\|105\|106\|107\|108\|109\|110\|111\|113\|115\|116\|117\|118\|119\|120\|122\|123\|124\|125\|134)$

And to excluce my PBS/NFS/SMB/ZFS storages that I'm already monitoring with other templates (PBS, PBS2, PBSOffsite, PVE_Iso, PVE_Snippets, PVE_ConTmp, VMpool_VLT_VM):
^(PVE.*\|PBS.*\|VMpool.*)$

But all of them got discovered again.

And thanks again for sharing your template with us. :)
Now I experimented and wrote a regular expression .* in macros, zabbix did not discover anything. Now I'm experimenting with regular expressions :)

Today I will try to understand exactly how zabbix works with regular expressions and write here based on the results of this small research

UPD

1639123286396.png
With these 2 macros, I found only virtual machines whose IDs do not match 100 and 9** and all storages except zbak. Try to do the same for yourself.

Censored the work data in the pictures below.
Storage list:
1639123542720.png
VM List:
1639123667922.png

Zabbix latest data - storages

1639123860198.png

Zabbix latest data - VMs

1639124027898.png

UPD2. Rewrite your regexps

Code:
(102|103|105|106|107|108|109|110|111|113|115|116|117|118|119|120|122|123|124|125|134)
(PVE.*|PBS.*|VMpool.*)
 
Last edited:
  • Like
Reactions: Dunuin
You are right. Without escaping the "|" it works fine. Do you know if the regex supports inverting results? Sometimes it would be shorter to just exclude everything that doesn't match a given pattern.
 
  • Like
Reactions: vashvampir
You are right. Without escaping the "|" it works fine. Do you know if the regex supports inverting results? Sometimes it would be shorter to just exclude everything that doesn't match a given pattern.
Great news!

About inverting result:

1. Fast workaround

You may try to reconfigure template.
In autodiscovery open lxc/qemu discovery, go to Filter tab and change "does not match" to "match" in field near macro
2AFC1243-8D6D-48D0-8509-77ED97C8037B.png

2. Slow workaround

You may search PCRE documentation in internet and try to invert regex yourself. Unfortunately, I do not know regular expressions well enough and I will not be able to tell you how to invert them.

3. Wery slow

You can wait while I come up with and implement 2 macros at the same time, for ignoring and for forced inclusion in the list of detected virtual machines and storages. This can happen tomorrow, if I have time for this, or not :):)
 
  • Like
Reactions: Dunuin
You are right. Without escaping the "|" it works fine. Do you know if the regex supports inverting results? Sometimes it would be shorter to just exclude everything that doesn't match a given pattern.
Updated the template by adding 2 new macros:

  • {$PVE_FORCE_ID} - Forces virtual machine ID to autodiscover ignoring macro {$PVE_IGNORE_ID}
  • {$PVE_FORCE_STORAGE} - Forces storage name to autodiscover ignoring macro {$PVE_IGNORE_STORAGE}

Usage examples:
  • {$PVE_FORCE_ID}
Code:
{$PVE_IGNORE_ID} = .*
{$PVE_FORCE_ID} = [1-2][0-9][0-9]

In this case, the template will only find virtual machines with IDs 100-199, 200-299
  • {$PVE_FORCE_STORAGE}
Code:
{$PVE_IGNORE_STORAGE} = .*
{$PVE_FORCE_STORAGE} = VMSTOR.*

In this case, the template will only find storage with a name starting with VMSTOR
 

Attachments

  • zbx-tmplt-pve-master.zip
    17.6 KB · Views: 31
  • Like
Reactions: itNGO and Dunuin
Works like a charm here on 5.0 LTS.
Fine! If you have any ideas about new functionality or any bugs - write here, I'll try to do something :)

At the moment, I have plans to:
1. Mirror repository with this template to github
2. Modify this template for the work needs of my organization, if necessary
3. Maybe post this template on the Zabbix forum (if I'm not too lazy and I'll register there :))
 
  • Like
Reactions: itNGO
Hello everyone! Stumbled upon this thread and decided to share a template that I recently started creating for work, based on Zabbix HTTP Agent checks and PVE API.

Requirements: Zabbix 5.4.7, PVE 7.0 (tested on this versions), direct access from zabbix server to PVE via 8006/tcp

At the moment, I have implemented auto-discovery of virtual machines, containers, storages, cluster nodes and quite a few triggers based on the data found.

Do you think you need to add something to this template or change it in general?

The template itself and instructions can be found on my git, as well as in the attached files

Git: https://git.isaev.tech/IsaevTech/zbx-tmplt-pve
Perfect solution ! only tracking backups is missing
 
And we need to convince vashvampir's boss to try out PBS so a PBS template would makes sense too ;)
 
Hello everyone! Stumbled upon this thread and decided to share a template that I recently started creating for work, based on Zabbix HTTP Agent checks and PVE API.

Requirements: Zabbix 5.4.7, PVE 7.0 (tested on this versions), direct access from zabbix server to PVE via 8006/tcp

At the moment, I have implemented auto-discovery of virtual machines, containers, storages, cluster nodes and quite a few triggers based on the data found.

Do you think you need to add something to this template or change it in general?

The template itself and instructions can be found on my git, as well as in the attached files

Git: https://git.isaev.tech/IsaevTech/zbx-tmplt-pve
An absolute amazing piece of Work! I really like what you have done so far. We start to evaluate it in our Datacenter and so far, it is fantastic!

Many thanks for this!
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!