zabbix_export:
  version: '7.4'
  templates:
    - uuid: 7672ea29a2b444a9a95bab12ffc613f8
      template: 'Azure Arc by Zabbix Agent'
      name: 'Azure Arc by Zabbix Agent'
      items:
        - uuid: 5661ed86a94a453ca81da33afc2b6374
          name: 'Azure Arc Connectivity Check Unprocessed'
          type: ZABBIX_ACTIVE
          key: azcmagent.check
          history: 1h
          value_type: TEXT
          timeout: 15s
          tags:
            - tag: application
              value: 'azure arc'
        - uuid: 171b5b129dce41d1ab44190219535b1a
          name: 'Azure Arc Connectivity Check Processed'
          type: DEPENDENT
          key: azcmagent.check.processed
          history: 1h
          value_type: TEXT
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  //Normalize input to a string
                    var text;
                    if (typeof value === 'string') {
                      text = value;
                    } else if (Array.isArray(value)) {
                      text = value.join('\n');
                    } else {
                      // Fallback: pretty-print JSON-like input
                      text = JSON.stringify(value, null, 2);
                    }
                  
                    // Preserve original line endings
                    var EOL = /\r\n/.test(text) ? '\r\n' : '\n';
                  
                    // Replace first and last lines with [ and ]
                    var lines = text.split(/\r?\n/);
                    if (lines.length > 0) {
                      lines[0] = '[';
                      lines[lines.length - 1] = ']';
                    }
                    text = lines.join(EOL);
                  
                    // Remove any match to the pattern:  "https://<any domain>":
                    // - Matches https only (as requested)
                    // - [^"]+ allows domains with ports, paths, query strings until the next quote
                    // - \s* allows optional whitespace after the colon
                    text = text.replace(/"https:\/\/[^"]+":\s*/g, '');
                  
                    return text;
          master_item:
            key: azcmagent.check
          tags:
            - tag: application
              value: 'azure arc'
        - uuid: 50a1b23c93244b56b966699a0b69da61
          name: 'Azure Arc Show Details'
          type: ZABBIX_ACTIVE
          key: azcmagent.show
          delay: 5m
          history: 1h
          value_type: TEXT
          timeout: 15s
          tags:
            - tag: application
              value: 'azure arc'
        - uuid: 7e57a1fa1ede4d89b2f4092f50d352ec
          name: 'Agent Version'
          type: DEPENDENT
          key: azcmagent.show.agentVersion
          value_type: CHAR
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.agentVersion
          master_item:
            key: azcmagent.show
          tags:
            - tag: application
              value: 'azure arc'
        - uuid: 08a44b4f3f5b4068bdd62078109e1591
          name: Cloud
          type: DEPENDENT
          key: azcmagent.show.cloud
          value_type: CHAR
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.cloud
          master_item:
            key: azcmagent.show
          tags:
            - tag: application
              value: 'azure arc'
        - uuid: d983c9f66e3842f7be65436ef7e34d59
          name: 'Correlation ID'
          type: DEPENDENT
          key: azcmagent.show.correlationId
          value_type: CHAR
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.correlationId
          master_item:
            key: azcmagent.show
          tags:
            - tag: application
              value: 'azure arc'
        - uuid: ddba2e27547943918e9a677ffc9a49ff
          name: 'Last Heartbeat'
          type: DEPENDENT
          key: azcmagent.show.lastHeartbeat
          value_type: CHAR
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.lastHeartbeat
          master_item:
            key: azcmagent.show
          tags:
            - tag: application
              value: 'azure arc'
        - uuid: 4d6b3e1750b24d59892837056242c5c4
          name: Location
          type: DEPENDENT
          key: azcmagent.show.location
          value_type: CHAR
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.location
          master_item:
            key: azcmagent.show
          tags:
            - tag: application
              value: 'azure arc'
        - uuid: a9475edd8ed2468eaff1d8be938adff5
          name: 'Resource Group'
          type: DEPENDENT
          key: azcmagent.show.resourceGroup
          value_type: CHAR
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.resourceGroup
          master_item:
            key: azcmagent.show
          tags:
            - tag: application
              value: 'azure arc'
        - uuid: 54bf5bde0eaf42148b3837f3eace81af
          name: 'Resource ID'
          type: DEPENDENT
          key: azcmagent.show.resourceId
          value_type: CHAR
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.resourceId
          master_item:
            key: azcmagent.show
          tags:
            - tag: application
              value: 'azure arc'
        - uuid: a7b38e71233d4ab6b69192ce04e7a9c3
          name: Namespace
          type: DEPENDENT
          key: azcmagent.show.resourceNamespace
          value_type: CHAR
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.resourceNamespace
          master_item:
            key: azcmagent.show
          tags:
            - tag: application
              value: 'azure arc'
        - uuid: 16612a0e92a849388b2b38bd411bf838
          name: Status
          type: DEPENDENT
          key: azcmagent.show.status
          value_type: CHAR
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.status
          master_item:
            key: azcmagent.show
          tags:
            - tag: application
              value: 'azure arc'
        - uuid: e4b298d48cbd4d51bcc53227e2c9fcea
          name: 'Subscription ID'
          type: DEPENDENT
          key: azcmagent.show.subscriptionId
          value_type: CHAR
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.subscriptionId
          master_item:
            key: azcmagent.show
          tags:
            - tag: application
              value: 'azure arc'
        - uuid: 0a0d1e63df3d40a3b144fa7a59e04495
          name: 'Tenant ID'
          type: DEPENDENT
          key: azcmagent.show.tenantId
          value_type: CHAR
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.tenantId
          master_item:
            key: azcmagent.show
          tags:
            - tag: application
              value: 'azure arc'
        - uuid: d191ce1a98ef4cd3bf6f2fdbcd871813
          name: 'VM ID'
          type: DEPENDENT
          key: azcmagent.show.vmId
          value_type: CHAR
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.vmId
          master_item:
            key: azcmagent.show
          tags:
            - tag: application
              value: 'azure arc'
        - uuid: 43dc285d01dc49eba265bf252ae00d5b
          name: 'VM UUID'
          type: DEPENDENT
          key: azcmagent.show.vmUuid
          value_type: CHAR
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.vmUuid
          master_item:
            key: azcmagent.show
          tags:
            - tag: application
              value: 'azure arc'
        - uuid: 5aa70ec909a44d6c9bc1e37c0373b425
          name: 'extd: SE Linux Context'
          type: DEPENDENT
          key: extd.AccessSELinuxContext
          value_type: TEXT
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.AccessSELinuxContext
          master_item:
            key: 'systemd.unit.get[extd.service]'
          tags:
            - tag: application
              value: 'azure arc'
        - uuid: 064c81a64ad4447cb619e7c93716cd62
          name: 'extd: Active Timestamp'
          type: DEPENDENT
          key: extd.ActiveEnterTimestamp
          trends: '0'
          units: unixtime
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.ActiveEnterTimestamp
          master_item:
            key: 'systemd.unit.get[extd.service]'
          tags:
            - tag: application
              value: 'azure arc'
        - uuid: 76357670aac049178d35a102a37450b1
          name: 'extd: Active State'
          type: DEPENDENT
          key: extd.ActiveState.state
          value_type: TEXT
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.ActiveState.text
          master_item:
            key: 'systemd.unit.get[extd.service]'
          tags:
            - tag: application
              value: 'azure arc'
        - uuid: e6f1e12fb8eb4b8dabc8ae3484c55fdc
          name: 'extd: File Path'
          type: DEPENDENT
          key: extd.FragmentPath
          value_type: TEXT
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.FragmentPath
          master_item:
            key: 'systemd.unit.get[extd.service]'
          tags:
            - tag: application
              value: 'azure arc'
        - uuid: b934b99fa61546fab37f801736a7dcd7
          name: 'extd: Inactive Timestamp'
          type: DEPENDENT
          key: extd.InactiveExitTimestamp
          trends: '0'
          units: unixtime
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.InactiveExitTimestamp
          master_item:
            key: 'systemd.unit.get[extd.service]'
          tags:
            - tag: application
              value: 'azure arc'
        - uuid: f7c2ff781b53496ab0abd0e5e3542da4
          name: 'extd: Load State'
          type: DEPENDENT
          key: extd.LoadState.state
          value_type: TEXT
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.LoadState.text
          master_item:
            key: 'systemd.unit.get[extd.service]'
          tags:
            - tag: application
              value: 'azure arc'
        - uuid: 8c2b0e91e1e74053bed59c6a06babfde
          name: 'extd: Unit File State'
          type: DEPENDENT
          key: extd.UnitFileState.state
          value_type: TEXT
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.UnitFileState.text
          master_item:
            key: 'systemd.unit.get[extd.service]'
          tags:
            - tag: application
              value: 'azure arc'
        - uuid: 002e7f1400a34a7cb3b4594fc3866fa3
          name: 'gcad: SE Linux Context'
          type: DEPENDENT
          key: gcad.AccessSELinuxContext
          value_type: TEXT
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.AccessSELinuxContext
          master_item:
            key: 'systemd.unit.get[gcad.service]'
          tags:
            - tag: application
              value: 'azure arc'
        - uuid: 2aef678c183544c6b3b2201aa1f478e3
          name: 'gcad: Active Timestamp'
          type: DEPENDENT
          key: gcad.ActiveEnterTimestamp
          trends: '0'
          units: unixtime
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.ActiveEnterTimestamp
          master_item:
            key: 'systemd.unit.get[gcad.service]'
          tags:
            - tag: application
              value: 'azure arc'
        - uuid: ba415b5d08e3493394cf79275bdca853
          name: 'gcad: Active State'
          type: DEPENDENT
          key: gcad.ActiveState.state
          value_type: TEXT
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.ActiveState.text
          master_item:
            key: 'systemd.unit.get[gcad.service]'
          tags:
            - tag: application
              value: 'azure arc'
        - uuid: 7028eef5a2e0452cb0450673cfe14137
          name: 'gcad: File Path'
          type: DEPENDENT
          key: gcad.FragmentPath
          value_type: TEXT
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.FragmentPath
          master_item:
            key: 'systemd.unit.get[gcad.service]'
          tags:
            - tag: application
              value: 'azure arc'
        - uuid: 4c337847e1294285826b1fcaa51942a6
          name: 'gcad: Inactive Timestamp'
          type: DEPENDENT
          key: gcad.InactiveExitTimestamp
          trends: '0'
          units: unixtime
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.InactiveExitTimestamp
          master_item:
            key: 'systemd.unit.get[gcad.service]'
          tags:
            - tag: application
              value: 'azure arc'
        - uuid: e014f27c44914c09aa7a57ac78f95b8d
          name: 'gcad: Load State'
          type: DEPENDENT
          key: gcad.LoadState.state
          value_type: TEXT
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.LoadState.text
          master_item:
            key: 'systemd.unit.get[gcad.service]'
          tags:
            - tag: application
              value: 'azure arc'
        - uuid: b7fa6d80bf6041fcbc6bd3003a059846
          name: 'gcad: Unit File State'
          type: DEPENDENT
          key: gcad.UnitFileState.state
          value_type: TEXT
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.UnitFileState.text
          master_item:
            key: 'systemd.unit.get[gcad.service]'
          tags:
            - tag: application
              value: 'azure arc'
        - uuid: f7b6562403dd4f6e86c15efea6150ce5
          name: 'himdsd: SE Linux Context'
          type: DEPENDENT
          key: himdsd.AccessSELinuxContext
          value_type: TEXT
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.AccessSELinuxContext
          master_item:
            key: 'systemd.unit.get[himdsd.service]'
          tags:
            - tag: application
              value: 'azure arc'
        - uuid: f687448901944f9c97f35d03fbe66100
          name: 'himdsd: Active Timestamp'
          type: DEPENDENT
          key: himdsd.ActiveEnterTimestamp
          trends: '0'
          units: unixtime
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.ActiveEnterTimestamp
          master_item:
            key: 'systemd.unit.get[himdsd.service]'
          tags:
            - tag: application
              value: 'azure arc'
        - uuid: 691b6156146045b8b07f10065c550b77
          name: 'himdsd: Active State'
          type: DEPENDENT
          key: himdsd.ActiveState.state
          value_type: TEXT
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.ActiveState.text
          master_item:
            key: 'systemd.unit.get[himdsd.service]'
          tags:
            - tag: application
              value: 'azure arc'
        - uuid: 80511083cfe540898e22455c81b147b2
          name: 'himdsd: File Path'
          type: DEPENDENT
          key: himdsd.FragmentPath
          value_type: TEXT
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.FragmentPath
          master_item:
            key: 'systemd.unit.get[himdsd.service]'
          tags:
            - tag: application
              value: 'azure arc'
        - uuid: 4fca33d60c6440aea9df3038c5c1ca08
          name: 'himdsd: Inactive Timestamp'
          type: DEPENDENT
          key: himdsd.InactiveExitTimestamp
          trends: '0'
          units: unixtime
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.InactiveExitTimestamp
          master_item:
            key: 'systemd.unit.get[himdsd.service]'
          tags:
            - tag: application
              value: 'azure arc'
        - uuid: fd488cdb6bad48b8ae9a63ea51ed6b93
          name: 'himdsd: Load State'
          type: DEPENDENT
          key: himdsd.LoadState.state
          value_type: TEXT
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.LoadState.text
          master_item:
            key: 'systemd.unit.get[himdsd.service]'
          tags:
            - tag: application
              value: 'azure arc'
        - uuid: ee2c8eaeca944c72b67171e42da2b8d0
          name: 'himdsd: Unit File State'
          type: DEPENDENT
          key: himdsd.UnitFileState.state
          value_type: TEXT
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.UnitFileState.text
          master_item:
            key: 'systemd.unit.get[himdsd.service]'
          tags:
            - tag: application
              value: 'azure arc'
        - uuid: 9d170f640aa84bb8b526907deb583a1b
          name: 'Retrieve Extension Daemon Information'
          type: ZABBIX_ACTIVE
          key: 'systemd.unit.get[extd.service]'
          history: '0'
          value_type: TEXT
          tags:
            - tag: application
              value: 'azure arc'
        - uuid: 910661d86b514251a70a76ebe5b07cc3
          name: 'Retrieve GC Arc Daemon Information'
          type: ZABBIX_ACTIVE
          key: 'systemd.unit.get[gcad.service]'
          history: '0'
          value_type: TEXT
          tags:
            - tag: application
              value: 'azure arc'
        - uuid: 77fd8aa8bc034755b8a82b3a55ad0d48
          name: 'Retrieve Azure Arc Daemon Information'
          type: ZABBIX_ACTIVE
          key: 'systemd.unit.get[himdsd.service]'
          history: '0'
          value_type: TEXT
          tags:
            - tag: application
              value: 'azure arc'
      discovery_rules:
        - uuid: 1c398727732f486e876bb06e3385ddec
          name: 'Discover Azure Arc Endpoints'
          type: DEPENDENT
          key: azcmagent.check.discover
          lifetime: 1h
          item_prototypes:
            - uuid: afc93c5116d2473bb9869b050e3deb3c
              name: '{#HOSTNAME}: Error'
              type: DEPENDENT
              key: 'azcmagent.check.discover.error[{#HOSTNAME}]'
              value_type: CHAR
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$[?(@.hostname == ''{#HOSTNAME}'')].error.first()'
              master_item:
                key: azcmagent.check
              tags:
                - tag: application
                  value: 'azure arc'
                - tag: discovery
                  value: enabled
            - uuid: 69e8f4f5669841f7b1357172de28b4cf
              name: '{#HOSTNAME}: Legacy'
              type: DEPENDENT
              key: 'azcmagent.check.discover.legacy[{#HOSTNAME}]'
              value_type: CHAR
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$[?(@.hostname == ''{#HOSTNAME}'')].legacy.first()'
              master_item:
                key: azcmagent.check
              tags:
                - tag: application
                  value: 'azure arc'
                - tag: discovery
                  value: enabled
            - uuid: a9a0c44df2634faeb0cbe0e7cec76e57
              name: '{#HOSTNAME}: Private'
              type: DEPENDENT
              key: 'azcmagent.check.discover.private[{#HOSTNAME}]'
              value_type: CHAR
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$[?(@.hostname == ''{#HOSTNAME}'')].private.first()'
              master_item:
                key: azcmagent.check
              tags:
                - tag: application
                  value: 'azure arc'
                - tag: discovery
                  value: enabled
            - uuid: 27e73d1f733643c3bb99cef74d7cbc10
              name: '{#HOSTNAME}: Proxy Status'
              type: DEPENDENT
              key: 'azcmagent.check.discover.proxyStatus[{#HOSTNAME}]'
              value_type: CHAR
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$[?(@.hostname == ''{#HOSTNAME}'')].proxyStatus.first()'
              master_item:
                key: azcmagent.check
              tags:
                - tag: application
                  value: 'azure arc'
                - tag: discovery
                  value: enabled
            - uuid: e06fd90fe10d4c87b8539bc637ed3d6a
              name: '{#HOSTNAME}: Reachable'
              type: DEPENDENT
              key: 'azcmagent.check.discover.reachable[{#HOSTNAME}]'
              value_type: CHAR
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$[?(@.hostname == ''{#HOSTNAME}'')].reachable.first()'
              master_item:
                key: azcmagent.check
              tags:
                - tag: application
                  value: 'azure arc'
                - tag: discovery
                  value: enabled
            - uuid: 930cf9a7359b483a98f0362298c6149d
              name: '{#HOSTNAME}: TLS'
              type: DEPENDENT
              key: 'azcmagent.check.discover.tls[{#HOSTNAME}]'
              value_type: CHAR
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$[?(@.hostname == ''{#HOSTNAME}'')].tls.first()'
              master_item:
                key: azcmagent.check
              tags:
                - tag: application
                  value: 'azure arc'
                - tag: discovery
                  value: enabled
            - uuid: 6d6da836d5504f17ab819a7385ecfe5b
              name: '{#HOSTNAME}: Use Case'
              type: DEPENDENT
              key: 'azcmagent.check.discover.useCase[{#HOSTNAME}]'
              value_type: CHAR
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$[?(@.hostname == ''{#HOSTNAME}'')].useCase.first()'
              master_item:
                key: azcmagent.check
              tags:
                - tag: application
                  value: 'azure arc'
                - tag: discovery
                  value: enabled
          master_item:
            key: azcmagent.check
          lld_macro_paths:
            - lld_macro: '{#HOSTNAME}'
              path: $.hostname
