zabbix_export:
  version: '7.0'
  template_groups:
    - uuid: a571c0d144b14fd4a87a9d9b2aa9fcd6
      name: Templates/Applications
  templates:
    - uuid: 4b27e636b6ad4ce68511d344d5604999
      template: 'WildFly Domain by JMX'
      name: 'WildFly Domain by JMX'
      description: |
        Official JMX Template for WildFly.
        The metrics are collected by JMX. This template works with Domain Controller.
        You can set {$WILDFLY.USER} and {$WILDFLY.PASSWORD} macros in the template for using on the host level.
        
        You can discuss this template or leave feedback on our forum https://www.zabbix.com/forum/zabbix-suggestions-and-feedback
        
        Generated by official Zabbix template tool "Templator"
      vendor:
        name: Zabbix
        version: 7.0-0
      groups:
        - name: Templates/Applications
      items:
        - uuid: aa30358b46024aef8fa2e3ba387c4fb9
          name: Uptime
          type: JMX
          key: 'jmx["java.lang:type=Runtime","Uptime"]'
          units: s
          username: '{$WILDFLY.USER}'
          password: '{$WILDFLY.PASSWORD}'
          description: 'WildFly server uptime.'
          preprocessing:
            - type: MULTIPLIER
              parameters:
                - '0.001'
          jmx_endpoint: 'service:jmx:{$WILDFLY.JMX.PROTOCOL}://{HOST.CONN}:{HOST.PORT}'
          tags:
            - tag: component
              value: application
          triggers:
            - uuid: 926f1767aae74529a972c7b8b09f4442
              expression: 'last(/WildFly Domain by JMX/jmx["java.lang:type=Runtime","Uptime"])<10m'
              name: 'WildFly: Host has been restarted'
              event_name: 'WildFly: {HOST.NAME} has been restarted (uptime < 10m)'
              priority: INFO
              description: 'Uptime is less than 10 minutes.'
              manual_close: 'YES'
              tags:
                - tag: scope
                  value: notice
        - uuid: 5c0653e99ddb4f26ae12ce4d6ce9892c
          name: 'Launch type'
          type: JMX
          key: 'jmx["jboss.as:management-root=server","launchType"]'
          value_type: CHAR
          username: '{$WILDFLY.USER}'
          password: '{$WILDFLY.PASSWORD}'
          description: 'The manner in which the server process was launched. Either "DOMAIN" for a domain mode server launched by a Host Controller, "STANDALONE" for a standalone server launched from the command line, or "EMBEDDED" for a standalone server launched as an embedded part of an application running in the same virtual machine.'
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
          jmx_endpoint: 'service:jmx:{$WILDFLY.JMX.PROTOCOL}://{HOST.CONN}:{HOST.PORT}'
          tags:
            - tag: component
              value: application
        - uuid: 5412059106e844ae89f6f84b4da42388
          name: Name
          type: JMX
          key: 'jmx["jboss.as:management-root=server","name"]'
          value_type: CHAR
          username: '{$WILDFLY.USER}'
          password: '{$WILDFLY.PASSWORD}'
          description: |
            For standalone mode: The name of this server. If not set, defaults to the runtime value of InetAddress.getLocalHost().getHostName().
            For domain mode: The name given to this domain
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
          jmx_endpoint: 'service:jmx:{$WILDFLY.JMX.PROTOCOL}://{HOST.CONN}:{HOST.PORT}'
          tags:
            - tag: component
              value: application
        - uuid: d5e2f5e277874567a5d46196fd032298
          name: 'Process type'
          type: JMX
          key: 'jmx["jboss.as:management-root=server","processType"]'
          value_type: CHAR
          username: '{$WILDFLY.USER}'
          password: '{$WILDFLY.PASSWORD}'
          description: 'The type of process represented by this root resource.'
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
          jmx_endpoint: 'service:jmx:{$WILDFLY.JMX.PROTOCOL}://{HOST.CONN}:{HOST.PORT}'
          tags:
            - tag: component
              value: application
        - uuid: f1bb15824f384e21bb9ae1224abd18e0
          name: Version
          type: JMX
          key: 'jmx["jboss.as:management-root=server","productVersion"]'
          value_type: CHAR
          username: '{$WILDFLY.USER}'
          password: '{$WILDFLY.PASSWORD}'
          description: 'The version of the WildFly Core based product release.'
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
          jmx_endpoint: 'service:jmx:{$WILDFLY.JMX.PROTOCOL}://{HOST.CONN}:{HOST.PORT}'
          tags:
            - tag: component
              value: application
          triggers:
            - uuid: 76d500211fd9479fafbd0fb7d41ffd68
              expression: 'last(/WildFly Domain by JMX/jmx["jboss.as:management-root=server","productVersion"],#1)<>last(/WildFly Domain by JMX/jmx["jboss.as:management-root=server","productVersion"],#2) and length(last(/WildFly Domain by JMX/jmx["jboss.as:management-root=server","productVersion"]))>0'
              name: 'WildFly: Version has changed'
              event_name: 'WildFly: Version has changed (new version: {ITEM.VALUE})'
              priority: INFO
              description: 'WildFly version has changed. Acknowledge to close the problem manually.'
              manual_close: 'YES'
              tags:
                - tag: scope
                  value: notice
      discovery_rules:
        - uuid: 3af697e56771487abee9f62e453fb0c3
          name: 'Deployments discovery'
          type: JMX
          key: 'jmx.get[beans,"jboss.as.expr:deployment=*,server-group=*"]'
          delay: 1h
          username: '{$WILDFLY.USER}'
          password: '{$WILDFLY.PASSWORD}'
          filter:
            evaltype: AND
            conditions:
              - macro: '{#DEPLOYMENT}'
                value: '{$WILDFLY.DEPLOYMENT.MATCHES}'
              - macro: '{#DEPLOYMENT}'
                value: '{$WILDFLY.DEPLOYMENT.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          description: 'Discovery deployments metrics.'
          item_prototypes:
            - uuid: e6b1bebba5da4ce493ba7edf869c37b3
              name: 'WildFly deployment [{#DEPLOYMENT}]: Enabled'
              type: JMX
              key: 'jmx["{#JMXOBJ}",enabled]'
              username: '{$WILDFLY.USER}'
              password: '{$WILDFLY.PASSWORD}'
              description: 'Boolean indicating whether the deployment content is currently deployed in the runtime (or should be deployed in the runtime the next time the server starts).'
              valuemap:
                name: 'WildFly flag'
              preprocessing:
                - type: BOOL_TO_DECIMAL
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 3h
              jmx_endpoint: 'service:jmx:{$WILDFLY.JMX.PROTOCOL}://{HOST.CONN}:{HOST.PORT}'
              tags:
                - tag: component
                  value: deployments
                - tag: deployment
                  value: '{#DEPLOYMENT}'
                - tag: server-group
                  value: '{#SERVER_GROUP}'
            - uuid: 45d729721df34ef297109b58027ca4c1
              name: 'WildFly deployment [{#DEPLOYMENT}]: Managed'
              type: JMX
              key: 'jmx["{#JMXOBJ}",managed]'
              username: '{$WILDFLY.USER}'
              password: '{$WILDFLY.PASSWORD}'
              description: 'Indicates if the deployment is managed (aka uses the ContentRepository).'
              valuemap:
                name: 'WildFly flag'
              preprocessing:
                - type: BOOL_TO_DECIMAL
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 3h
              jmx_endpoint: 'service:jmx:{$WILDFLY.JMX.PROTOCOL}://{HOST.CONN}:{HOST.PORT}'
              tags:
                - tag: component
                  value: deployments
                - tag: deployment
                  value: '{#DEPLOYMENT}'
                - tag: server-group
                  value: '{#SERVER_GROUP}'
          jmx_endpoint: 'service:jmx:{$WILDFLY.JMX.PROTOCOL}://{HOST.CONN}:{HOST.PORT}'
          lld_macro_paths:
            - lld_macro: '{#DEPLOYMENT}'
              path: $.properties.deployment
            - lld_macro: '{#JMXOBJ}'
              path: $.object
            - lld_macro: '{#SERVER_GROUP}'
              path: '$.properties.["server-group"]'
        - uuid: da7f7dfad0c1440a8980693870364baa
          name: 'Servers discovery'
          type: JMX
          key: 'jmx.get[beans,"jboss.as:host=master,server-config=*"]'
          delay: 1h
          username: '{$WILDFLY.USER}'
          password: '{$WILDFLY.PASSWORD}'
          filter:
            evaltype: AND
            conditions:
              - macro: '{#SERVER}'
                value: '{$WILDFLY.SERVER.MATCHES}'
              - macro: '{#SERVER}'
                value: '{$WILDFLY.SERVER.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          description: 'Discovery instances in domain.'
          item_prototypes:
            - uuid: d0938bbf20854315bd5cf17491b0ae1c
              name: 'WildFly domain: Server {#SERVER}: Autostart'
              type: JMX
              key: 'jmx["{#JMXOBJ}",autoStart]'
              username: '{$WILDFLY.USER}'
              password: '{$WILDFLY.PASSWORD}'
              description: 'Whether or not this server should be started when the Host Controller starts.'
              valuemap:
                name: 'WildFly flag'
              preprocessing:
                - type: BOOL_TO_DECIMAL
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 3h
              jmx_endpoint: 'service:jmx:{$WILDFLY.JMX.PROTOCOL}://{HOST.CONN}:{HOST.PORT}'
              tags:
                - tag: component
                  value: servers
                - tag: server
                  value: '{#SERVER}'
            - uuid: bd544e2d41c148f993b84ca7d1aad4a9
              name: 'WildFly domain: Server {#SERVER}: Server group'
              type: JMX
              key: 'jmx["{#JMXOBJ}",group]'
              value_type: CHAR
              username: '{$WILDFLY.USER}'
              password: '{$WILDFLY.PASSWORD}'
              description: 'The name of a server group from the domain model.'
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 3h
              jmx_endpoint: 'service:jmx:{$WILDFLY.JMX.PROTOCOL}://{HOST.CONN}:{HOST.PORT}'
              tags:
                - tag: component
                  value: servers
                - tag: server
                  value: '{#SERVER}'
              trigger_prototypes:
                - uuid: da5368f2eec040bbb05f13faa6375052
                  expression: 'last(/WildFly Domain by JMX/jmx["{#JMXOBJ}",group],#1)<>last(/WildFly Domain by JMX/jmx["{#JMXOBJ}",group],#2) and length(last(/WildFly Domain by JMX/jmx["{#JMXOBJ}",group]))>0'
                  name: 'WildFly domain: Server {#SERVER}: Server group has changed'
                  event_name: 'WildFly domain: Server {#SERVER}: Server group has changed (new group: {ITEM.VALUE})'
                  priority: INFO
                  description: 'Server group has changed. Acknowledge to close the problem manually.'
                  manual_close: 'YES'
                  tags:
                    - tag: scope
                      value: notice
            - uuid: 64a8a71b3d254a479ce4e5ea82f566ee
              name: 'WildFly domain: Server {#SERVER}: Status'
              type: JMX
              key: 'jmx["{#JMXOBJ}",status]'
              value_type: CHAR
              username: '{$WILDFLY.USER}'
              password: '{$WILDFLY.PASSWORD}'
              description: 'The current status of the server.'
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 3h
              jmx_endpoint: 'service:jmx:{$WILDFLY.JMX.PROTOCOL}://{HOST.CONN}:{HOST.PORT}'
              tags:
                - tag: component
                  value: servers
                - tag: server
                  value: '{#SERVER}'
              trigger_prototypes:
                - uuid: 79409a9fae6442c9ad655655a752365d
                  expression: 'last(/WildFly Domain by JMX/jmx["{#JMXOBJ}",status],#1)<>last(/WildFly Domain by JMX/jmx["{#JMXOBJ}",status],#2) and length(last(/WildFly Domain by JMX/jmx["{#JMXOBJ}",status]))>0'
                  name: 'WildFly domain: Server {#SERVER}: Server status has changed'
                  event_name: 'WildFly domain: Server {#SERVER}: Server status has changed (new status: {ITEM.VALUE})'
                  priority: WARNING
                  description: 'Server status has changed. Acknowledge to close the problem manually.'
                  manual_close: 'YES'
                  tags:
                    - tag: scope
                      value: notice
          jmx_endpoint: 'service:jmx:{$WILDFLY.JMX.PROTOCOL}://{HOST.CONN}:{HOST.PORT}'
          lld_macro_paths:
            - lld_macro: '{#JMXOBJ}'
              path: $.object
            - lld_macro: '{#SERVER}'
              path: '$.properties.["server-config"]'
      tags:
        - tag: class
          value: application
        - tag: target
          value: wildfly-domain
      macros:
        - macro: '{$WILDFLY.DEPLOYMENT.MATCHES}'
          value: '.*'
          description: 'Filter of discoverable deployments'
        - macro: '{$WILDFLY.DEPLOYMENT.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'Filter to exclude discovered deployments'
        - macro: '{$WILDFLY.JMX.PROTOCOL}'
          value: remote+http
        - macro: '{$WILDFLY.PASSWORD}'
          value: zabbix
        - macro: '{$WILDFLY.SERVER.MATCHES}'
          value: '.*'
          description: 'Filter of discoverable servers'
        - macro: '{$WILDFLY.SERVER.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'Filter to exclude discovered servers'
        - macro: '{$WILDFLY.USER}'
          value: zabbix
      valuemaps:
        - uuid: e23e06cfd0ce4e069b9d996f101f6ee6
          name: 'WildFly flag'
          mappings:
            - value: '0'
              newvalue: 'False'
            - value: '1'
              newvalue: 'True'
