Ad Widget

Collapse

Create generic template based on WMI queries

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • greenwulf
    Junior Member
    • Feb 2026
    • 1

    #1

    Create generic template based on WMI queries

    Hello,
    We are running Zabbix 7.0 LTS
    I was able to create a Template to get for a specific process the following items values on Windows machines :
    Service status (service.info)
    Process CPU Usage in % (wmi query)
    Process memory usage in % (wmi query)
    Process ID (wmi query)

    Now, what I would like is to create a generic Template to have the same items but based on three macros :
    ​{$APP_NAME} => Name of the application to monitor, will be used in titles of template, discovery, Item prototypes ...
    {$PROCESS_NAME} => Process name will be used in the WMI queries
    {$SERVICE_NAME} => Service Name (will be used for service.info item)

    If I understood well, no macro can be used to detect items, that's why I must use discovery and Item prototypes.
    So I would like to create a discovery of processes
    Based on this discovery, I would like to create Items prototypes using macros
    I don't think it is usefull to create Items

    Am I somewhere wrong ?

    I am not asking you to give me the code, just to tell me if something is not possible in what I would like to implement.
  • guntis_liepins
    Junior Member
    • Oct 2025
    • 21

    #2
    You can have pretty much flexibility by using LLD include and exclude filters and overrides.
    Look at zabbix linux template "Linux by zabbix agent" how filtering of items for networ interfaces are done - it has macro with regexp which filters out network interfaces according to regexp.
    You define filter based on interface name matches {$NET.IF.IFNAME.MATCHES} (all interfaces by default) , then filter out interfaces based on value on {$NET.IF.IFNAME.NOT_MATCHES} .
    So you can discover whatever you want and override it by host level.
    I have seen third party templates using wmi, but never needed them myself,you may try these.

    Comment

    • irontmp
      Member
      • Sep 2023
      • 44

      #3
      Originally posted by guntis_liepins
      You can have pretty much flexibility by using LLD include and exclude filters and overrides.
      Look at Zabbix Linux template "Linux by Zabbix agent" how filtering of items for network interfaces is done. It has a macro with regexp which filters out network interfaces according to regexp, read here for details.
      You define filter based on interface name matches {$NET.IF.IFNAME.MATCHES} (all interfaces by default) , then filter out interfaces based on value on {$NET.IF.IFNAME.NOT_MATCHES} .
      So you can discover whatever you want and override it by host level.
      I have seen third party templates using wmi, but never needed them myself,you may try these.
      Yes, your approach is correct. You need to use low-level discovery and item prototypes with macros; static items won’t work for dynamically detecting processes or services. Everything you want to do is possible using LLD and prototypes.

      Comment

      Working...