Ad Widget

Collapse

Fix for Proxmox VE by HTTP template to skip VM templates

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MicMade
    Junior Member
    • Aug 2022
    • 1

    #1

    Fix for Proxmox VE by HTTP template to skip VM templates

    Hello there!

    Thank you for creating this fantastic tool. We're having a lot of fun with it. Just one thing:

    The Proxmox VE by HTTP template plugin, by default, doesn't distinguish between Proxmox VMs en Proxmox VM templates. The consequence of this is that for every template you create, Zabbix will continue to spam problem notifications about VM templates which are "not running", when templates cannot even "run" in the first place. They're templates, not VMs.

    However, there is a relatively simple fix: adapt the template to exclude Proxmox VM templates. This can be achieved as follows:

    Go to Configuration > Templates > "Proxmox VE by HTTP" --> click the blue text "Discovery" in the column "Discovery". Click "QEMU discovery". Click "LLD Macros".

    Add this macro:
    LLD Macro JSONPath
    {#QEMU.TEMPLATE} $.template
    .
    Then, click "Filters" and add:
    .
    Macro Regular expression
    {#QEMU.TEMPLATE} matches 0
    .
    You'd need to remove previously discovered triggers covering Proxmox VM templates, but the discovery process should skip Proxmox VM templates from now on.

    My suggestion is: since this makes sense (templates aren't VMs and shouldn't be treated identically, they don't boot, etc. etc.) and it works for us, would it make sense to integrate this solution into Zabbix?

    I'm curious if you agree with our solution, in any case having to watch constant notifications about Proxmox VM templates is rather cumbersome!
  • poxin
    Junior Member
    • Nov 2015
    • 14

    #2
    Thanks for the guide, came here from Google looking for this exact thing. 100% agree templates should be ignored.

    Comment

    • dixie2k
      Junior Member
      • Jun 2024
      • 12

      #3
      MicMade poxin

      I stumbled on this post and have configured exactly as you have suggested. Unfortunately, templates are still showing up as problems. Any suggestions?

      Thanks in advance!

      Comment

      • LuckyVb
        Junior Member
        • Aug 2022
        • 1

        #4
        LXC Discovery
        Add this macro:
        LLD Macro JSONPath
        {#LXC.TAGS} $.template
        Then, click "Filters"
        Macro Regular expression
        Type of calculation custom expression A and (B and C) and (D or E)
        Macro Regular expression
        {#RESOURCE.TYPE} matches ^lxc$
        {#LXC.TEMPLATE} exists
        {#LXC.TEMPLATE} matches 0
        {#LXC.TAGS} does not exists
        {#LXC.TAGS} does not matches {$PVE.LXC.IGNORE.BY.TAG}
        QEMU Discovery
        LLD Macro JSONPath
        {#QEMU.TAGS} $.template
        Then, click "Filters"
        Macro Regular expression
        Type of calculation custom expression A and (B and C) and (D or E)
        Macro Regular expression
        {#RESOURCE.TYPE} matches ^qemu$
        {#LXC.TEMPLATE} exists
        {#LXC.TEMPLATE} matches 0
        {#LXC.TAGS} does not exists
        {#LXC.TAGS} does not matches {$PVEQEMU.IGNORE.BY.TAG}

        Go to Macros global or every host then add
        Macro Value Description
        {$PVE.LXC.IGNORE.BY.TAG} ^zabbix-ignore;|;zabbix-ignore$|;zabbix-ignore;|^zabbix-ignore$ Ignore LXC with this TAG from discovery
        {$PVE.QEMU.IGNORE.BY.TAG} ^zabbix-ignore;|;zabbix-ignore$|;zabbix-ignore;|^zabbix-ignore$ Ignore QEMU with this TAG from discovery

        Comment

        • Kordian
          Junior Member
          • Nov 2024
          • 6

          #5
          Originally posted by LuckyVb
          LXC Discovery
          Add this macro:
          LLD Macro JSONPath
          {#LXC.TAGS} $.template
          Then, click "Filters"
          Macro Regular expression
          Type of calculation custom expression A and (B and C) and (D or E)
          Macro Regular expression
          {#RESOURCE.TYPE} matches ^lxc$
          {#LXC.TEMPLATE} exists
          {#LXC.TEMPLATE} matches 0
          {#LXC.TAGS} does not exists
          {#LXC.TAGS} does not matches {$PVE.LXC.IGNORE.BY.TAG}
          QEMU Discovery
          LLD Macro JSONPath
          {#QEMU.TAGS} $.template
          Then, click "Filters"
          Macro Regular expression
          Type of calculation custom expression A and (B and C) and (D or E)
          Macro Regular expression
          {#RESOURCE.TYPE} matches ^qemu$
          {#LXC.TEMPLATE} exists
          {#LXC.TEMPLATE} matches 0
          {#LXC.TAGS} does not exists
          {#LXC.TAGS} does not matches {$PVEQEMU.IGNORE.BY.TAG}
          Go to Macros global or every host then add
          Macro Value Description
          {$PVE.LXC.IGNORE.BY.TAG} ^zabbix-ignore;|;zabbix-ignore$|;zabbix-ignore;|^zabbix-ignore$ Ignore LXC with this TAG from discovery
          {$PVE.QEMU.IGNORE.BY.TAG} ^zabbix-ignore;|;zabbix-ignore$|;zabbix-ignore;|^zabbix-ignore$ Ignore QEMU with this TAG from discovery
          Hello,
          I have some questions:
          1. In the QEMU discoverz should the macro be {#LXC.TEMPLATE} and {#LXC.TAGS}, or should it be {#QEMU.TEMPLATE} and {#QEMU.TAGS}?
          2. Is it all, what is needed and is the "zabbix-ignore" parameter somehow within the zabbix and proxmox system, or should I additionally set this parameter, for example as a tag in proxmox qemu/template?
          Thank you in advance!

          Comment

          • ElChipoteur
            Junior Member
            • Apr 2025
            • 1

            #6
            Hello Kordian

            I came across the same issue.
            I don't know if you found the answers to your questions, but here is what worked for me (based on the solution proposed by LuckyVb )

            LXC Discovery
            Add this macro:
            LLD Macro JSONPath
            {#LXC.TAGS} $.tags
            {#LXC.TEMPLATE} $.template
            Then, click "Filters"
            Macro Regular expression
            Type of calculation custom expression A and (B or C) and (D or E)
            Macro Regular expression
            {#RESOURCE.TYPE} matches ^lxc$
            {#LXC.TAGS} does not exists
            {#LXC.TAGS} does not matches {$PVE.IGNORE.BY.TAG}
            {#LXC.TEMPLATE} does not exists
            {#LXC.TEMPLATE} matches 0

            QEMU Discovery
            LLD Macro JSONPath
            {#QEMU.TAGS} $.tags
            {#QEMU.TEMPLATE} $.template
            Then, click "Filters"
            Macro Regular expression
            Type of calculation custom expression A and (B or C) and (D or E)
            Macro Regular expression
            {#RESOURCE.TYPE} matches ^qemu$
            {#QEMU.TAGS} does not exists
            {#QEMU.TAGS} does not matches {$PVE.IGNORE.BY.TAG}
            {#QEMU.TEMPLATE} does not exists
            {#QEMU.TEMPLATE} matches 0
            Go to Macros global (or on individual host)
            Macro Value Description
            {$PVE.IGNORE.BY.TAG} ^zabbix-ignore;|;zabbix-ignore$|;zabbix-ignore;|^zabbix-ignore$ Ignore VM with this TAG from discovery

            And regarding your question about the tag "zabbix-ignore", it is a proxmox tag that you need to configure on the VM if you want zabbix to ignore it.

            Hope that helps!

            Comment

            • smithj33
              Junior Member
              • Jan 2026
              • 1

              #7
              First, thank you MicMade for this post. Just to confirm, MicMade's, instructions work perfectly. Previously discovered templates will be deleted in 7 days after you follow his instructions, if your Proxmox template still has default disable/delete parameters. You could go and delete each item for each VM template to expedite the process. I took his solution and adapted it to not discover VMs and LXCs that contain a specific tag.

              Add this macro: (change QEMU to LXC under LXC Discovery Macros)
              LLD Macro JSONPath
              {#QEMU.TAGS} $.tags
              Then, click "Filters" and add: (change QEMU to LXC under LXC Discovery Filters)
              Macro Regular expression
              {#QEMU.TAGS} does not match testing
              So any VM or LXC with a tag of "testing" will no longer be discovered and will be removed after 7 days or again, you can go remove them manually. The VM or LXC can have multiple tags and this will still work. If you want multiple tags to not be monitored, just adjust the regular expression by adding a pipe between each tag. Example: testing|EOL|staging


              Comment

              Working...