zabbix_export:
  version: '8.0'
  template_groups:
    - uuid: a571c0d144b14fd4a87a9d9b2aa9fcd6
      name: Templates/Applications
    - uuid: 748ad4d098d447d492bb935c907f652f
      name: Templates/Databases
    - uuid: 36bff6c29af64692839d077febfc7079
      name: 'Templates/Network devices'
    - uuid: 846977d1dfed4968bc5f8bdb363285bc
      name: 'Templates/Operating systems'
  host_groups:
    - uuid: a571c0d144b14fd4a87a9d9b2aa9fcd6
      name: Applications
  templates:
    - uuid: 95f2053c21094ad4968440b562cc7ea2
      template: 'ClickHouse by HTTP'
      name: 'ClickHouse by HTTP'
      description: |
        This template is designed for the effortless deployment of ClickHouse monitoring by Zabbix via HTTP and doesn't require any external scripts.
        
        Setup:
        
        1. Create a user to monitor the service. For example, you could create a file '/etc/clickhouse-server/users.d/zabbix.xml' with the following content:
        
        <yandex>
          <users>
            <zabbix>
              <password>zabbix_pass</password>
              <networks incl="networks" />
              <profile>web</profile>
              <quota>default</quota>
              <allow_databases>
                <database>test</database>
              </allow_databases>
            </zabbix>
          </users>
        </yandex>
        
        2. Set the hostname or IP address of the ClickHouse HTTP endpoint in the '{$CLICKHOUSE.HOST}' macro. You can also change the port in the '{$CLICKHOUSE.PORT}' macro and scheme in the '{$CLICKHOUSE.SCHEME}' macro if necessary.
        
        3. Set the login and password in the macros '{$CLICKHOUSE.USER}' and '{$CLICKHOUSE.PASSWORD}'. If you don't need an authentication - remove headers from HTTP-Agent type items.
        
        Generated by official Zabbix template tool "Templator"
      wizard_ready: 'YES'
      readme: |
        ## Overview
        
        This template is designed for the effortless deployment of ClickHouse monitoring by Zabbix via HTTP and doesn't require any external scripts.
        
        ## Setup
        
        1. Create a user to monitor the service. For example, you could create a file `/etc/clickhouse-server/users.d/zabbix.xml` with the following content:
        
        ```
        <yandex>
          <users>
            <zabbix>
              <password>zabbix_pass</password>
              <networks incl="networks" />
              <profile>web</profile>
              <quota>default</quota>
              <allow_databases>
                <database>test</database>
              </allow_databases>
            </zabbix>
          </users>
        </yandex>
        ```
        
        2. Set the hostname or IP address of the ClickHouse HTTP endpoint in the `ClickHouse host` host wizard configuration field. You can also change the port in the `ClickHouse port` and scheme in the `ClickHouse scheme` if necessary.
        
        3. Set the login and password in the host wizard configuration fields `Username` and `Password`. If you don't need an authentication - remove headers from HTTP-Agent type items.
      vendor:
        name: Zabbix
        version: 8.0-1
      groups:
        - name: Templates/Databases
      items:
        - uuid: 595446e408b844519e8db1ea91543134
          name: 'Current distribute connections'
          type: DEPENDENT
          key: clickhouse.connections.distribute
          description: 'Number of connections to remote servers sending data that was INSERTed into Distributed tables.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$[?(@.metric == "DistributedSend")].value.first()'
          master_item:
            key: clickhouse.system.metrics
          tags:
            - tag: component
              value: connections
        - uuid: d2d72a607672442b957228f0bea8dcca
          name: 'Current HTTP connections'
          type: DEPENDENT
          key: clickhouse.connections.http
          description: 'Number of connections to HTTP server.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$[?(@.metric == "HTTPConnection")].value.first()'
          master_item:
            key: clickhouse.system.metrics
          tags:
            - tag: component
              value: connections
        - uuid: 0829591332244c75a219f3b811ebf9ce
          name: 'Current Interserver connections'
          type: DEPENDENT
          key: clickhouse.connections.interserver
          description: 'Number of connections from other replicas to fetch parts.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$[?(@.metric == "InterserverConnection")].value.first()'
          master_item:
            key: clickhouse.system.metrics
          tags:
            - tag: component
              value: connections
        - uuid: 88d4855d22604d79927d40c0d3b106c5
          name: 'Current MySQL connections'
          type: DEPENDENT
          key: clickhouse.connections.mysql
          description: 'Number of connections to MySQL server.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$[?(@.metric == "MySQLConnection")].value.first()'
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
          master_item:
            key: clickhouse.system.metrics
          tags:
            - tag: component
              value: connections
        - uuid: 11786fff830d4d79b914a22c5f85da7f
          name: 'Current TCP connections'
          type: DEPENDENT
          key: clickhouse.connections.tcp
          description: 'Number of connections to TCP server (clients with native interface).'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$[?(@.metric == "TCPConnection")].value.first()'
          master_item:
            key: clickhouse.system.metrics
          tags:
            - tag: component
              value: connections
        - uuid: b2341064c7624848bfcac198d3b5ffa9
          name: 'Get databases info'
          type: HTTP_AGENT
          key: clickhouse.databases
          history: '0'
          value_type: TEXT
          description: 'Get information about databases.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.data
          url: '{$CLICKHOUSE.SCHEME}://{$CLICKHOUSE.HOST}:{$CLICKHOUSE.PORT}/'
          query_fields:
            - name: query
              value: 'select database, sum(bytes) as bytes, count(distinct table) as tables, sum(rows) as rows from system.parts where active = 1 group by database format JSON'
          headers:
            - name: X-ClickHouse-User
              value: '{$CLICKHOUSE.USER}'
            - name: X-ClickHouse-Key
              value: '{$CLICKHOUSE.PASSWORD}'
          tags:
            - tag: component
              value: databases
            - tag: component
              value: raw
        - uuid: 46d8ed7374274d71a06119f50463f26c
          name: 'Get dictionaries info'
          type: HTTP_AGENT
          key: clickhouse.dictionaries
          history: '0'
          value_type: TEXT
          description: 'Get information about dictionaries.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.data
          url: '{$CLICKHOUSE.SCHEME}://{$CLICKHOUSE.HOST}:{$CLICKHOUSE.PORT}/'
          query_fields:
            - name: query
              value: 'SELECT * FROM system.dictionaries format JSON'
          headers:
            - name: X-ClickHouse-User
              value: '{$CLICKHOUSE.USER}'
            - name: X-ClickHouse-Key
              value: '{$CLICKHOUSE.PASSWORD}'
          tags:
            - tag: component
              value: dictionaries
            - tag: component
              value: raw
        - uuid: b7bbca72bbd14b20930e60c3c1cdcb8e
          name: 'Current distributed files to insert'
          type: DEPENDENT
          key: clickhouse.distributed.files
          description: 'Number of pending files to process for asynchronous insertion into Distributed tables. Number of files for every shard is summed.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$[?(@.metric == "DistributedFilesToInsert")].value.first()'
          master_item:
            key: clickhouse.system.metrics
          tags:
            - tag: component
              value: system
          triggers:
            - uuid: 4ecadb993aa74126a807df3af4b892ed
              expression: 'min(/ClickHouse by HTTP/clickhouse.distributed.files,5m)>{$CLICKHOUSE.DELAYED.FILES.DISTRIBUTED.COUNT.MAX.WARN}'
              name: 'ClickHouse: Too many distributed files to insert'
              event_name: 'ClickHouse: Too many distributed files to insert (over {$CLICKHOUSE.DELAYED.FILES.DISTRIBUTED.COUNT.MAX.WARN} for 5 min)'
              priority: WARNING
              description: 'Clickhouse servers and <remote_servers> in config.xml (https://clickhouse.tech/docs/en/operations/table_engines/distributed/)'
              manual_close: 'YES'
              tags:
                - tag: scope
                  value: capacity
        - uuid: e056f8519dec4c8dace036bf993a6d47
          name: 'Distributed connection fail with retry per second'
          type: DEPENDENT
          key: clickhouse.distributed.files.fail.rate
          value_type: FLOAT
          description: 'Connection failures after all retries in replicated DB connection pool'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$[?(@.metric == "DistributedConnectionFailAtAll")].value.first()'
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
            - type: CHANGE_PER_SECOND
          master_item:
            key: clickhouse.system.events
          tags:
            - tag: component
              value: connections
        - uuid: 3859c5ee6f25419f9da7e7899c9a71af
          name: 'Distributed connection fail with retry per second'
          type: DEPENDENT
          key: clickhouse.distributed.files.retry.rate
          value_type: FLOAT
          description: 'Connection retries in replicated DB connection pool'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$[?(@.metric == "DistributedConnectionFailTry")].value.first()'
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
            - type: CHANGE_PER_SECOND
          master_item:
            key: clickhouse.system.events
          tags:
            - tag: component
              value: connections
        - uuid: 81130b88e0b04b9ea677a80b6fd6ce22
          name: 'Delayed insert queries'
          type: DEPENDENT
          key: clickhouse.insert.delay
          value_type: FLOAT
          description: 'Number of INSERT queries that are throttled due to high number of active data parts for partition in a MergeTree table.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$[?(@.metric == "DelayedInserts")].value.first()'
          master_item:
            key: clickhouse.system.metrics
          tags:
            - tag: component
              value: queries
          triggers:
            - uuid: 164dc9841cdd4b77a650792cf1bac701
              expression: 'min(/ClickHouse by HTTP/clickhouse.insert.delay,5m)>{$CLICKHOUSE.DELAYED.INSERTS.MAX.WARN}'
              name: 'ClickHouse: Too many throttled insert queries'
              event_name: 'ClickHouse: Too many throttled insert queries (over {$CLICKHOUSE.DELAYED.INSERTS.MAX.WARN) for 5 min)'
              priority: WARNING
              description: 'Clickhouse have INSERT queries that are throttled due to high number of active data parts for partition in a MergeTree, please decrease INSERT frequency'
              manual_close: 'YES'
              tags:
                - tag: scope
                  value: performance
        - uuid: e2477dd38510489c8ea7509e9a37cb50
          name: 'Inserted bytes per second'
          type: DEPENDENT
          key: clickhouse.inserted_bytes.rate
          value_type: FLOAT
          units: Bps
          description: 'The number of uncompressed bytes inserted in all tables.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$[?(@.event == "InsertedBytes")].value.first()'
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
            - type: CHANGE_PER_SECOND
          master_item:
            key: clickhouse.system.events
          tags:
            - tag: component
              value: network
        - uuid: e09cfd7db8be48a485bda8c5f033d210
          name: 'Inserted rows per second'
          type: DEPENDENT
          key: clickhouse.inserted_rows.rate
          value_type: FLOAT
          description: 'The number of rows inserted in all tables.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$[?(@.event == "InsertedRows")].value.first()'
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
            - type: CHANGE_PER_SECOND
          master_item:
            key: clickhouse.system.events
          tags:
            - tag: component
              value: system
        - uuid: 410f7ee66ee84e3eb27940312ddf23d2
          name: 'New INSERT queries per second'
          type: DEPENDENT
          key: clickhouse.insert_query.rate
          value_type: FLOAT
          description: 'Number of INSERT queries to be interpreted and potentially executed. Does not include queries that failed to parse or were rejected due to AST size limits, quota limits or limits on the number of simultaneously running queries. May include internal queries initiated by ClickHouse itself. Does not count subqueries.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$[?(@.event == "InsertQuery")].value.first()'
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
            - type: CHANGE_PER_SECOND
          master_item:
            key: clickhouse.system.events
          tags:
            - tag: component
              value: queries
        - uuid: 04c970694a6f40c89e4d3b53f27b7530
          name: 'Allocated bytes'
          type: DEPENDENT
          key: clickhouse.jemalloc.allocated
          units: B
          description: 'Total number of bytes allocated by the application.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$[?(@.metric == "jemalloc.allocated")].value.first()'
          master_item:
            key: clickhouse.system.asynchronous_metrics
          tags:
            - tag: component
              value: memory
        - uuid: 7aa71031aec74fbb9a2ec126076705a2
          name: 'Mapped memory'
          type: DEPENDENT
          key: clickhouse.jemalloc.mapped
          units: B
          description: 'Total number of bytes in active extents mapped by the allocator.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$[?(@.metric == "jemalloc.mapped")].value.first()'
          master_item:
            key: clickhouse.system.asynchronous_metrics
          tags:
            - tag: component
              value: memory
        - uuid: 32cc450854e94c6a9adbdde3c76b94d7
          name: 'Resident memory'
          type: DEPENDENT
          key: clickhouse.jemalloc.resident
          units: B
          description: |
            Maximum number of bytes in physically resident data pages mapped by the allocator,
            comprising all pages dedicated to allocator metadata, pages backing active allocations,
            and unused dirty pages.
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$[?(@.metric == "jemalloc.resident")].value.first()'
          master_item:
            key: clickhouse.system.asynchronous_metrics
          tags:
            - tag: component
              value: memory
        - uuid: c99265c296f14189aaf65bf68b7d5037
          name: 'Max count of parts per partition across all tables'
          type: DEPENDENT
          key: clickhouse.max.part.count.for.partition
          description: 'Clickhouse MergeTree table engine split each INSERT query to partitions (PARTITION BY expression) and add one or more PARTS per INSERT inside each partition, after that background merge process run.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$[?(@.metric == "MaxPartCountForPartition")].value.first()'
          master_item:
            key: clickhouse.system.asynchronous_metrics
          tags:
            - tag: component
              value: system
          triggers:
            - uuid: 21e6d3c6047145c59cbd00032699ee99
              expression: 'min(/ClickHouse by HTTP/clickhouse.max.part.count.for.partition,5m)>{$CLICKHOUSE.PARTS.PER.PARTITION.WARN} * 0.9'
              name: 'ClickHouse: Too many MergeTree parts'
              event_name: 'ClickHouse: Too many MergeTree parts (over 90% of {$CLICKHOUSE.PARTS.PER.PARTITION.WARN})'
              priority: WARNING
              description: |
                Descease INSERT queries frequency.
                Clickhouse MergeTree table engine split each INSERT query to partitions (PARTITION BY expression)
                and add one or more PARTS per INSERT inside each partition,
                after that background merge process run, and when you have too much unmerged parts inside partition,
                SELECT queries performance can significate degrade, so clickhouse try delay insert, or abort it.
              manual_close: 'YES'
              tags:
                - tag: scope
                  value: performance
        - uuid: a4344162643142c9be3b09439b466a5d
          name: 'Memory used for queries'
          type: DEPENDENT
          key: clickhouse.memory.tracking
          value_type: FLOAT
          units: B
          description: 'Total amount of memory (bytes) allocated in currently executing queries.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$[?(@.metric == "MemoryTracking")].value.first()'
          master_item:
            key: clickhouse.system.metrics
          tags:
            - tag: component
              value: memory
        - uuid: 921670c46d9a4e5b85f2049d64298ab4
          name: 'Memory used for background merges'
          type: DEPENDENT
          key: clickhouse.memory.tracking.background
          value_type: FLOAT
          units: B
          description: |
            Total amount of memory (bytes) allocated in background processing pool (that is dedicated for background merges, mutations and fetches).
             Note that this value may include a drift when the memory was allocated in a context of background processing pool and freed in other context or vice-versa. This happens naturally due to caches for tables indexes and doesn't indicate memory leaks.
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$[?(@.metric == "MemoryTrackingInBackgroundProcessingPool")].value.first()'
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
          master_item:
            key: clickhouse.system.metrics
          tags:
            - tag: component
              value: memory
        - uuid: f881ea3cb2a2434d9cfac0d0896279f5
          name: 'Memory used for background moves'
          type: DEPENDENT
          key: clickhouse.memory.tracking.background.moves
          value_type: FLOAT
          units: B
          description: |
            Total amount of memory (bytes) allocated in background processing pool (that is dedicated for background moves). Note that this value may include a drift when the memory was allocated in a context of background processing pool and freed in other context or vice-versa.
             This happens naturally due to caches for tables indexes and doesn't indicate memory leaks.
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$[?(@.metric == "MemoryTrackingInBackgroundMoveProcessingPool")].value.first()'
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
          master_item:
            key: clickhouse.system.metrics
          tags:
            - tag: component
              value: memory
        - uuid: 3cd23448136c4ea8892483b1fbacec82
          name: 'Memory used for merges'
          type: DEPENDENT
          key: clickhouse.memory.tracking.merges
          value_type: FLOAT
          units: B
          description: |
            Total amount of memory (bytes) allocated for background merges. Included in MemoryTrackingInBackgroundProcessingPool. Note that this value may include a drift when the memory was allocated in a context of background processing pool and freed in other context or vice-versa.
            This happens naturally due to caches for tables indexes and doesn't indicate memory leaks.
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$[?(@.metric == "MemoryTrackingForMerges")].value.first()'
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
          master_item:
            key: clickhouse.system.metrics
          tags:
            - tag: component
              value: memory
        - uuid: 1f4641ef040546e0afcccc818f4d3471
          name: 'Memory used for background schedule pool'
          type: DEPENDENT
          key: clickhouse.memory.tracking.schedule.pool
          value_type: FLOAT
          units: B
          description: 'Total amount of memory (bytes) allocated in background schedule pool (that is dedicated for bookkeeping tasks of Replicated tables).'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$[?(@.metric == "MemoryTrackingInBackgroundSchedulePool")].value.first()'
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
          master_item:
            key: clickhouse.system.metrics
          tags:
            - tag: component
              value: memory
        - uuid: 5e98b9c4f1ee42238f363d76354ef537
          name: 'Current running merges'
          type: DEPENDENT
          key: clickhouse.merge.current
          description: 'Number of executing background merges'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$[?(@.metric == "Merge")].value.first()'
          master_item:
            key: clickhouse.system.metrics
          tags:
            - tag: component
              value: queries
        - uuid: 50e33e8fc1904870bdc6d7f13d16943d
          name: 'Uncompressed bytes merged per second'
          type: DEPENDENT
          key: clickhouse.merge_bytes.rate
          value_type: FLOAT
          units: Bps
          description: 'Uncompressed bytes that were read for background merges'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$[?(@.event == "MergedUncompressedBytes")].value.first()'
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
            - type: CHANGE_PER_SECOND
          master_item:
            key: clickhouse.system.events
          tags:
            - tag: component
              value: system
        - uuid: a2afbf66601344bdb5ab72a7374bbe8b
          name: 'Merged rows per second'
          type: DEPENDENT
          key: clickhouse.merge_rows.rate
          value_type: FLOAT
          description: 'Rows read for background merges.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$[?(@.event == "MergedRows")].value.first()'
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
            - type: CHANGE_PER_SECOND
          master_item:
            key: clickhouse.system.events
          tags:
            - tag: component
              value: system
        - uuid: 83061f56dce24364906cae761419b148
          name: 'Network errors per second'
          type: DEPENDENT
          key: clickhouse.network.error.rate
          value_type: FLOAT
          description: 'Network errors (timeouts and connection failures) during query execution, background pool tasks and DNS cache update.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$[?(@.event == "NetworkErrors")].value.first()'
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
            - type: CHANGE_PER_SECOND
          master_item:
            key: clickhouse.system.events
          tags:
            - tag: component
              value: network
          triggers:
            - uuid: d49b9e8978bd416f81ea01b935879d81
              expression: 'min(/ClickHouse by HTTP/clickhouse.network.error.rate,5m)>{$CLICKHOUSE.NETWORK.ERRORS.MAX.WARN}'
              name: 'ClickHouse: Too many network errors'
              event_name: 'ClickHouse: Too many network errors (over {$CLICKHOUSE.NETWORK.ERRORS.MAX.WARN} in 5m)'
              priority: WARNING
              description: 'Number of errors (timeouts and connection failures) during query execution, background pool tasks and DNS cache update is too high.'
              tags:
                - tag: scope
                  value: availability
        - uuid: cb40b0cf1296436d9a4e41062d1b3fa9
          name: Ping
          type: HTTP_AGENT
          key: clickhouse.ping
          valuemap:
            name: 'Service state'
          preprocessing:
            - type: REGEX
              parameters:
                - Ok\.
                - '1'
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 10m
          url: '{$CLICKHOUSE.SCHEME}://{$CLICKHOUSE.HOST}:{$CLICKHOUSE.PORT}/ping'
          status_codes: ''
          tags:
            - tag: component
              value: health
            - tag: component
              value: network
        - uuid: 4fb14efc757542c1b50605bdfb2e23cb
          name: 'Longest currently running query time'
          type: HTTP_AGENT
          key: clickhouse.process.elapsed
          value_type: FLOAT
          units: s
          description: 'Get longest running query.'
          url: '{$CLICKHOUSE.SCHEME}://{$CLICKHOUSE.HOST}:{$CLICKHOUSE.PORT}/'
          query_fields:
            - name: query
              value: 'SELECT max(elapsed) FROM system.processes'
          headers:
            - name: X-ClickHouse-User
              value: '{$CLICKHOUSE.USER}'
            - name: X-ClickHouse-Key
              value: '{$CLICKHOUSE.PASSWORD}'
          tags:
            - tag: component
              value: queries
          triggers:
            - uuid: 2410e7b63c8340b6b08ec729d7093be6
              expression: 'last(/ClickHouse by HTTP/clickhouse.process.elapsed)>{$CLICKHOUSE.QUERY_TIME.MAX.WARN}'
              name: 'ClickHouse: There are queries running is long'
              event_name: 'ClickHouse: There are queries running more than {$CLICKHOUSE.QUERY_TIME.MAX.WARN} seconds'
              priority: AVERAGE
              manual_close: 'YES'
              tags:
                - tag: scope
                  value: performance
        - uuid: 071ae233708b417b97cfeced5021c139
          name: 'Current running queries'
          type: DEPENDENT
          key: clickhouse.query.current
          description: 'Number of executing queries'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$[?(@.metric == "Query")].value.first()'
          master_item:
            key: clickhouse.system.metrics
          tags:
            - tag: component
              value: queries
        - uuid: 0fb342f6a494443c8389f79439e94791
          name: 'New queries per second'
          type: DEPENDENT
          key: clickhouse.query.rate
          value_type: FLOAT
          description: 'Number of queries to be interpreted and potentially executed. Does not include queries that failed to parse or were rejected due to AST size limits, quota limits or limits on the number of simultaneously running queries. May include internal queries initiated by ClickHouse itself. Does not count subqueries.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$[?(@.data.event == "Query")].value.first()'
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
            - type: CHANGE_PER_SECOND
          master_item:
            key: clickhouse.system.events
          tags:
            - tag: component
              value: queries
        - uuid: fb671accbbaa4bd58a107dc3661419af
          name: 'Read syscalls in fly'
          type: DEPENDENT
          key: clickhouse.read
          description: 'Number of read (read, pread, io_getevents, etc.) syscalls in fly'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$[?(@.metric == "Read")].value.first()'
          master_item:
            key: clickhouse.system.metrics
          tags:
            - tag: component
              value: system
        - uuid: eb4c47501d9c4cdf9e55347ccc9a38bd
          name: 'Read bytes per second'
          type: DEPENDENT
          key: clickhouse.read_bytes.rate
          value_type: FLOAT
          units: Bps
          description: 'Number of bytes (the number of bytes before decompression) read from compressed sources (files, network).'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$[?(@.event == "ReadCompressedBytes")].value.first()'
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
            - type: CHANGE_PER_SECOND
          master_item:
            key: clickhouse.system.events
          tags:
            - tag: component
              value: network
        - uuid: 3793962be3494772832796c932947e1d
          name: 'Get replicas info'
          type: HTTP_AGENT
          key: clickhouse.replicas
          history: '0'
          value_type: TEXT
          description: 'Get information about replicas.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.data
          url: '{$CLICKHOUSE.SCHEME}://{$CLICKHOUSE.HOST}:{$CLICKHOUSE.PORT}/'
          query_fields:
            - name: query
              value: 'SELECT database, table, is_readonly, is_session_expired, future_parts, parts_to_check, queue_size, inserts_in_queue, merges_in_queue, log_max_index, log_pointer, total_replicas, active_replicas, log_max_index - log_pointer as replica_lag FROM system.replicas format JSON'
          headers:
            - name: X-ClickHouse-User
              value: '{$CLICKHOUSE.USER}'
            - name: X-ClickHouse-Key
              value: '{$CLICKHOUSE.PASSWORD}'
          tags:
            - tag: component
              value: raw
            - tag: component
              value: replicas
        - uuid: 78ed9728eb634df1807c64637c862f9a
          name: 'Replication lag across all tables'
          type: DEPENDENT
          key: clickhouse.replicas.max.absolute.delay
          units: s
          description: 'Maximum replica queue delay relative to current time'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$[?(@.metric == "ReplicasMaxAbsoluteDelay")].value.first()'
          master_item:
            key: clickhouse.system.asynchronous_metrics
          tags:
            - tag: component
              value: replication
          triggers:
            - uuid: fc47a407b15744e79b70088ec249951a
              expression: 'min(/ClickHouse by HTTP/clickhouse.replicas.max.absolute.delay,5m)>{$CLICKHOUSE.REPLICA.MAX.WARN}'
              name: 'ClickHouse: Replication lag is too high'
              event_name: 'ClickHouse: Replication lag is too high (over {$CLICKHOUSE.REPLICA.MAX.WARN} sec for 5min)'
              priority: WARNING
              description: |
                When replica have too much lag, it can be skipped from Distributed SELECT Queries without errors
                and you will have wrong query results.
              manual_close: 'YES'
              tags:
                - tag: scope
                  value: performance
        - uuid: dd61675348374d2ea06cdde144fe4e26
          name: 'Total number read-only Replicas'
          type: DEPENDENT
          key: clickhouse.replicas.readonly.total
          description: 'Number of Replicated tables that are currently in readonly state due to re-initialization after ZooKeeper session loss or due to startup without ZooKeeper configured.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$[?(@.metric == "ReadonlyReplica")].value.first()'
          master_item:
            key: clickhouse.system.metrics
          tags:
            - tag: component
              value: replication
        - uuid: 5d2a35daf81a49888e3dfab916fab8be
          name: 'Total replication tasks in queue'
          type: DEPENDENT
          key: clickhouse.replicas.sum.queue.size
          description: 'Number of replication tasks in queue'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$[?(@.metric == "ReplicasSumQueueSize")].value.first()'
          master_item:
            key: clickhouse.system.asynchronous_metrics
          tags:
            - tag: component
              value: replication
        - uuid: 572036e5b2c74197bd61afc753f6e759
          name: Revision
          type: DEPENDENT
          key: clickhouse.revision
          description: 'Revision of the server.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$[?(@.metric == "Revision")].value.first()'
          master_item:
            key: clickhouse.system.metrics
          tags:
            - tag: component
              value: application
        - uuid: f89f3e27ca4f4e109ae6fe6b74dcc2ca
          name: 'New SELECT queries per second'
          type: DEPENDENT
          key: clickhouse.select_query.rate
          value_type: FLOAT
          description: 'Number of SELECT queries to be interpreted and potentially executed. Does not include queries that failed to parse or were rejected due to AST size limits, quota limits or limits on the number of simultaneously running queries. May include internal queries initiated by ClickHouse itself. Does not count subqueries.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$[?(@.event == "SelectQuery")].value.first()'
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
            - type: CHANGE_PER_SECOND
          master_item:
            key: clickhouse.system.events
          tags:
            - tag: component
              value: queries
        - uuid: 6c84e0abd186467882d2d3842749f937
          name: 'Get system.asynchronous_metrics'
          type: HTTP_AGENT
          key: clickhouse.system.asynchronous_metrics
          history: '0'
          value_type: TEXT
          description: 'Get metrics that are calculated periodically in the background'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.data
          url: '{$CLICKHOUSE.SCHEME}://{$CLICKHOUSE.HOST}:{$CLICKHOUSE.PORT}/'
          query_fields:
            - name: query
              value: 'select metric, value from system.asynchronous_metrics format JSON'
          headers:
            - name: X-ClickHouse-User
              value: '{$CLICKHOUSE.USER}'
            - name: X-ClickHouse-Key
              value: '{$CLICKHOUSE.PASSWORD}'
          tags:
            - tag: component
              value: asynchronous-metrics
            - tag: component
              value: raw
        - uuid: 8aa612d27547446e9457aeaf6e94e320
          name: 'Get system.events'
          type: HTTP_AGENT
          key: clickhouse.system.events
          history: '0'
          value_type: TEXT
          description: 'Get information about the number of events that have occurred in the system.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.data
          url: '{$CLICKHOUSE.SCHEME}://{$CLICKHOUSE.HOST}:{$CLICKHOUSE.PORT}/'
          query_fields:
            - name: query
              value: 'select event, value from system.events format JSON'
          headers:
            - name: X-ClickHouse-User
              value: '{$CLICKHOUSE.USER}'
            - name: X-ClickHouse-Key
              value: '{$CLICKHOUSE.PASSWORD}'
          tags:
            - tag: component
              value: raw
            - tag: component
              value: system-events
        - uuid: 2193464b67724392905deef21f2f7c20
          name: 'Get system.metrics'
          type: HTTP_AGENT
          key: clickhouse.system.metrics
          history: '0'
          value_type: TEXT
          description: 'Get metrics which can be calculated instantly, or have a current value format JSONEachRow'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.data
          url: '{$CLICKHOUSE.SCHEME}://{$CLICKHOUSE.HOST}:{$CLICKHOUSE.PORT}/'
          query_fields:
            - name: query
              value: 'select metric, value from system.metrics format JSON'
          headers:
            - name: X-ClickHouse-User
              value: '{$CLICKHOUSE.USER}'
            - name: X-ClickHouse-Key
              value: '{$CLICKHOUSE.PASSWORD}'
          tags:
            - tag: component
              value: raw
            - tag: component
              value: system-metrics
        - uuid: 88c843c6d4fd43c794d1447109146312
          name: 'Get system.settings'
          type: HTTP_AGENT
          key: clickhouse.system.settings
          history: '0'
          value_type: TEXT
          description: 'Get information about settings that are currently in use.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.data
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          url: '{$CLICKHOUSE.SCHEME}://{$CLICKHOUSE.HOST}:{$CLICKHOUSE.PORT}/'
          query_fields:
            - name: query
              value: 'select name, value from system.settings format JSON'
          headers:
            - name: X-ClickHouse-User
              value: '{$CLICKHOUSE.USER}'
            - name: X-ClickHouse-Key
              value: '{$CLICKHOUSE.PASSWORD}'
          tags:
            - tag: component
              value: raw
            - tag: component
              value: system-settings
          triggers:
            - uuid: dfd9500636824ebf9d51d93650d62613
              expression: 'last(/ClickHouse by HTTP/clickhouse.system.settings,#1)<>last(/ClickHouse by HTTP/clickhouse.system.settings,#2) and length(last(/ClickHouse by HTTP/clickhouse.system.settings))>0'
              name: 'ClickHouse: Configuration has been changed'
              event_name: 'ClickHouse: Version has changed (new version: {ITEM.VALUE})'
              priority: INFO
              description: 'ClickHouse configuration has been changed. Acknowledge to close the problem manually.'
              manual_close: 'YES'
              tags:
                - tag: scope
                  value: notice
        - uuid: 042f4b688cfe488fbd0e80f40f51ce78
          name: 'Get tables info'
          type: HTTP_AGENT
          key: clickhouse.tables
          history: '0'
          value_type: TEXT
          description: 'Get information about tables.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.data
          url: '{$CLICKHOUSE.SCHEME}://{$CLICKHOUSE.HOST}:{$CLICKHOUSE.PORT}/'
          query_fields:
            - name: query
              value: 'select database, table, sum(bytes) as bytes, count() as parts, sum(rows) as rows from system.parts where active = 1 group by database, table format JSON'
          headers:
            - name: X-ClickHouse-User
              value: '{$CLICKHOUSE.USER}'
            - name: X-ClickHouse-Key
              value: '{$CLICKHOUSE.PASSWORD}'
          tags:
            - tag: component
              value: raw
            - tag: component
              value: tables
        - uuid: 99b894b181b44a4f8ef10280b881b273
          name: Uptime
          type: DEPENDENT
          key: clickhouse.uptime
          value_type: FLOAT
          units: s
          description: 'Number of seconds since ClickHouse server start'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$[?(@.metric == "Uptime")].value.first()'
          master_item:
            key: clickhouse.system.asynchronous_metrics
          tags:
            - tag: component
              value: application
          triggers:
            - uuid: 975cebc1b4324f83b5a8853fd666a179
              expression: 'nodata(/ClickHouse by HTTP/clickhouse.uptime,30m)=1'
              name: 'ClickHouse: Failed to fetch info data'
              event_name: 'ClickHouse: Failed to fetch info data (or no data for 30m)'
              priority: WARNING
              description: 'Zabbix has not received any data for items for the last 30 minutes.'
              manual_close: 'YES'
              dependencies:
                - name: 'ClickHouse: Service is down'
                  expression: 'last(/ClickHouse by HTTP/clickhouse.ping)=0 or last(/ClickHouse by HTTP/net.tcp.service[{$CLICKHOUSE.SCHEME},"{$CLICKHOUSE.HOST}","{$CLICKHOUSE.PORT}"]) = 0'
              tags:
                - tag: scope
                  value: notice
            - uuid: e1316d3a83174cc49ab96ad90c46150b
              expression: 'last(/ClickHouse by HTTP/clickhouse.uptime)<10m'
              name: 'ClickHouse: Host has been restarted'
              event_name: 'ClickHouse: {HOST.NAME} has been restarted (uptime < 10m)'
              priority: INFO
              description: 'The host uptime is less than 10 minutes.'
              manual_close: 'YES'
              tags:
                - tag: scope
                  value: notice
        - uuid: d09b77c25dfd45249df05fc3f6d45b7b
          name: Version
          type: HTTP_AGENT
          key: clickhouse.version
          value_type: CHAR
          description: 'Version of the server'
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1d
          url: '{$CLICKHOUSE.SCHEME}://{$CLICKHOUSE.HOST}:{$CLICKHOUSE.PORT}/'
          query_fields:
            - name: query
              value: 'SELECT version()'
          headers:
            - name: X-ClickHouse-User
              value: '{$CLICKHOUSE.USER}'
            - name: X-ClickHouse-Key
              value: '{$CLICKHOUSE.PASSWORD}'
          tags:
            - tag: component
              value: application
          triggers:
            - uuid: 244dcf8dc8584e1686585160c261ef85
              expression: 'last(/ClickHouse by HTTP/clickhouse.version,#1)<>last(/ClickHouse by HTTP/clickhouse.version,#2) and length(last(/ClickHouse by HTTP/clickhouse.version))>0'
              name: 'ClickHouse: Version has changed'
              event_name: 'ClickHouse: Version has changed (new version: {ITEM.VALUE})'
              priority: INFO
              description: 'The ClickHouse version has changed. Acknowledge to close the problem manually.'
              manual_close: 'YES'
              tags:
                - tag: scope
                  value: notice
        - uuid: 5bac794c8c7e438c924cd16b708dc281
          name: 'Write syscalls in fly'
          type: DEPENDENT
          key: clickhouse.write
          description: 'Number of write (write, pwrite, io_getevents, etc.) syscalls in fly'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$[?(@.metric == "Write")].value.first()'
          master_item:
            key: clickhouse.system.metrics
          tags:
            - tag: component
              value: system
        - uuid: 381805a8145a48c2a1f2586996b66a94
          name: 'ZooKeeper exceptions per second'
          type: DEPENDENT
          key: clickhouse.zookeeper.exceptions.rate
          value_type: FLOAT
          description: 'Count of ZooKeeper exceptions that does not belong to user/hardware exceptions.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$[?(@.event == "ZooKeeperOtherExceptions")].value.first()'
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
            - type: CHANGE_PER_SECOND
          master_item:
            key: clickhouse.system.events
          tags:
            - tag: component
              value: zookeeper
        - uuid: f8e6a866d8c745d39ed124f19afe8041
          name: 'ZooKeeper hardware exceptions per second'
          type: DEPENDENT
          key: clickhouse.zookeeper.hw_exceptions.rate
          value_type: FLOAT
          description: 'Count of ZooKeeper exceptions caused by session moved/expired, connection loss, marshalling error, operation timed out and invalid zhandle state.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$[?(@.event == "ZooKeeperHardwareExceptions")].value.first()'
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
            - type: CHANGE_PER_SECOND
          master_item:
            key: clickhouse.system.events
          tags:
            - tag: component
              value: zookeeper
        - uuid: 071fb0471b8e40c3a5bb79c694cecce0
          name: 'ZooKeeper requests'
          type: DEPENDENT
          key: clickhouse.zookeeper.request
          description: 'Number of requests to ZooKeeper in progress.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$[?(@.metric == "ZooKeeperRequest")].value.first()'
          master_item:
            key: clickhouse.system.metrics
          tags:
            - tag: component
              value: zookeeper
        - uuid: 3e344ea728a54bc38b4098e7f6e2d087
          name: 'ZooKeeper sessions'
          type: DEPENDENT
          key: clickhouse.zookeeper.session
          description: 'Number of sessions (connections) to ZooKeeper. Should be no more than one.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$[?(@.metric == "ZooKeeperSession")].value.first()'
          master_item:
            key: clickhouse.system.metrics
          tags:
            - tag: component
              value: zookeeper
          triggers:
            - uuid: 655622aa6c5c48c8b38d5a519602ef05
              expression: 'min(/ClickHouse by HTTP/clickhouse.zookeeper.session,5m)>1'
              name: 'ClickHouse: Too many ZooKeeper sessions opened'
              priority: WARNING
              description: |
                Number of sessions (connections) to ZooKeeper.
                Should be no more than one, because using more than one connection to ZooKeeper may lead to bugs due to lack of linearizability (stale reads) that ZooKeeper consistency model allows.
              tags:
                - tag: scope
                  value: performance
        - uuid: 4931797c1034488fb9a2fc01e22b599c
          name: 'ZooKeeper user exceptions per second'
          type: DEPENDENT
          key: clickhouse.zookeeper.user_exceptions.rate
          value_type: FLOAT
          description: 'Count of ZooKeeper exceptions caused by no znodes, bad version, node exists, node empty and no children for ephemeral.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$[?(@.event == "ZooKeeperUserExceptions")].value.first()'
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
            - type: CHANGE_PER_SECOND
          master_item:
            key: clickhouse.system.events
          tags:
            - tag: component
              value: zookeeper
        - uuid: b9fbc2f76b9c4de3b196ffc82ec10209
          name: 'ZooKeeper wait time'
          type: DEPENDENT
          key: clickhouse.zookeeper.wait.time
          value_type: FLOAT
          units: s
          description: 'Time spent in waiting for ZooKeeper operations.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$[?(@.event == "ZooKeeperWaitMicroseconds")].value.first()'
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
            - type: MULTIPLIER
              parameters:
                - '1.0E-6'
            - type: CHANGE_PER_SECOND
          master_item:
            key: clickhouse.system.events
          tags:
            - tag: component
              value: zookeeper
        - uuid: 696aa071a9b24b29acbce2f1b5c49da3
          name: 'ZooKeeper watches'
          type: DEPENDENT
          key: clickhouse.zookeeper.watch
          description: 'Number of watches (e.g., event subscriptions) in ZooKeeper.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$[?(@.metric == "ZooKeeperWatch")].value.first()'
          master_item:
            key: clickhouse.system.metrics
          tags:
            - tag: component
              value: zookeeper
        - uuid: 68d1e19a6ec2401ba0dd509de7df2812
          name: 'Check port availability'
          type: SIMPLE
          key: 'net.tcp.service[{$CLICKHOUSE.SCHEME},"{$CLICKHOUSE.HOST}","{$CLICKHOUSE.PORT}"]'
          valuemap:
            name: 'Service state'
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 10m
          tags:
            - tag: component
              value: health
            - tag: component
              value: network
          triggers:
            - uuid: 1d4b9842b66b4da9ab3750944b2fa050
              expression: 'last(/ClickHouse by HTTP/net.tcp.service[{$CLICKHOUSE.SCHEME},"{$CLICKHOUSE.HOST}","{$CLICKHOUSE.PORT}"])=0'
              name: 'ClickHouse: Port {$CLICKHOUSE.PORT} is unavailable'
              priority: AVERAGE
              manual_close: 'YES'
              tags:
                - tag: scope
                  value: availability
      discovery_rules:
        - uuid: 45014553f60c4fa79b1793ecf04d4b8c
          name: Databases
          type: DEPENDENT
          key: clickhouse.db.discovery
          filter:
            evaltype: AND
            conditions:
              - macro: '{#DB}'
                value: '{$CLICKHOUSE.LLD.FILTER.DB.MATCHES}'
              - macro: '{#DB}'
                value: '{$CLICKHOUSE.LLD.FILTER.DB.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          description: 'Info about databases'
          item_prototypes:
            - uuid: b574ae5a62af4e9bb9d2c7324bc86c96
              name: '{#DB}: Bytes'
              type: DEPENDENT
              key: 'clickhouse.db.bytes["{#DB}"]'
              units: B
              description: 'Database size in bytes.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.bytes
              master_item:
                key: 'clickhouse.db.info_raw["{#DB}"]'
              tags:
                - tag: component
                  value: database
                - tag: database
                  value: '{#DB}'
            - uuid: 407e1bf7688448abad516318efb6e65a
              name: '{#DB}: Get DB info'
              type: DEPENDENT
              key: 'clickhouse.db.info_raw["{#DB}"]'
              history: '0'
              value_type: TEXT
              description: 'The item gets information about {#DB} database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$[?(@.database == "{#DB}")].first()'
                  error_handler: DISCARD_VALUE
              master_item:
                key: clickhouse.databases
              tags:
                - tag: component
                  value: raw
                - tag: database
                  value: '{#DB}'
            - uuid: 39d06d86884e4da9b9f8d9c0f7028c7c
              name: '{#DB}: Tables'
              type: DEPENDENT
              key: 'clickhouse.db.tables["{#DB}"]'
              description: 'Number of tables in {#DB} database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.tables
              master_item:
                key: 'clickhouse.db.info_raw["{#DB}"]'
              tags:
                - tag: component
                  value: database
                - tag: database
                  value: '{#DB}'
          master_item:
            key: clickhouse.databases
          lld_macro_paths:
            - lld_macro: '{#DB}'
              path: $.database
        - uuid: add428c918e34dc9aeb58f946f16cbd2
          name: Dictionaries
          type: DEPENDENT
          key: clickhouse.dictionaries.discovery
          filter:
            evaltype: AND
            conditions:
              - macro: '{#NAME}'
                value: '{$CLICKHOUSE.LLD.FILTER.DICT.MATCHES}'
              - macro: '{#NAME}'
                value: '{$CLICKHOUSE.LLD.FILTER.DICT.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          description: 'Info about dictionaries'
          item_prototypes:
            - uuid: 18cc050ff9c84d01ab61df1283fcce97
              name: 'Dictionary {#NAME}: Bytes allocated'
              type: DEPENDENT
              key: 'clickhouse.dictionary.bytes_allocated["{#NAME}"]'
              units: B
              description: 'The amount of RAM the dictionary uses.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.bytes_allocated
              master_item:
                key: 'clickhouse.dictionary.info_raw["{#NAME}"]'
              tags:
                - tag: component
                  value: dictionaries
                - tag: dictionary
                  value: '{#NAME}'
            - uuid: fa4efa26e3f64fc89c9d7dad39a610ca
              name: 'Dictionary {#NAME}: Element count'
              type: DEPENDENT
              key: 'clickhouse.dictionary.element_count["{#NAME}"]'
              description: 'Number of items stored in the dictionary.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.element_count
              master_item:
                key: 'clickhouse.dictionary.info_raw["{#NAME}"]'
              tags:
                - tag: component
                  value: dictionaries
                - tag: dictionary
                  value: '{#NAME}'
            - uuid: e736ddf5c02240e7a9e0ea463024ad8e
              name: 'Dictionary {#NAME}: Get dictionary info'
              type: DEPENDENT
              key: 'clickhouse.dictionary.info_raw["{#NAME}"]'
              history: '0'
              value_type: TEXT
              description: 'The item gets information about {#NAME} dictionary.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$[?(@.name == "{#NAME}")].first()'
                  error_handler: DISCARD_VALUE
              master_item:
                key: clickhouse.dictionaries
              tags:
                - tag: component
                  value: raw
                - tag: dictionary
                  value: '{#NAME}'
            - uuid: d9e333b7c1694ef482683679275dcd8d
              name: 'Dictionary {#NAME}: Load factor'
              type: DEPENDENT
              key: 'clickhouse.dictionary.load_factor["{#NAME}"]'
              units: '%'
              description: 'The percentage filled in the dictionary (for a hashed dictionary, the percentage filled in the hash table).'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.bytes_allocated
                - type: MULTIPLIER
                  parameters:
                    - '100'
              master_item:
                key: 'clickhouse.dictionary.info_raw["{#NAME}"]'
              tags:
                - tag: component
                  value: dictionaries
                - tag: dictionary
                  value: '{#NAME}'
          master_item:
            key: clickhouse.dictionaries
          lld_macro_paths:
            - lld_macro: '{#NAME}'
              path: $.name
        - uuid: ddb7c8c688264a5a8907fbdd6974d395
          name: Replicas
          type: DEPENDENT
          key: clickhouse.replicas.discovery
          filter:
            evaltype: AND
            conditions:
              - macro: '{#DB}'
                value: '{$CLICKHOUSE.LLD.FILTER.DB.MATCHES}'
              - macro: '{#DB}'
                value: '{$CLICKHOUSE.LLD.FILTER.DB.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          description: 'Info about replicas'
          item_prototypes:
            - uuid: be577e21420244cb9d47c9fb9e23904a
              name: '{#DB}.{#TABLE}: Active replicas'
              type: DEPENDENT
              key: 'clickhouse.replica.active_replicas["{#DB}.{#TABLE}"]'
              description: 'Number of replicas of this table that have a session in ZooKeeper (i.e., the number of functioning replicas). (Have a non-zero value only where there is an active session with ZooKeeper).'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.active_replicas
              master_item:
                key: 'clickhouse.replica.info_raw["{#DB}.{#TABLE}"]'
              tags:
                - tag: component
                  value: replication
                - tag: database
                  value: '{#DB}'
                - tag: table
                  value: '{#TABLE}'
            - uuid: 0a84f6788b3f447d958e031df0e2301c
              name: '{#DB}.{#TABLE}: Replica future parts'
              type: DEPENDENT
              key: 'clickhouse.replica.future_parts["{#DB}.{#TABLE}"]'
              description: 'Number of data parts that will appear as the result of INSERTs or merges that haven''t been done yet.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.future_parts
              master_item:
                key: 'clickhouse.replica.info_raw["{#DB}.{#TABLE}"]'
              tags:
                - tag: component
                  value: replication
                - tag: database
                  value: '{#DB}'
                - tag: table
                  value: '{#TABLE}'
            - uuid: 11aa8f51d2d1461a989e465390b406de
              name: '{#DB}.{#TABLE}: Get replicas info'
              type: DEPENDENT
              key: 'clickhouse.replica.info_raw["{#DB}.{#TABLE}"]'
              history: '0'
              value_type: TEXT
              description: 'The item gets information about replicas of {#TABLE} table of {#DB} database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$[?(@.database == "{#DB}" && @.table == "{#TABLE}")].first()'
                  error_handler: DISCARD_VALUE
              master_item:
                key: clickhouse.replicas
              tags:
                - tag: component
                  value: raw
                - tag: database
                  value: '{#DB}'
                - tag: table
                  value: '{#TABLE}'
            - uuid: 6b49a71fcf244b8cb88e21423ac92ae2
              name: '{#DB}.{#TABLE}: Replica queue inserts size'
              type: DEPENDENT
              key: 'clickhouse.replica.inserts_in_queue["{#DB}.{#TABLE}"]'
              description: 'Number of inserts of blocks of data that need to be made.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.inserts_in_queue
              master_item:
                key: 'clickhouse.replica.info_raw["{#DB}.{#TABLE}"]'
              tags:
                - tag: component
                  value: replication
                - tag: database
                  value: '{#DB}'
                - tag: table
                  value: '{#TABLE}'
            - uuid: 29977fdd52c64c4ca0b3565187365a0c
              name: '{#DB}.{#TABLE}: Replica readonly'
              type: DEPENDENT
              key: 'clickhouse.replica.is_readonly["{#DB}.{#TABLE}"]'
              description: |
                Whether the replica is in read-only mode.
                This mode is turned on if the config doesn't have sections with ZooKeeper, if an unknown error occurred when re-initializing sessions in ZooKeeper, and during session re-initialization in ZooKeeper.
              valuemap:
                name: 'Replicas state'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.is_readonly
              master_item:
                key: 'clickhouse.replica.info_raw["{#DB}.{#TABLE}"]'
              tags:
                - tag: component
                  value: replication
                - tag: database
                  value: '{#DB}'
                - tag: table
                  value: '{#TABLE}'
              trigger_prototypes:
                - uuid: 7cfd2342d3654407a941cb56fde5c6bf
                  expression: 'min(/ClickHouse by HTTP/clickhouse.replica.is_readonly["{#DB}.{#TABLE}"],5m)=1'
                  name: 'ClickHouse: {#DB}.{#TABLE} Replica is readonly'
                  priority: WARNING
                  description: 'This mode is turned on if the config doesn''t have sections with ZooKeeper, if an unknown error occurred when re-initializing sessions in ZooKeeper, and during session re-initialization in ZooKeeper.'
                  tags:
                    - tag: scope
                      value: availability
            - uuid: a889475b8ddf48109af3dd2b7ed58627
              name: '{#DB}.{#TABLE}: Replica session expired'
              type: DEPENDENT
              key: 'clickhouse.replica.is_session_expired["{#DB}.{#TABLE}"]'
              description: 'True if the ZooKeeper session expired'
              valuemap:
                name: 'Replicas state'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.is_session_expired
              master_item:
                key: 'clickhouse.replica.info_raw["{#DB}.{#TABLE}"]'
              tags:
                - tag: component
                  value: replication
                - tag: database
                  value: '{#DB}'
                - tag: table
                  value: '{#TABLE}'
              trigger_prototypes:
                - uuid: 765475cc0be84ce1b85d1f026d08c326
                  expression: 'min(/ClickHouse by HTTP/clickhouse.replica.is_session_expired["{#DB}.{#TABLE}"],5m)=1'
                  name: 'ClickHouse: {#DB}.{#TABLE} Replica session is expired'
                  priority: WARNING
                  description: 'This mode is turned on if the config doesn''t have sections with ZooKeeper, if an unknown error occurred when re-initializing sessions in ZooKeeper, and during session re-initialization in ZooKeeper.'
                  tags:
                    - tag: scope
                      value: performance
            - uuid: 8acd6e2195064708886d9944af264c32
              name: '{#DB}.{#TABLE}: Replica lag'
              type: DEPENDENT
              key: 'clickhouse.replica.lag["{#DB}.{#TABLE}"]'
              value_type: FLOAT
              description: 'Difference between log_max_index and log_pointer'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.replica_lag
              master_item:
                key: 'clickhouse.replica.info_raw["{#DB}.{#TABLE}"]'
              tags:
                - tag: component
                  value: replication
                - tag: database
                  value: '{#DB}'
                - tag: table
                  value: '{#TABLE}'
              trigger_prototypes:
                - uuid: 0b06b448c0ad433c94c2a3788ca53e1a
                  expression: 'min(/ClickHouse by HTTP/clickhouse.replica.lag["{#DB}.{#TABLE}"],5m) > {$CLICKHOUSE.LOG_POSITION.DIFF.MAX.WARN}'
                  name: 'ClickHouse: {#DB}.{#TABLE}: Difference between log_max_index and log_pointer is too high'
                  event_name: 'ClickHouse: {#DB}.{#TABLE}: Difference between log_max_index and log_pointer is too high (More than {$CLICKHOUSE.LOG_POSITION.DIFF.MAX.WARN} for 5m)'
                  priority: WARNING
                  tags:
                    - tag: scope
                      value: availability
            - uuid: 267603d761864e4cbf764558520ed83c
              name: '{#DB}.{#TABLE}: Replica log max index'
              type: DEPENDENT
              key: 'clickhouse.replica.log_max_index["{#DB}.{#TABLE}"]'
              description: 'Maximum entry number in the log of general activity. (Have a non-zero value only where there is an active session with ZooKeeper).'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.log_max_index
              master_item:
                key: 'clickhouse.replica.info_raw["{#DB}.{#TABLE}"]'
              tags:
                - tag: component
                  value: replication
                - tag: database
                  value: '{#DB}'
                - tag: table
                  value: '{#TABLE}'
            - uuid: 93bf89b0befa4c238f2143c1841ef629
              name: '{#DB}.{#TABLE}: Replica log pointer'
              type: DEPENDENT
              key: 'clickhouse.replica.log_pointer["{#DB}.{#TABLE}"]'
              description: 'Maximum entry number in the log of general activity that the replica copied to its execution queue, plus one. (Have a non-zero value only where there is an active session with ZooKeeper).'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.log_pointer
              master_item:
                key: 'clickhouse.replica.info_raw["{#DB}.{#TABLE}"]'
              tags:
                - tag: component
                  value: replication
                - tag: database
                  value: '{#DB}'
                - tag: table
                  value: '{#TABLE}'
            - uuid: 7b0da84f1e3f4705a209c6be025fc738
              name: '{#DB}.{#TABLE}: Replica queue merges size'
              type: DEPENDENT
              key: 'clickhouse.replica.merges_in_queue["{#DB}.{#TABLE}"]'
              description: 'Number of merges waiting to be made.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.merges_in_queue
              master_item:
                key: 'clickhouse.replica.info_raw["{#DB}.{#TABLE}"]'
              tags:
                - tag: component
                  value: replication
                - tag: database
                  value: '{#DB}'
                - tag: table
                  value: '{#TABLE}'
            - uuid: 51a83465b90e4c82835030fec4f79b6f
              name: '{#DB}.{#TABLE}: Replica parts to check'
              type: DEPENDENT
              key: 'clickhouse.replica.parts_to_check["{#DB}.{#TABLE}"]'
              description: 'Number of data parts in the queue for verification. A part is put in the verification queue if there is suspicion that it might be damaged.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.parts_to_check
              master_item:
                key: 'clickhouse.replica.info_raw["{#DB}.{#TABLE}"]'
              tags:
                - tag: component
                  value: replication
                - tag: database
                  value: '{#DB}'
                - tag: table
                  value: '{#TABLE}'
            - uuid: 52ef1c26f14842868424f0c5bf81b35b
              name: '{#DB}.{#TABLE}: Replica queue size'
              type: DEPENDENT
              key: 'clickhouse.replica.queue_size["{#DB}.{#TABLE}"]'
              description: 'Size of the queue for operations waiting to be performed.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.queue_size
              master_item:
                key: 'clickhouse.replica.info_raw["{#DB}.{#TABLE}"]'
              tags:
                - tag: component
                  value: replication
                - tag: database
                  value: '{#DB}'
                - tag: table
                  value: '{#TABLE}'
              trigger_prototypes:
                - uuid: 6fe0a15168db4abfa1cd2a2ee45d62ad
                  expression: 'min(/ClickHouse by HTTP/clickhouse.replica.queue_size["{#DB}.{#TABLE}"],5m)>{$CLICKHOUSE.QUEUE.SIZE.MAX.WARN:"{#TABLE}"}'
                  name: 'ClickHouse: {#DB}.{#TABLE}: Too many operations in queue'
                  event_name: 'ClickHouse: {#DB}.{#TABLE}: Too many operations in queue (over {$CLICKHOUSE.QUEUE.SIZE.MAX.WARN} for 5m)'
                  priority: WARNING
                  tags:
                    - tag: scope
                      value: performance
            - uuid: 0fc2781f4be44f0e85176e5ed05dc05e
              name: '{#DB}.{#TABLE}: Total replicas'
              type: DEPENDENT
              key: 'clickhouse.replica.total_replicas["{#DB}.{#TABLE}"]'
              description: 'Total number of known replicas of this table. (Have a non-zero value only where there is an active session with ZooKeeper).'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.total_replicas
              master_item:
                key: 'clickhouse.replica.info_raw["{#DB}.{#TABLE}"]'
              tags:
                - tag: component
                  value: replication
                - tag: database
                  value: '{#DB}'
                - tag: table
                  value: '{#TABLE}'
          trigger_prototypes:
            - uuid: f46f1b8d75c54129b6e2ff9ede2501b5
              expression: 'max(/ClickHouse by HTTP/clickhouse.replica.active_replicas["{#DB}.{#TABLE}"],5m) < last(/ClickHouse by HTTP/clickhouse.replica.total_replicas["{#DB}.{#TABLE}"])'
              name: 'ClickHouse: {#DB}.{#TABLE}: Number of active replicas less than number of total replicas'
              priority: WARNING
              tags:
                - tag: scope
                  value: availability
          graph_prototypes:
            - uuid: 131e0d19c35f4d87aa62b7766e6e1db3
              name: 'ClickHouse: {#DB}.{#TABLE}: Replica log activity'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'ClickHouse by HTTP'
                    key: 'clickhouse.replica.log_max_index["{#DB}.{#TABLE}"]'
                - sortorder: '1'
                  color: F63100
                  item:
                    host: 'ClickHouse by HTTP'
                    key: 'clickhouse.replica.log_pointer["{#DB}.{#TABLE}"]'
            - uuid: 195f5d50a1f0488b9db5d2f1e6a6e8c3
              name: 'ClickHouse: {#DB}.{#TABLE}: Replica queues'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'ClickHouse by HTTP'
                    key: 'clickhouse.replica.merges_in_queue["{#DB}.{#TABLE}"]'
                - sortorder: '1'
                  color: F63100
                  item:
                    host: 'ClickHouse by HTTP'
                    key: 'clickhouse.replica.inserts_in_queue["{#DB}.{#TABLE}"]'
                - sortorder: '2'
                  color: 00611C
                  item:
                    host: 'ClickHouse by HTTP'
                    key: 'clickhouse.replica.queue_size["{#DB}.{#TABLE}"]'
                - sortorder: '3'
                  color: F7941D
                  item:
                    host: 'ClickHouse by HTTP'
                    key: 'clickhouse.replica.future_parts["{#DB}.{#TABLE}"]'
                - sortorder: '4'
                  color: FC6EA3
                  item:
                    host: 'ClickHouse by HTTP'
                    key: 'clickhouse.replica.parts_to_check["{#DB}.{#TABLE}"]'
          master_item:
            key: clickhouse.replicas
          lld_macro_paths:
            - lld_macro: '{#DB}'
              path: $.database
            - lld_macro: '{#TABLE}'
              path: $.table
        - uuid: a82f8d0f0a4b493dab0c2133b90113cc
          name: Tables
          type: DEPENDENT
          key: clickhouse.tables.discovery
          filter:
            evaltype: AND
            conditions:
              - macro: '{#DB}'
                value: '{$CLICKHOUSE.LLD.FILTER.DB.MATCHES}'
              - macro: '{#DB}'
                value: '{$CLICKHOUSE.LLD.FILTER.DB.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
              - macro: '{#TABLE}'
                value: '{$CLICKHOUSE.LLD.FILTER.TABLE.MATCHES}'
              - macro: '{#TABLE}'
                value: '{$CLICKHOUSE.LLD.FILTER.TABLE.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          description: 'Info about tables'
          item_prototypes:
            - uuid: 3075954290af4f35b1620a5f15d2947d
              name: '{#DB}.{#TABLE}: Bytes'
              type: DEPENDENT
              key: 'clickhouse.table.bytes["{#DB}.{#TABLE}"]'
              units: B
              description: 'Table size in bytes. Database: {#DB}, table: {#TABLE}'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.bytes
              master_item:
                key: 'clickhouse.table.info_raw["{#DB}.{#TABLE}"]'
              tags:
                - tag: component
                  value: tables
                - tag: database
                  value: '{#DB}'
                - tag: table
                  value: '{#TABLE}'
            - uuid: e55b8c504efc41679e90c83cb03bc117
              name: '{#DB}.{#TABLE}: Get table info'
              type: DEPENDENT
              key: 'clickhouse.table.info_raw["{#DB}.{#TABLE}"]'
              history: '0'
              value_type: TEXT
              description: 'The item gets information about {#TABLE} table of {#DB} database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$[?(@.database == "{#DB}" && @.table == "{#TABLE}")].first()'
                  error_handler: DISCARD_VALUE
              master_item:
                key: clickhouse.tables
              tags:
                - tag: component
                  value: raw
                - tag: database
                  value: '{#DB}'
                - tag: table
                  value: '{#TABLE}'
            - uuid: e50e12adb7ef47e6ba40db01e7ae01e4
              name: '{#DB}.{#TABLE}: Parts'
              type: DEPENDENT
              key: 'clickhouse.table.parts["{#DB}.{#TABLE}"]'
              description: 'Number of parts of the table. Database: {#DB}, table: {#TABLE}'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.parts
              master_item:
                key: 'clickhouse.table.info_raw["{#DB}.{#TABLE}"]'
              tags:
                - tag: component
                  value: tables
                - tag: database
                  value: '{#DB}'
                - tag: table
                  value: '{#TABLE}'
            - uuid: 0ba557c544854f47bcd9cc65d33f14e7
              name: '{#DB}.{#TABLE}: Rows'
              type: DEPENDENT
              key: 'clickhouse.table.rows["{#DB}.{#TABLE}"]'
              description: 'Number of rows in the table. Database: {#DB}, table: {#TABLE}'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.rows
              master_item:
                key: 'clickhouse.table.info_raw["{#DB}.{#TABLE}"]'
              tags:
                - tag: component
                  value: tables
                - tag: database
                  value: '{#DB}'
                - tag: table
                  value: '{#TABLE}'
          master_item:
            key: clickhouse.tables
          lld_macro_paths:
            - lld_macro: '{#DB}'
              path: $.database
            - lld_macro: '{#TABLE}'
              path: $.table
      tags:
        - tag: class
          value: database
        - tag: subclass
          value: nosql
        - tag: target
          value: clickhouse
      macros:
        - macro: '{$CLICKHOUSE.DELAYED.FILES.DISTRIBUTED.COUNT.MAX.WARN}'
          value: '600'
          description: 'Maximum size of distributed files queue to insert for trigger expression.'
          config:
            type: TEXT
            priority: '17'
            section_name: Thresholds
            label: 'Max distributed queue size'
            description: 'Maximum size of distributed files queue to insert for trigger expression.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$CLICKHOUSE.DELAYED.INSERTS.MAX.WARN}'
          value: '0'
          description: 'Maximum number of delayed inserts for trigger expression.'
          config:
            type: TEXT
            priority: '19'
            section_name: Thresholds
            label: 'Max delayed inserts'
            description: 'Maximum number of delayed inserts for trigger expression.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$CLICKHOUSE.HOST}'
          description: 'The hostname or IP address of the ClickHouse HTTP endpoint.'
          config:
            type: TEXT
            priority: '4'
            label: 'ClickHouse host'
            description: 'The hostname or IP address of the ClickHouse HTTP endpoint.'
            required: 'YES'
        - macro: '{$CLICKHOUSE.LLD.FILTER.DB.MATCHES}'
          value: '.*'
          description: 'Filter of discoverable databases'
          config:
            type: TEXT
            priority: '7'
            section_name: Filters
            label: 'Databases filter (include)'
            description: 'Filter of discoverable databases'
        - macro: '{$CLICKHOUSE.LLD.FILTER.DB.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'Filter to exclude discovered databases'
          config:
            type: TEXT
            priority: '8'
            section_name: Filters
            label: 'Databases filter (exclude)'
            description: 'Filter to exclude discovered databases'
        - macro: '{$CLICKHOUSE.LLD.FILTER.DICT.MATCHES}'
          value: '.*'
          description: 'Filter of discoverable dictionaries'
          config:
            type: TEXT
            priority: '9'
            section_name: Filters
            label: 'Dictionaries filter (include)'
            description: 'Filter of discoverable dictionaries'
        - macro: '{$CLICKHOUSE.LLD.FILTER.DICT.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'Filter to exclude discovered dictionaries'
          config:
            type: TEXT
            priority: '10'
            section_name: Filters
            label: 'Dictionaries filter (exclude)'
            description: 'Filter to exclude discovered dictionaries'
        - macro: '{$CLICKHOUSE.LLD.FILTER.TABLE.MATCHES}'
          value: '.*'
          description: 'Filter of discoverable tables'
          config:
            type: TEXT
            priority: '11'
            section_name: Filters
            label: 'Tables filter (include)'
            description: 'Filter of discoverable tables'
        - macro: '{$CLICKHOUSE.LLD.FILTER.TABLE.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'Filter to exclude discovered tables'
          config:
            type: TEXT
            priority: '12'
            section_name: Filters
            label: 'Tables filter (exclude)'
            description: 'Filter to exclude discovered tables'
        - macro: '{$CLICKHOUSE.LOG_POSITION.DIFF.MAX.WARN}'
          value: '30'
          description: 'Maximum diff between log_pointer and log_max_index.'
          config:
            type: TEXT
            priority: '15'
            section_name: Thresholds
            label: 'Max log pointer diff'
            description: 'Maximum diff between log_pointer and log_max_index.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$CLICKHOUSE.NETWORK.ERRORS.MAX.WARN}'
          value: '5'
          description: 'Maximum number of network errors for trigger expression'
          config:
            type: TEXT
            priority: '3'
            section_name: Thresholds
            label: 'Max network errors'
            description: 'Maximum number of network errors for trigger expression'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$CLICKHOUSE.PARTS.PER.PARTITION.WARN}'
          value: '300'
          description: 'Maximum number of parts per partition for trigger expression.'
          config:
            type: TEXT
            priority: '18'
            section_name: Thresholds
            label: 'Max parts per partition'
            description: 'Maximum number of parts per partition for trigger expression.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$CLICKHOUSE.PASSWORD}'
          value: zabbix_pass
          config:
            type: TEXT
            priority: '2'
            label: Password
            required: 'YES'
        - macro: '{$CLICKHOUSE.PORT}'
          value: '8123'
          description: 'The port of ClickHouse HTTP endpoint'
          config:
            type: TEXT
            priority: '5'
            label: 'ClickHouse port'
            description: 'The port of ClickHouse HTTP endpoint In the range from 1 to 65535 inclusive.'
            required: 'YES'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$CLICKHOUSE.QUERY_TIME.MAX.WARN}'
          value: '600'
          description: 'Maximum ClickHouse query time in seconds for trigger expression'
          config:
            type: TEXT
            priority: '13'
            section_name: Thresholds
            label: 'Max query time (sec)'
            description: 'Maximum ClickHouse query time in seconds for trigger expression'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$CLICKHOUSE.QUEUE.SIZE.MAX.WARN}'
          value: '20'
          description: 'Maximum size of the queue for operations waiting to be performed for trigger expression.'
          config:
            type: TEXT
            priority: '14'
            section_name: Thresholds
            label: 'Max queue size'
            description: 'Maximum size of the queue for operations waiting to be performed for trigger expression.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$CLICKHOUSE.REPLICA.MAX.WARN}'
          value: '600'
          description: 'Replication lag across all tables for trigger expression.'
          config:
            type: TEXT
            priority: '16'
            section_name: Thresholds
            label: 'Replication lag'
            description: 'Replication lag across all tables for trigger expression.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$CLICKHOUSE.SCHEME}'
          value: http
          description: 'Request scheme which may be http or https'
          config:
            type: LIST
            priority: '6'
            label: 'ClickHouse scheme'
            description: 'Request scheme which may be http or https'
            options:
              - value: http
                text: http
              - value: https
                text: https
        - macro: '{$CLICKHOUSE.USER}'
          value: zabbix
          config:
            type: TEXT
            priority: '1'
            label: Username
            required: 'YES'
      dashboards:
        - uuid: c642000e289649e8913e0d644b914ecb
          name: 'ClickHouse: Overview'
          pages:
            - name: Main
              widgets:
                - type: item
                  name: 'Service available'
                  width: '12'
                  fields:
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'ClickHouse by HTTP'
                        key: clickhouse.ping
                    - type: INTEGER
                      name: show.0
                      value: '4'
                    - type: INTEGER
                      name: show.1
                      value: '2'
                - type: graph
                  'y': '2'
                  width: '36'
                  height: '5'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'ClickHouse by HTTP'
                        name: 'ClickHouse: Memory Usage'
                    - type: STRING
                      name: reference
                      value: AAAAA
                - type: graph
                  'y': '7'
                  width: '36'
                  height: '5'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'ClickHouse by HTTP'
                        name: 'ClickHouse: Insert/Merge bytes rate'
                    - type: STRING
                      name: reference
                      value: AAAAC
                - type: graph
                  'y': '12'
                  width: '36'
                  height: '5'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'ClickHouse by HTTP'
                        name: 'ClickHouse: Current activity'
                    - type: STRING
                      name: reference
                      value: AAAAE
                - type: graph
                  'y': '17'
                  width: '36'
                  height: '5'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'ClickHouse by HTTP'
                        name: 'ClickHouse: Distributed'
                    - type: STRING
                      name: reference
                      value: AAAAG
                - type: graph
                  'y': '22'
                  width: '36'
                  height: '5'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'ClickHouse by HTTP'
                        name: 'ClickHouse: Syscalls in fly'
                    - type: STRING
                      name: reference
                      value: AAAAI
                - type: item
                  name: 'Port available'
                  x: '12'
                  width: '12'
                  fields:
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'ClickHouse by HTTP'
                        key: 'net.tcp.service[{$CLICKHOUSE.SCHEME},"{$CLICKHOUSE.HOST}","{$CLICKHOUSE.PORT}"]'
                    - type: INTEGER
                      name: show.0
                      value: '4'
                    - type: INTEGER
                      name: show.1
                      value: '2'
                - type: item
                  name: Uptime
                  x: '24'
                  width: '12'
                  fields:
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'ClickHouse by HTTP'
                        key: clickhouse.uptime
                    - type: INTEGER
                      name: show.0
                      value: '4'
                    - type: INTEGER
                      name: show.1
                      value: '2'
                - type: item
                  name: Version
                  x: '36'
                  width: '12'
                  fields:
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'ClickHouse by HTTP'
                        key: clickhouse.version
                    - type: INTEGER
                      name: show.0
                      value: '4'
                    - type: INTEGER
                      name: show.1
                      value: '2'
                - type: graph
                  x: '36'
                  'y': '2'
                  width: '36'
                  height: '5'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'ClickHouse by HTTP'
                        name: 'ClickHouse: Memory Utilization'
                    - type: STRING
                      name: reference
                      value: AAAAB
                - type: graph
                  x: '36'
                  'y': '7'
                  width: '36'
                  height: '5'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'ClickHouse by HTTP'
                        name: 'ClickHouse: Insert/Merge rows rate'
                    - type: STRING
                      name: reference
                      value: AAAAD
                - type: graph
                  x: '36'
                  'y': '12'
                  width: '36'
                  height: '5'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'ClickHouse by HTTP'
                        name: 'ClickHouse: Current connections'
                    - type: STRING
                      name: reference
                      value: AAAAF
                - type: graph
                  x: '36'
                  'y': '17'
                  width: '36'
                  height: '5'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'ClickHouse by HTTP'
                        name: 'ClickHouse: Queries rate'
                    - type: STRING
                      name: reference
                      value: AAAAH
                - type: graph
                  x: '36'
                  'y': '22'
                  width: '36'
                  height: '5'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'ClickHouse by HTTP'
                        name: 'ClickHouse: Zookeeper exceptions rate'
                    - type: STRING
                      name: reference
                      value: AAAAJ
            - name: Replicas
              widgets:
                - type: graphprototype
                  width: '36'
                  height: '15'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'ClickHouse by HTTP'
                        name: 'ClickHouse: {#DB}.{#TABLE}: Replica queues'
                    - type: STRING
                      name: reference
                      value: AAAAK
                    - type: INTEGER
                      name: rows
                      value: '3'
                - type: graphprototype
                  x: '36'
                  width: '36'
                  height: '15'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'ClickHouse by HTTP'
                        name: 'ClickHouse: {#DB}.{#TABLE}: Replica log activity'
                    - type: STRING
                      name: reference
                      value: AAAAL
                    - type: INTEGER
                      name: rows
                      value: '3'
      valuemaps:
        - uuid: 4d926c30529447b3816cec3f1440b47a
          name: 'Replicas state'
          mappings:
            - value: '0'
              newvalue: 'False'
            - value: '1'
              newvalue: 'True'
        - uuid: 94147888c7ad4f5bae864eb2698f0237
          name: 'Service state'
          mappings:
            - value: '0'
              newvalue: Down
            - value: '1'
              newvalue: Up
    - uuid: 3db29bb6b2b14fa289ba7915264efcdf
      template: 'HashiCorp Consul Cluster by HTTP'
      name: 'HashiCorp Consul Cluster by HTTP'
      description: |
        Get HashiCorp Consul Cluster services and nodes by HTTP agent from API endpoints.
        
        Don't forget to change macros {$CONSUL.CLUSTER.URL}, {$CONSUL.TOKEN}.
        Some metrics may not be collected depending on your HashiCorp Consul instance version and configuration.
        More information about metrics you can find in official documentation: https://www.consul.io/docs/agent/telemetry
        
        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"
      wizard_ready: 'YES'
      readme: |
        ## Overview
        
        The template to monitor HashiCorp Consul by Zabbix that works without any external scripts.
        Most of the metrics are collected in one go, thanks to Zabbix bulk data collection.
        
        Template `HashiCorp Consul Cluster by HTTP` — collects metrics by HTTP agent from API endpoints.
        More information about metrics you can find in [official documentation](https://www.consul.io/docs/agent/telemetry).
        
        ## Setup
        
        Template need to use Authorization via API token.
        
        Don't forget to change host wizard configuration field `Address`, `Token`.
        
        This template support [Consul namespaces](https://www.consul.io/docs/enterprise/namespaces). You can set host wizard configuration field `Consul service namespace`, if you are interested in only one service namespace. Do not specify this host wizard configuration field to get all of services.
        In case of Open Source version leave this host wizard configuration field empty.
        
        *NOTE.* Some metrics may not be collected depending on your HashiCorp Consul instance version and configuration.
        *NOTE.* You maybe are interested in Envoy Proxy by HTTP [template](../../envoy_proxy_http).
      vendor:
        name: Zabbix
        version: 8.0-1
      groups:
        - name: Templates/Applications
      items:
        - uuid: fd087c72bb7842c6b84b0b70788506b0
          name: 'Get services'
          type: HTTP_AGENT
          key: consul.get_catalog_services
          history: '0'
          value_type: TEXT
          description: 'Catalog of services registered in a given datacenter.'
          preprocessing:
            - type: CHECK_NOT_SUPPORTED
              parameters:
                - '-1'
          timeout: 15s
          url: '{$CONSUL.CLUSTER.URL}/v1/catalog/services'
          headers:
            - name: X-Consul-Token
              value: '{$CONSUL.TOKEN}'
            - name: X-Consul-Namespace
              value: '{$CONSUL.NAMESPACE}'
          tags:
            - tag: component
              value: raw
        - uuid: cad23435cc454f01b47034bd8427931d
          name: 'Get nodes Serf health status'
          type: HTTP_AGENT
          key: consul.get_cluster_serf
          history: '0'
          value_type: TEXT
          description: 'Get Serf Health Status for all agents in cluster.'
          preprocessing:
            - type: CHECK_NOT_SUPPORTED
              parameters:
                - '-1'
          timeout: 15s
          url: '{$CONSUL.CLUSTER.URL}/v1/health/state/any?filter=CheckID==serfHealth'
          headers:
            - name: X-Consul-Token
              value: '{$CONSUL.TOKEN}'
            - name: X-Consul-Namespace
              value: '{$CONSUL.NAMESPACE}'
          tags:
            - tag: component
              value: health
            - tag: component
              value: raw
        - uuid: e52fcc1af52e4df5b18118355260a8d6
          name: 'Cluster leader'
          type: HTTP_AGENT
          key: consul.get_leader
          value_type: TEXT
          description: 'Current leader address.'
          preprocessing:
            - type: CHECK_NOT_SUPPORTED
              parameters:
                - '-1'
            - type: TRIM
              parameters:
                - '"'
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          timeout: 15s
          url: '{$CONSUL.CLUSTER.URL}/v1/status/leader'
          headers:
            - name: X-Consul-Token
              value: '{$CONSUL.TOKEN}'
          tags:
            - tag: component
              value: leader
            - tag: component
              value: raw
          triggers:
            - uuid: 8f612c3cfbb74f55a7defed05039e2a5
              expression: 'last(/HashiCorp Consul Cluster by HTTP/consul.get_leader,#1)<>last(/HashiCorp Consul Cluster by HTTP/consul.get_leader,#2) and length(last(/HashiCorp Consul Cluster by HTTP/consul.get_leader))>0'
              name: 'HashiCorp Consul Cluster: Leader has been changed'
              event_name: 'HashiCorp Consul Cluster: Leader has been changed (new value received: {ITEM.VALUE})'
              priority: INFO
              description: 'Consul cluster version has changed. Acknowledge to close the problem manually.'
              manual_close: 'YES'
              tags:
                - tag: scope
                  value: notice
        - uuid: 859451004516499e9636d96cde023d21
          name: 'Get nodes'
          type: HTTP_AGENT
          key: consul.get_nodes
          history: '0'
          value_type: TEXT
          description: 'Catalog of nodes registered in a given datacenter.'
          preprocessing:
            - type: CHECK_NOT_SUPPORTED
              parameters:
                - '-1'
          timeout: 15s
          url: '{$CONSUL.CLUSTER.URL}/v1/catalog/nodes'
          headers:
            - name: X-Consul-Token
              value: '{$CONSUL.TOKEN}'
          tags:
            - tag: component
              value: raw
        - uuid: 2400f78a5ada4a59b63fc049b6e3b3bf
          name: 'Nodes: peers'
          type: HTTP_AGENT
          key: consul.get_peers
          description: 'The number of Raft peers for the datacenter in which the agent is running.'
          preprocessing:
            - type: CHECK_NOT_SUPPORTED
              parameters:
                - '-1'
            - type: JSONPATH
              parameters:
                - $.length()
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
          timeout: 15s
          url: '{$CONSUL.CLUSTER.URL}/v1/status/peers'
          headers:
            - name: X-Consul-Token
              value: '{$CONSUL.TOKEN}'
          tags:
            - tag: component
              value: raft
        - uuid: 31be2fd640a141279d41871df877a42c
          name: 'Nodes: critical'
          type: DEPENDENT
          key: consul.nodes_critical
          description: 'Number of agents on current dc with serf health status ''critical''.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$[?(@.Status == "critical")].length()'
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
          master_item:
            key: consul.get_cluster_serf
          tags:
            - tag: component
              value: consul
          triggers:
            - uuid: 8660702ae3674eb083d6dacb81ec3a4d
              expression: 'last(/HashiCorp Consul Cluster by HTTP/consul.nodes_critical)>0'
              name: 'HashiCorp Consul Cluster: One or more nodes in cluster in ''critical'' state'
              priority: AVERAGE
              description: 'One or more agents on current dc with serf health status ''critical''.'
              tags:
                - tag: scope
                  value: availability
        - uuid: 6303f2b128f64bec9760bc3807bb9a34
          name: 'Nodes: passing'
          type: DEPENDENT
          key: consul.nodes_passing
          description: 'Number of agents on current dc with serf health status ''passing''.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$[?(@.Status == "passing")].length()'
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
          master_item:
            key: consul.get_cluster_serf
          tags:
            - tag: component
              value: consul
        - uuid: 3eef4079f15d4db8852822ebda6d36fe
          name: 'Nodes: total'
          type: DEPENDENT
          key: consul.nodes_total
          description: 'Number of nodes on current dc.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.length()
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
          master_item:
            key: consul.get_nodes
          tags:
            - tag: component
              value: consul
        - uuid: b02337cc9a6b4c34a85d85a231c4e51f
          name: 'Nodes: warning'
          type: DEPENDENT
          key: consul.nodes_warning
          description: 'Number of agents on current dc with serf health status ''warning''.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$[?(@.Status == "warning")].length()'
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
          master_item:
            key: consul.get_cluster_serf
          tags:
            - tag: component
              value: consul
          triggers:
            - uuid: 92136d6ee73b4bb5b88b9f1da1afe740
              expression: 'last(/HashiCorp Consul Cluster by HTTP/consul.nodes_warning)>0'
              name: 'HashiCorp Consul Cluster: One or more nodes in cluster in ''warning'' state'
              priority: WARNING
              description: 'One or more agents on current dc with serf health status ''warning''.'
              tags:
                - tag: scope
                  value: availability
        - uuid: 30101e37fce144bdacce0a58b4c9de0e
          name: 'Services: total'
          type: DEPENDENT
          key: consul.services_total
          description: 'Number of services on current dc.'
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - 'return Object.keys(JSON.parse(value)).length;'
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
          master_item:
            key: consul.get_catalog_services
          tags:
            - tag: component
              value: consul
      discovery_rules:
        - uuid: ea1b655bdf7940f6a431e2e04a8dfcd6
          name: 'Consul cluster nodes discovery'
          type: DEPENDENT
          key: consul.lld_nodes
          filter:
            conditions:
              - macro: '{#NODE_NAME}'
                value: '{$CONSUL.LLD.FILTER.NODE_NAME.MATCHES}'
              - macro: '{#NODE_NAME}'
                value: '{$CONSUL.LLD.FILTER.NODE_NAME.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          item_prototypes:
            - uuid: ddb71b90bde94760a4a456c15e647917
              name: 'Node ["{#NODE_NAME}"]: Serf Health'
              type: DEPENDENT
              key: 'consul.serf.health["{#NODE_NAME}"]'
              description: 'Node Serf Health Status.'
              valuemap:
                name: 'Consul health state'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$[?(@.Node == "{#NODE_NAME}" && @.CheckID == "serfHealth")].Status.first()'
                - type: JAVASCRIPT
                  parameters:
                    - |
                      var state = ['passing', 'warning', 'critical'];
                      
                      return state.indexOf(value.trim()) === -1 ? 255 : state.indexOf(value.trim());
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 3h
              master_item:
                key: consul.get_cluster_serf
              tags:
                - tag: component
                  value: health
          host_prototypes:
            - uuid: 20efdd208e1548a7877a970e1600e5ba
              host: 'Consul {#NODE_NAME}'
              name: 'Consul {#NODE_NAME}'
              group_links:
                - group:
                    name: Applications
              group_prototypes:
                - name: 'Consul cluster/{#NODE_DATACENTER}'
              templates:
                - name: 'HashiCorp Consul Node by HTTP'
              macros:
                - macro: '{$CONSUL.NODE.API.URL}'
                  value: '{#NODE_API_URL}'
                  description: 'Consul instance URL'
              tags:
                - tag: address
                  value: '{#NODE_ADDRESS}'
                - tag: datacenter
                  value: '{#NODE_DATACENTER}'
              custom_interfaces: 'YES'
              interfaces:
                - ip: '{#NODE_ADDRESS}'
          master_item:
            key: consul.get_nodes
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  var data = JSON.parse(value),
                  	consul_api_scheme = '{$CONSUL.API.SCHEME}',
                  	consul_api_port = '{$CONSUL.API.PORT}',
                  	result = [];
                  
                  data.forEach(function (instance) {
                  	if (instance["ID"] != '') {
                  		result.push({
                  			'{#NODE_NAME}': instance["Node"],
                  			'{#NODE_ADDRESS}': instance["Address"],
                  			'{#NODE_API_URL}': consul_api_scheme + '://' + instance["Address"] + ':' + consul_api_port,
                  			'{#NODE_DATACENTER}': instance["Datacenter"]
                  		});
                  	}
                  });
                  
                  return JSON.stringify(result);
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
        - uuid: d84aadcb4d4d4215826c859de416b739
          name: 'Consul cluster services discovery'
          type: DEPENDENT
          key: consul.lld_services
          filter:
            conditions:
              - macro: '{#SERVICE_NAME}'
                value: '{$CONSUL.LLD.FILTER.SERVICE_NAME.MATCHES}'
              - macro: '{#SERVICE_NAME}'
                value: '{$CONSUL.LLD.FILTER.SERVICE_NAME.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          item_prototypes:
            - uuid: 38576dd458a94259ab273204ffe9aebd
              name: '["{#SERVICE_NAME}"]: Get raw service state'
              type: HTTP_AGENT
              key: 'consul.get_service_stats["{#SERVICE_NAME}"]'
              history: '0'
              value_type: TEXT
              description: 'Retrieve service instances providing the service indicated on the path.'
              preprocessing:
                - type: CHECK_NOT_SUPPORTED
                  parameters:
                    - '-1'
              timeout: 15s
              url: '{$CONSUL.CLUSTER.URL}/v1/health/service/{#SERVICE_NAME}'
              status_codes: '200, 429, 503'
              headers:
                - name: X-Consul-Token
                  value: '{$CONSUL.TOKEN}'
                - name: X-Consul-Namespace
                  value: '{$CONSUL.NAMESPACE}'
              tags:
                - tag: component
                  value: service
                - tag: service
                  value: '{#SERVICE_NAME}'
            - uuid: 70a37e9934fa47f3bd7d553c70179d10
              name: 'Service ["{#SERVICE_NAME}"]: Nodes critical'
              type: DEPENDENT
              key: 'consul.service.nodes_critical["{#SERVICE_NAME}"]'
              description: 'The number of nodes with service status `critical` from those registered.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$[?(@.Service.Service == "{#SERVICE_NAME}")].Checks[?(@.CheckID == "serfHealth" && @.Status == ''critical'')].length()'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 3h
              master_item:
                key: 'consul.get_service_stats["{#SERVICE_NAME}"]'
              tags:
                - tag: component
                  value: service
                - tag: service
                  value: '{#SERVICE_NAME}'
              trigger_prototypes:
                - uuid: 60919b58bd484597aa7ec03f308eb614
                  expression: 'last(/HashiCorp Consul Cluster by HTTP/consul.service.nodes_critical["{#SERVICE_NAME}"])>{$CONSUL.SERVICE_NODES.CRITICAL.MAX.AVG:"{#SERVICE_NAME}"}'
                  name: 'HashiCorp Consul Cluster: Service ["{#SERVICE_NAME}"]: Too many nodes with service status ''critical'''
                  event_name: 'HashiCorp Consul Cluster: Service ["{#SERVICE_NAME}"]: Too many nodes with service status ''critical'' (over {$CONSUL.SERVICE_NODES.CRITICAL.MAX.AVG:"{#SERVICE_NAME}"})'
                  priority: AVERAGE
                  description: 'One or more nodes with service status ''critical''.'
                  tags:
                    - tag: scope
                      value: availability
            - uuid: 3807bd01fda5425694eb8e4169eb4078
              name: 'Service ["{#SERVICE_NAME}"]: Nodes passing'
              type: DEPENDENT
              key: 'consul.service.nodes_passing["{#SERVICE_NAME}"]'
              description: 'The number of nodes with service status `passing` from those registered.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$[?(@.Service.Service == "{#SERVICE_NAME}")].Checks[?(@.CheckID == "serfHealth" && @.Status == ''passing'')].length()'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 3h
              master_item:
                key: 'consul.get_service_stats["{#SERVICE_NAME}"]'
              tags:
                - tag: component
                  value: service
                - tag: service
                  value: '{#SERVICE_NAME}'
            - uuid: 8a23dbb1d28c472291c06e0da572424a
              name: 'Service ["{#SERVICE_NAME}"]: Nodes warning'
              type: DEPENDENT
              key: 'consul.service.nodes_warning["{#SERVICE_NAME}"]'
              description: 'The number of nodes with service status `warning` from those registered.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$[?(@.Service.Service == "{#SERVICE_NAME}")].Checks[?(@.CheckID == "serfHealth" && @.Status == ''warning'')].length()'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 3h
              master_item:
                key: 'consul.get_service_stats["{#SERVICE_NAME}"]'
              tags:
                - tag: component
                  value: service
                - tag: service
                  value: '{#SERVICE_NAME}'
          master_item:
            key: consul.get_catalog_services
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  var data = [];
                  
                  Object.keys(JSON.parse(value)).forEach(function (v) {
                  	data.push({ '{#SERVICE_NAME}': v })
                  });
                  
                  return JSON.stringify(data);
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
      tags:
        - tag: class
          value: network
        - tag: class
          value: software
        - tag: subclass
          value: automation
        - tag: subclass
          value: security
        - tag: target
          value: consul
      macros:
        - macro: '{$CONSUL.API.PORT}'
          value: '8500'
          description: 'Consul API port. Using in node LLD.'
          config:
            type: TEXT
            priority: '5'
            label: Port
            description: 'Consul API port. Using in node LLD. In the range from 1 to 65535 inclusive.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$CONSUL.API.SCHEME}'
          value: http
          description: 'Consul API scheme. Using in node LLD.'
          config:
            type: LIST
            priority: '4'
            label: Scheme
            description: 'Consul API scheme. Using in node LLD.'
            options:
              - value: http
                text: http
              - value: https
                text: https
        - macro: '{$CONSUL.CLUSTER.URL}'
          value: 'http://localhost:8500'
          description: 'Consul cluster URL.'
          config:
            type: TEXT
            priority: '1'
            label: Address
            description: 'Consul cluster URL.'
        - macro: '{$CONSUL.LLD.FILTER.NODE_NAME.MATCHES}'
          value: '.*'
          description: 'Filter of discoverable discovered nodes.'
          config:
            type: TEXT
            priority: '6'
            section_name: Filters
            label: 'Nodes filter (include)'
            description: 'Filter of discoverable discovered nodes.'
        - macro: '{$CONSUL.LLD.FILTER.NODE_NAME.NOT_MATCHES}'
          value: 'CHANGE IF NEEDED'
          description: 'Filter to exclude discovered nodes.'
          config:
            type: TEXT
            priority: '7'
            section_name: Filters
            label: 'Nodes filter (exclude)'
            description: 'Filter to exclude discovered nodes.'
        - macro: '{$CONSUL.LLD.FILTER.SERVICE_NAME.MATCHES}'
          value: '.*'
          description: 'Filter of discoverable discovered services.'
          config:
            type: TEXT
            priority: '8'
            section_name: Filters
            label: 'Services filter (include)'
            description: 'Filter of discoverable discovered services.'
        - macro: '{$CONSUL.LLD.FILTER.SERVICE_NAME.NOT_MATCHES}'
          value: 'CHANGE IF NEEDED'
          description: 'Filter to exclude discovered services.'
          config:
            type: TEXT
            priority: '9'
            section_name: Filters
            label: 'Services filter (exclude)'
            description: 'Filter to exclude discovered services.'
        - macro: '{$CONSUL.NAMESPACE}'
          description: 'Consul service namespace. Enterprise only, in case of Open Source version leave this macro empty. Do not specify this macro to get all of services.'
          config:
            type: TEXT
            priority: '3'
            label: 'Consul service namespace'
            description: 'Consul service namespace. Enterprise only, in case of Open Source version leave this macro empty. Do not specify this macro to get all of services.'
        - macro: '{$CONSUL.SERVICE_NODES.CRITICAL.MAX.AVG}'
          value: '0'
          description: 'Maximum number of service nodes in status ''critical'' for trigger expression. Can be used with context.'
          config:
            type: TEXT
            priority: '10'
            section_name: Thresholds
            label: 'Max critical service nodes'
            description: 'Maximum number of service nodes in status ''critical'' for trigger expression. Can be used with context.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$CONSUL.TOKEN}'
          value: '<PUT YOUR AUTH TOKEN>'
          description: 'Consul auth token.'
          config:
            type: TEXT
            priority: '2'
            label: Token
            description: 'Consul auth token.'
      valuemaps:
        - uuid: 9c120a74ede844e6a410b7e2c2d712bb
          name: 'Consul health state'
          mappings:
            - value: '0'
              newvalue: passing
            - value: '1'
              newvalue: warning
            - value: '2'
              newvalue: critical
            - value: '255'
              newvalue: unknown
    - uuid: 884bdbeea93c4be0a11a2c92a5f8adce
      template: 'HashiCorp Consul Node by HTTP'
      name: 'HashiCorp Consul Node by HTTP'
      description: |
        Get HashiCorp Consul Node metrics by HTTP agent from metrics endpoint.
        
        Don't forget to change macros {$CONSUL.NODE.API.URL}, {$CONSUL.TOKEN}.
        Some metrics may not be collected depending on your HashiCorp Consul instance version and configuration.
        More information about metrics you can find in official documentation: https://www.consul.io/docs/agent/telemetry
        
        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"
      wizard_ready: 'YES'
      readme: |
        ## Overview
        
        The template to monitor HashiCorp Consul by Zabbix that works without any external scripts.  
        Most of the metrics are collected in one go, thanks to Zabbix bulk data collection.  
        Do not forget to enable Prometheus format for export metrics.
        See [documentation](https://www.consul.io/docs/agent/options#telemetry-prometheus_retention_time).  
        More information about metrics you can find in [official documentation](https://www.consul.io/docs/agent/telemetry).  
        
        Template `HashiCorp Consul Node by HTTP` — collects metrics by HTTP agent from /v1/agent/metrics endpoint.
        
        ## Setup
        
        Internal service metrics are collected from /v1/agent/metrics endpoint.
        Do not forget to enable Prometheus format for export metrics. See [documentation](https://www.consul.io/docs/agent/options#telemetry-prometheus_retention_time).
        Template need to use Authorization via API token.
        
        Don't forget to change host wizard configuration field `Address`, `Token`.  
        
        More information about metrics you can find in [official documentation](https://www.consul.io/docs/agent/telemetry). 
        
        This template support [Consul namespaces](https://www.consul.io/docs/enterprise/namespaces). You can set host wizard configuration field {$CONSUL.LLD.FILTER.SERVICE_NAMESPACE.MATCHES}, {$CONSUL.LLD.FILTER.SERVICE_NAMESPACE.NOT_MATCHES} if you want to filter discovered services by namespace.  
        In case of Open Source version service namespace will be set to 'None'.
        
        *NOTE.* Some metrics may not be collected depending on your HashiCorp Consul instance version and configuration.  
        *NOTE.* You maybe are interested in Envoy Proxy by HTTP [template](../../envoy_proxy_http).
      vendor:
        name: Zabbix
        version: 8.0-1
      groups:
        - name: Templates/Applications
      items:
        - uuid: 9f90fe43daaa43369b000754e1630e41
          name: 'ACL: resolves, rate'
          type: DEPENDENT
          key: consul.acl.resolves.rate
          value_type: FLOAT
          description: 'The number of ACL resolves per second.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - consul_acl_ResolveToken_count
                - value
                - ''
              error_handler: DISCARD_VALUE
            - type: CHANGE_PER_SECOND
          master_item:
            key: consul.get_metrics
          tags:
            - tag: component
              value: acl
        - uuid: 1c969d5d7546444e91e883661d63890b
          name: 'Catalog: deregister, rate'
          type: DEPENDENT
          key: consul.catalog.deregister.rate
          value_type: FLOAT
          description: 'The number of catalog deregister operation per second.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - consul_catalog_deregister_count
                - value
                - ''
              error_handler: DISCARD_VALUE
            - type: CHANGE_PER_SECOND
          master_item:
            key: consul.get_metrics
          tags:
            - tag: component
              value: catalog
        - uuid: 8f01480896f8426688aee08e2ee0fc20
          name: 'Catalog: register, rate'
          type: DEPENDENT
          key: consul.catalog.register.rate
          value_type: FLOAT
          description: 'The number of catalog register operation per second.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - consul_catalog_register_count
                - value
                - ''
              error_handler: DISCARD_VALUE
            - type: CHANGE_PER_SECOND
          master_item:
            key: consul.get_metrics
          tags:
            - tag: component
              value: catalog
        - uuid: dabcb6819c9444a6a287a6458056ef31
          name: 'Number of checks'
          type: DEPENDENT
          key: consul.checks_number
          description: 'Number of checks on current node.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.Stats.agent.checks
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
          master_item:
            key: consul.get_node_info
          tags:
            - tag: component
              value: consul
        - uuid: 8e48706f9bda4689bec45f4a80fcc3cb
          name: 'Number of check monitors'
          type: DEPENDENT
          key: consul.check_monitors_number
          description: 'Number of check monitors on current node.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.Stats.agent.check_monitors
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
          master_item:
            key: consul.get_node_info
          tags:
            - tag: component
              value: consul
        - uuid: 2706adc5e5a64c4480269938e2b90fc1
          name: 'Client RPC, per second'
          type: DEPENDENT
          key: consul.client_rpc
          value_type: FLOAT
          units: Rps
          description: |
            Number of times per second whenever a Consul agent in client mode makes an RPC request to a Consul server.
            This gives a measure of how much a given agent is loading the Consul servers.
            This is only generated by agents in client mode, not Consul servers.
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - consul_client_rpc
                - value
                - ''
              error_handler: DISCARD_VALUE
            - type: CHANGE_PER_SECOND
          master_item:
            key: consul.get_metrics
          tags:
            - tag: component
              value: rpc
        - uuid: 3fd30bfd7c324c53a346974c9f38e9db
          name: 'Client RPC failed ,per second'
          type: DEPENDENT
          key: consul.client_rpc_failed
          value_type: FLOAT
          units: Rps
          description: 'Number of times per second whenever a Consul agent in client mode makes an RPC request to a Consul server and fails.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - consul_client_rpc_failed
                - value
                - ''
              error_handler: DISCARD_VALUE
            - type: CHANGE_PER_SECOND
          master_item:
            key: consul.get_metrics
          tags:
            - tag: component
              value: rpc
        - uuid: 12b9bbac571b431ea06a13a7154ef673
          name: 'Process CPU seconds, total'
          type: DEPENDENT
          key: consul.cpu_seconds_total.rate
          value_type: FLOAT
          units: s
          description: 'Total user and system CPU time spent in seconds.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - process_cpu_seconds_total
                - value
                - ''
              error_handler: DISCARD_VALUE
            - type: CHANGE_PER_SECOND
          master_item:
            key: consul.get_metrics
          tags:
            - tag: component
              value: cpu
        - uuid: 7513b847ac754a25972adb3547a871ca
          name: 'GC pause, p50'
          type: DEPENDENT
          key: consul.gc_pause.p50
          value_type: FLOAT
          units: s
          description: 'The 50 percentile (median) for the number of nanoseconds consumed by stop-the-world garbage collection (GC) pauses since Consul started, in milliseconds.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - 'consul_runtime_gc_pause_ns{quantile="0.5"}'
                - value
                - ''
              error_handler: DISCARD_VALUE
            - type: JAVASCRIPT
              parameters:
                - 'return (isNaN(value)) ? 0 : value;'
            - type: MULTIPLIER
              parameters:
                - '1.0E-9'
          master_item:
            key: consul.get_metrics
          tags:
            - tag: component
              value: gs
        - uuid: 3ec74713a835498197e59df962e27bab
          name: 'GC pause, p90'
          type: DEPENDENT
          key: consul.gc_pause.p90
          value_type: FLOAT
          units: s
          description: 'The 90 percentile for the number of nanoseconds consumed by stop-the-world garbage collection (GC) pauses since Consul started, in milliseconds.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - 'consul_runtime_gc_pause_ns{quantile="0.9"}'
                - value
                - ''
              error_handler: DISCARD_VALUE
            - type: JAVASCRIPT
              parameters:
                - 'return (isNaN(value)) ? 0 : value;'
            - type: MULTIPLIER
              parameters:
                - '1.0E-9'
          master_item:
            key: consul.get_metrics
          tags:
            - tag: component
              value: gc
        - uuid: 2b3cbe778f1c4d858e43320b8c25960d
          name: 'Get local services'
          type: SCRIPT
          key: consul.get_local_services
          history: '0'
          value_type: TEXT
          params: |
            var Consul = {
            	setParams: function (params) {
            		['api_endpoint', 'token'].forEach(function (field) {
            			if (typeof params !== 'object' || typeof params[field] === 'undefined' || params[field] === '') {
            				throw 'Required param is not set: "' + field + '".';
            			}
            		});
            
            		Consul.params = params;
            		if (typeof Consul.params.api_endpoint === 'string' && !Consul.params.api_endpoint.endsWith('/')) {
            			Consul.params.api_endpoint += '/';
            		}
            	},
            
            	request: function (query) {
            		var response,
            			request = new HttpRequest(),
            			url = Consul.params.api_endpoint + query;
            
            		request.addHeader('Content-Type: application/json');
            		request.addHeader('X-Consul-Token: ' + Consul.params.token);
            
            		Zabbix.log(4, '[ Consul ] Sending request: ' + url);
            		response = request.get(url);
            
            		Zabbix.log(4, '[ Consul ] Received response with status code ' + request.getStatus() + ': ' + response);
            
            		if (response !== null) {
            			try {
            				response = JSON.parse(response);
            			}
            			catch (error) {
            				throw 'Failed to parse response received from Consul Agent API.';
            			}
            		}
            
            		return {
            			status: request.getStatus(),
            			response: response
            		};
            	},
            
            	getServices: function () {
            		var result = Consul.request('v1/agent/services'),
            			services = [];
            
            		if (typeof result.response !== 'object' || result.status != 200) {
            			throw 'Cannot get service list from Consul Agent API.';
            		}
            
            		Object.keys(result.response).forEach(function (service) {
            			services.push(result.response[service]['ID']);
            		});
            
            		return services;
            	},
            
            	getServiceStats: function (service_id) {
            		var result = Consul.request('v1/agent/health/service/id/' + service_id);
            
            		if (typeof result.response !== 'object' || [200, 429, 503].indexOf(result.status) === -1) {
            			throw 'Cannot get service info from Consul Agent API.';
            		}
            
            		return result.response;
            	}
            }
            
            try {
            	Consul.setParams(JSON.parse(value));
            
            	var services = Consul.getServices(),
            		result = [];
            
            	services.forEach(function (service) {
            		var service_stats = Consul.getServiceStats(service);
            
            		result.push({
            			'id': service,
            			'name': service_stats['Service']['Service'],
            			'status': service_stats['AggregatedStatus'],
            			'checks': service_stats['Checks'],
            			'namespace': typeof service_stats['Service']['Namespace'] === 'undefined' ? 'None' : service_stats['Service']['Namespace']
            		});
            	});
            
            	return JSON.stringify(result);
            }
            catch (error) {
            	error += ((String(error).endsWith('.')) ? '' : '.');
            	Zabbix.log(3, '[ Consul ] ERROR: ' + error);
            
            	return JSON.stringify({error: error + ' Check debug log for more information.'});
            }
          description: 'Get all the services that are registered with the local agent and their status.'
          timeout: 15s
          parameters:
            - name: api_endpoint
              value: '{$CONSUL.NODE.API.URL}'
            - name: token
              value: '{$CONSUL.TOKEN}'
          tags:
            - tag: component
              value: raw
        - uuid: f2fb4c76b4974319846d4773cfb64b0c
          name: 'Get local services check'
          type: DEPENDENT
          key: consul.get_local_services.check
          value_type: CHAR
          description: 'Data collection check.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.error
              error_handler: CUSTOM_VALUE
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
          master_item:
            key: consul.get_local_services
          tags:
            - tag: component
              value: status
          triggers:
            - uuid: 5cf09b213c044033af1d8e1d8821bc38
              expression: 'length(last(/HashiCorp Consul Node by HTTP/consul.get_local_services.check))>0'
              name: 'HashiCorp Consul Node: Failed to get local services'
              priority: WARNING
              description: 'Failed to get local services. Check debug log for more information.'
              tags:
                - tag: scope
                  value: availability
        - uuid: c0e199969c19444fb68fd8497fcab047
          name: 'Get instance metrics'
          type: HTTP_AGENT
          key: consul.get_metrics
          history: '0'
          value_type: TEXT
          description: 'Get raw metrics from Consul instance /metrics endpoint.'
          preprocessing:
            - type: CHECK_NOT_SUPPORTED
              parameters:
                - '-1'
          timeout: 15s
          url: '{$CONSUL.NODE.API.URL}/v1/agent/metrics?format=prometheus'
          headers:
            - name: X-Consul-Token
              value: '{$CONSUL.TOKEN}'
          tags:
            - tag: component
              value: health
            - tag: component
              value: raw
        - uuid: 7e2689de8d78499fb52d718989b7ec8b
          name: 'Get node info'
          type: HTTP_AGENT
          key: consul.get_node_info
          history: '0'
          value_type: TEXT
          description: 'Get configuration and member information of the local agent.'
          preprocessing:
            - type: CHECK_NOT_SUPPORTED
              parameters:
                - '-1'
          timeout: 15s
          url: '{$CONSUL.NODE.API.URL}/v1/agent/self'
          headers:
            - name: X-Consul-Token
              value: '{$CONSUL.TOKEN}'
          tags:
            - tag: component
              value: raw
        - uuid: 2bcd79ab2c0a4ef88c0d2386d9bec1ff
          name: 'Goroutine count'
          type: DEPENDENT
          key: consul.goroutines
          description: 'The number of Goroutines on Consul instance.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - go_goroutines
                - value
                - ''
          master_item:
            key: consul.get_metrics
          tags:
            - tag: component
              value: goroutines
        - uuid: 6613be65c0794e76a210263810a4692d
          name: 'KV store: apply, p50'
          type: DEPENDENT
          key: consul.kvs.apply.p50
          value_type: FLOAT
          units: ms
          description: 'The 50 percentile (median) for the time it takes to complete an update to the KV store.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - 'consul_kvs_apply{quantile="0.5"}'
                - value
                - ''
              error_handler: DISCARD_VALUE
            - type: JAVASCRIPT
              parameters:
                - 'return (isNaN(value)) ? 0 : value;'
          master_item:
            key: consul.get_metrics
          tags:
            - tag: component
              value: kvs
        - uuid: 2dc05550018c4d67bab58bd8f86bc365
          name: 'KV store: apply, p90'
          type: DEPENDENT
          key: consul.kvs.apply.p90
          value_type: FLOAT
          units: ms
          description: 'The 90 percentile for the time it takes to complete an update to the KV store.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - 'consul_kvs_apply{quantile="0.9"}'
                - value
                - ''
              error_handler: DISCARD_VALUE
            - type: JAVASCRIPT
              parameters:
                - 'return (isNaN(value)) ? 0 : value;'
          master_item:
            key: consul.get_metrics
          tags:
            - tag: component
              value: kvs
        - uuid: 978bf96102d0411f8c18e92652a003c4
          name: 'KV store: apply, rate'
          type: DEPENDENT
          key: consul.kvs.apply.rate
          value_type: FLOAT
          description: 'The number of updates to the KV store per second.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - consul_kvs_apply_count
                - value
                - ''
              error_handler: DISCARD_VALUE
            - type: CHANGE_PER_SECOND
          master_item:
            key: consul.get_metrics
          tags:
            - tag: component
              value: kvs
        - uuid: 1b21a53ce7144350af8b50e57c3acf6b
          name: 'Memberlist: degraded'
          type: DEPENDENT
          key: consul.memberlist.degraded
          description: |
            This metric counts the number of times the Consul agent has performed failure detection on another agent at a slower probe rate.
            The agent uses its own health metric as an indicator to perform this action.
            If its health score is low, it means that the node is healthy, and vice versa.
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - consul_memberlist_degraded
                - value
                - ''
              error_handler: DISCARD_VALUE
          master_item:
            key: consul.get_metrics
          tags:
            - tag: component
              value: health
        - uuid: 0a3b25abf7de4212bda5c92c13341593
          name: 'Memberlist: gossip, p90'
          type: DEPENDENT
          key: consul.memberlist.dispatch_log.p90
          value_type: FLOAT
          description: 'The 90 percentile for the number of gossips (messages) broadcasted to a set of randomly selected nodes.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - 'consul_memberlist_gossip{quantile="0.9"}'
                - value
                - ''
              error_handler: DISCARD_VALUE
            - type: JAVASCRIPT
              parameters:
                - 'return (isNaN(value)) ? 0 : value;'
          master_item:
            key: consul.get_metrics
          tags:
            - tag: component
              value: gossip
        - uuid: 592fb528d5c14491892c496f7ce9a60b
          name: 'Memberlist: gossip, p50'
          type: DEPENDENT
          key: consul.memberlist.gossip.p50
          value_type: FLOAT
          units: ms
          description: 'The 50 for the number of gossips (messages) broadcasted to a set of randomly selected nodes.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - 'consul_memberlist_gossip{quantile="0.5"}'
                - value
                - ''
              error_handler: DISCARD_VALUE
            - type: JAVASCRIPT
              parameters:
                - 'return (isNaN(value)) ? 0 : value;'
          master_item:
            key: consul.get_metrics
          tags:
            - tag: component
              value: gossip
        - uuid: 32259a799f6949e4be4f7d8722a2dbbe
          name: 'Memberlist: health score'
          type: DEPENDENT
          key: consul.memberlist.health_score
          description: |
            This metric describes a node's perception of its own health based on how well it is meeting the soft real-time requirements of the protocol.
            This metric ranges from 0 to 8, where 0 indicates "totally healthy".
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - consul_memberlist_health_score
                - value
                - ''
              error_handler: DISCARD_VALUE
          master_item:
            key: consul.get_metrics
          tags:
            - tag: component
              value: health
          triggers:
            - uuid: f964a907c55148bf80991352c7f2ae83
              expression: 'max(/HashiCorp Consul Node by HTTP/consul.memberlist.health_score,#3)>{$CONSUL.NODE.HEALTH_SCORE.MAX.HIGH}'
              name: 'HashiCorp Consul Node: Node''s health score is critical'
              event_name: 'HashiCorp Consul Node: Node''s health score is over {$CONSUL.NODE.HEALTH_SCORE.MAX.HIGH}'
              priority: AVERAGE
              description: |
                This metric ranges from 0 to 8, where 0 indicates "totally healthy".
                This health score is used to scale the time between outgoing probes, and higher scores translate into longer probing intervals.
                For more details see section IV of the Lifeguard paper: https://arxiv.org/pdf/1707.00788.pdf
              tags:
                - tag: scope
                  value: availability
            - uuid: 1fedc58f33ed4b9797fb37acfceba192
              expression: 'max(/HashiCorp Consul Node by HTTP/consul.memberlist.health_score,#3)>{$CONSUL.NODE.HEALTH_SCORE.MAX.WARN}'
              name: 'HashiCorp Consul Node: Node''s health score is warning'
              event_name: 'HashiCorp Consul Node: Node''s health score is too high (over {$CONSUL.NODE.HEALTH_SCORE.MAX.WARN} for 3m)'
              priority: WARNING
              description: |
                This metric ranges from 0 to 8, where 0 indicates "totally healthy".
                This health score is used to scale the time between outgoing probes, and higher scores translate into longer probing intervals.
                For more details see section IV of the Lifeguard paper: https://arxiv.org/pdf/1707.00788.pdf
              dependencies:
                - name: 'HashiCorp Consul Node: Node''s health score is critical'
                  expression: 'max(/HashiCorp Consul Node by HTTP/consul.memberlist.health_score,#3)>{$CONSUL.NODE.HEALTH_SCORE.MAX.HIGH}'
              tags:
                - tag: scope
                  value: availability
        - uuid: 1ebba76d809b415488fb0591afeaef6f
          name: 'Memberlist: msg alive'
          type: DEPENDENT
          key: consul.memberlist.msg.alive
          description: 'This metric counts the number of alive Consul agents, that the agent has mapped out so far, based on the message information given by the network layer.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - consul_memberlist_msg_alive
                - value
                - ''
              error_handler: DISCARD_VALUE
          master_item:
            key: consul.get_metrics
          tags:
            - tag: component
              value: health
        - uuid: 9768a2ce01de4bfe92a17935791b4da4
          name: 'Memberlist: msg dead'
          type: DEPENDENT
          key: consul.memberlist.msg.dead
          description: 'This metric counts the number of times a Consul agent has marked another agent to be a dead node.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - consul_memberlist_msg_dead
                - value
                - ''
              error_handler: DISCARD_VALUE
          master_item:
            key: consul.get_metrics
          tags:
            - tag: component
              value: health
        - uuid: 43ea04dd91ba4c208e9ad09bbc0016af
          name: 'Memberlist: msg suspect'
          type: DEPENDENT
          key: consul.memberlist.msg.suspect
          description: 'The number of times a Consul agent suspects another as failed while probing during gossip protocol.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - consul_memberlist_msg_suspect
                - value
                - ''
              error_handler: DISCARD_VALUE
          master_item:
            key: consul.get_metrics
          tags:
            - tag: component
              value: health
        - uuid: 8b3ee806fcf34a46aa61cbfee460d9f7
          name: 'Memberlist: probe node, p50'
          type: DEPENDENT
          key: consul.memberlist.probe_node.p50
          value_type: FLOAT
          units: ms
          description: 'The 50 percentile (median) for the time taken to perform a single round of failure detection on a select Consul agent.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - 'consul_memberlist_probeNode{quantile="0.5"}'
                - value
                - ''
              error_handler: DISCARD_VALUE
            - type: JAVASCRIPT
              parameters:
                - 'return (isNaN(value)) ? 0 : value;'
          master_item:
            key: consul.get_metrics
          tags:
            - tag: component
              value: memberlist
        - uuid: 9a178ba5f7fa4d9a8ecfddfe84257ab6
          name: 'Memberlist: probe node, p90'
          type: DEPENDENT
          key: consul.memberlist.probe_node.p90
          value_type: FLOAT
          units: ms
          description: 'The 90 percentile for the time taken to perform a single round of failure detection on a select Consul agent.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - 'consul_memberlist_probeNode{quantile="0.9"}'
                - value
                - ''
              error_handler: DISCARD_VALUE
            - type: JAVASCRIPT
              parameters:
                - 'return (isNaN(value)) ? 0 : value;'
          master_item:
            key: consul.get_metrics
          tags:
            - tag: component
              value: memberlist
        - uuid: ef688e2ad7494a08a535c019fe19c0a9
          name: 'Memberlist: push pull node, p50'
          type: DEPENDENT
          key: consul.memberlist.push_pull_node.p50
          value_type: FLOAT
          description: 'The 50 percentile (median) for the number of Consul agents that have exchanged state with this agent.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - 'consul_memberlist_pushPullNode{quantile="0.5"}'
                - value
                - ''
              error_handler: DISCARD_VALUE
            - type: JAVASCRIPT
              parameters:
                - 'return (isNaN(value)) ? 0 : value;'
          master_item:
            key: consul.get_metrics
          tags:
            - tag: component
              value: memberlist
        - uuid: ae085470652242ba8a2077bebee7a2c7
          name: 'Memberlist: push pull node, p90'
          type: DEPENDENT
          key: consul.memberlist.push_pull_node.p90
          value_type: FLOAT
          units: ms
          description: 'The 90 percentile for the number of Consul agents that have exchanged state with this agent.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - 'consul_memberlist_pushPullNode{quantile="0.9"}'
                - value
                - ''
              error_handler: DISCARD_VALUE
            - type: JAVASCRIPT
              parameters:
                - 'return (isNaN(value)) ? 0 : value;'
          master_item:
            key: consul.get_metrics
          tags:
            - tag: component
              value: memberlist
        - uuid: a5d4e2e589564cc9898537c0a8c6a21a
          name: 'TCP connections, accepted per second'
          type: DEPENDENT
          key: consul.memberlist.tcp_accept
          value_type: FLOAT
          units: Rps
          description: 'This metric counts the number of times a Consul agent has accepted an incoming TCP stream connection per second.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - consul_memberlist_tcp_accept
                - value
                - ''
              error_handler: DISCARD_VALUE
            - type: CHANGE_PER_SECOND
          master_item:
            key: consul.get_metrics
          tags:
            - tag: component
              value: tcp
        - uuid: df0a553d811444d1ab767563a1d513a3
          name: 'TCP connections, per second'
          type: DEPENDENT
          key: consul.memberlist.tcp_connect
          value_type: FLOAT
          units: Rps
          description: 'This metric counts the number of times a Consul agent has initiated a push/pull sync with an other agent per second.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - consul_memberlist_tcp_connect
                - value
                - ''
              error_handler: DISCARD_VALUE
            - type: CHANGE_PER_SECOND
          master_item:
            key: consul.get_metrics
          tags:
            - tag: component
              value: tcp
        - uuid: ba12a6464199443d8d73164a8dd87f4f
          name: 'TCP send bytes, per second'
          type: DEPENDENT
          key: consul.memberlist.tcp_sent
          value_type: FLOAT
          units: Bps
          description: 'This metric measures the total number of bytes sent by a Consul agent through the TCP protocol per second.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - consul_memberlist_tcp_sent
                - value
                - ''
              error_handler: DISCARD_VALUE
            - type: CHANGE_PER_SECOND
          master_item:
            key: consul.get_metrics
          tags:
            - tag: component
              value: tcp
        - uuid: dde5f5c5c7d44f1dbbcddb4a541f41cc
          name: 'UDP received bytes, per second'
          type: DEPENDENT
          key: consul.memberlist.udp_received
          value_type: FLOAT
          units: Bps
          description: 'This metric measures the total number of bytes received by a Consul agent through the UDP protocol per second.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - consul_memberlist_udp_received
                - value
                - ''
              error_handler: DISCARD_VALUE
            - type: CHANGE_PER_SECOND
          master_item:
            key: consul.get_metrics
          tags:
            - tag: component
              value: udp
        - uuid: fa79687f332f4136881577838476c329
          name: 'UDP sent bytes, per second'
          type: DEPENDENT
          key: consul.memberlist.udp_sent
          value_type: FLOAT
          units: Bps
          description: 'This metric measures the total number of bytes sent by a Consul agent through the UDP protocol per second.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - consul_memberlist_udp_sent
                - value
                - ''
              error_handler: DISCARD_VALUE
            - type: CHANGE_PER_SECOND
          master_item:
            key: consul.get_metrics
          tags:
            - tag: component
              value: udp
        - uuid: 59b28123e8154318aca6a283a1b18391
          name: 'Open file descriptors, max'
          type: DEPENDENT
          key: consul.process_max_fds
          value_type: FLOAT
          description: 'Maximum number of open file descriptors.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - process_max_fds
                - value
                - ''
          master_item:
            key: consul.get_metrics
          tags:
            - tag: component
              value: fds
        - uuid: 38ad7b5d43004865bd823f1dae61395a
          name: 'Open file descriptors'
          type: DEPENDENT
          key: consul.process_open_fds
          value_type: FLOAT
          description: 'Number of open file descriptors.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - process_open_fds
                - value
                - ''
          master_item:
            key: consul.get_metrics
          tags:
            - tag: component
              value: fds
        - uuid: 8cb242ddeb7f4a0685c706a24f1f85c5
          name: 'RSS memory usage'
          type: DEPENDENT
          key: consul.resident_memory_bytes
          value_type: FLOAT
          units: B
          description: 'Resident memory size in bytes.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - process_resident_memory_bytes
                - value
                - ''
          master_item:
            key: consul.get_metrics
          tags:
            - tag: component
              value: memory
        - uuid: ee52c7cd8a4d452d85564a47c44198a6
          name: Role
          type: DEPENDENT
          key: consul.role
          description: 'Role of current Consul agent.'
          valuemap:
            name: 'Consul Node role'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.Config.Server
            - type: BOOL_TO_DECIMAL
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
          master_item:
            key: consul.get_node_info
          tags:
            - tag: component
              value: consul
        - uuid: e311c5bdba3e45b68887bc924c7dc206
          name: 'Serf member: failed, rate'
          type: DEPENDENT
          key: consul.serf.member.failed.rate
          value_type: FLOAT
          description: |
            Increments when an agent is marked dead.
            This can be an indicator of overloaded agents, network problems, or configuration errors where agents cannot connect to each other on the required ports.
            Shown as events per second.
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - consul_serf_member_failed
                - value
                - ''
              error_handler: DISCARD_VALUE
            - type: CHANGE_PER_SECOND
          master_item:
            key: consul.get_metrics
          tags:
            - tag: component
              value: serf
        - uuid: 11ba84beb3494504bd514500ef663cff
          name: 'Serf member: flap, rate'
          type: DEPENDENT
          key: consul.serf.member.flap.rate
          value_type: FLOAT
          description: |
            Increments when an agent is marked dead and then recovers within a short time period.
            This can be an indicator of overloaded agents, network problems, or configuration errors where agents cannot connect to each other on the required ports.
            Shown as events per second.
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - consul_serf_member_flap
                - value
                - ''
              error_handler: DISCARD_VALUE
            - type: CHANGE_PER_SECOND
          master_item:
            key: consul.get_metrics
          tags:
            - tag: component
              value: serf
        - uuid: f4c224ffb17d49029fef6647dde22c90
          name: 'Serf member: join, rate'
          type: DEPENDENT
          key: consul.serf.member.join.rate
          value_type: FLOAT
          description: |
            Increments when an agent joins the cluster. If an agent flapped or failed this counter also increments when it re-joins.
            Shown as events per second.
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - consul_serf_member_join
                - value
                - ''
              error_handler: DISCARD_VALUE
            - type: CHANGE_PER_SECOND
          master_item:
            key: consul.get_metrics
          tags:
            - tag: component
              value: serf
        - uuid: 3264823eb6774c2092b4ffe4638b61a5
          name: 'Serf member: left, rate'
          type: DEPENDENT
          key: consul.serf.member.left.rate
          value_type: FLOAT
          description: 'Increments when an agent leaves the cluster. Shown as events per second.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - consul_serf_member_left
                - value
                - ''
              error_handler: DISCARD_VALUE
            - type: CHANGE_PER_SECOND
          master_item:
            key: consul.get_metrics
          tags:
            - tag: component
              value: serf
        - uuid: 53bb4e76cd1840e8ae9a129d592e202e
          name: 'Serf member: update, rate'
          type: DEPENDENT
          key: consul.serf.member.update.rate
          value_type: FLOAT
          description: 'Increments when a Consul agent updates. Shown as events per second.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - consul_serf_member_update
                - value
                - ''
              error_handler: DISCARD_VALUE
            - type: CHANGE_PER_SECOND
          master_item:
            key: consul.get_metrics
          tags:
            - tag: component
              value: serf
        - uuid: 614e63c6eb254b45a5fb3dbb985c5c3c
          name: 'Number of services'
          type: DEPENDENT
          key: consul.services_number
          description: 'Number of services on current node.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.Stats.agent.services
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
          master_item:
            key: consul.get_node_info
          tags:
            - tag: component
              value: consul
        - uuid: d9988aeda27f4fb09ececcde13efc71a
          name: 'Snapshot: append line, p50'
          type: DEPENDENT
          key: consul.snapshot.append_line.p50
          value_type: FLOAT
          units: ms
          description: 'The 50 percentile (median) for the time taken by the Consul agent to append an entry into the existing log.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - 'consul_serf_snapshot_appendLine{quantile="0.5"}'
                - value
                - ''
              error_handler: DISCARD_VALUE
            - type: JAVASCRIPT
              parameters:
                - 'return (isNaN(value)) ? 0 : value;'
          master_item:
            key: consul.get_metrics
          tags:
            - tag: component
              value: snapshot
        - uuid: 0b701ec082e64eb19e60650c13cd44fd
          name: 'Snapshot: append line, p90'
          type: DEPENDENT
          key: consul.snapshot.append_line.p90
          value_type: FLOAT
          units: ms
          description: 'The 90 percentile for the time taken by the Consul agent to append an entry into the existing log.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - 'consul_serf_snapshot_appendLine{quantile="0.9"}'
                - value
                - ''
              error_handler: DISCARD_VALUE
            - type: JAVASCRIPT
              parameters:
                - 'return (isNaN(value)) ? 0 : value;'
          master_item:
            key: consul.get_metrics
          tags:
            - tag: component
              value: snapshot
        - uuid: d56de8b09978421c9703fe327d03a32b
          name: 'Snapshot: append line, rate'
          type: DEPENDENT
          key: consul.snapshot.append_line.rate
          value_type: FLOAT
          description: 'The number of snapshot appendLine operations per second.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - consul_serf_snapshot_appendLine_count
                - value
                - ''
              error_handler: DISCARD_VALUE
            - type: CHANGE_PER_SECOND
          master_item:
            key: consul.get_metrics
          tags:
            - tag: component
              value: snapshot
        - uuid: 12e1a4538f124c4281106b9033b1592d
          name: 'Snapshot: compact, p50'
          type: DEPENDENT
          key: consul.snapshot.compact.p50
          value_type: FLOAT
          units: ms
          description: |
            The 50 percentile (median) for the time taken by the Consul agent to compact a log.
            This operation occurs only when the snapshot becomes large enough to justify the compaction.
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - 'consul_serf_snapshot_compact{quantile="0.5"}'
                - value
                - ''
              error_handler: DISCARD_VALUE
            - type: JAVASCRIPT
              parameters:
                - 'return (isNaN(value)) ? 0 : value;'
          master_item:
            key: consul.get_metrics
          tags:
            - tag: component
              value: snapshot
        - uuid: c55de444dd30484eb116abfd6f28a9a0
          name: 'Snapshot: compact, p90'
          type: DEPENDENT
          key: consul.snapshot.compact.p90
          value_type: FLOAT
          units: ms
          description: |
            The 90 percentile for the time taken by the Consul agent to compact a log.
            This operation occurs only when the snapshot becomes large enough to justify the compaction.
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - 'consul_serf_snapshot_compact{quantile="0.9"}'
                - value
                - ''
              error_handler: DISCARD_VALUE
            - type: JAVASCRIPT
              parameters:
                - 'return (isNaN(value)) ? 0 : value;'
          master_item:
            key: consul.get_metrics
          tags:
            - tag: component
              value: snapshot
        - uuid: 586be345685b4f0dbbb31f2062bebc01
          name: 'Snapshot: compact, rate'
          type: DEPENDENT
          key: consul.snapshot.compact.rate
          value_type: FLOAT
          description: 'The number of snapshot compact operations per second.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - consul_serf_snapshot_compact_count
                - value
                - ''
              error_handler: DISCARD_VALUE
            - type: CHANGE_PER_SECOND
          master_item:
            key: consul.get_metrics
          tags:
            - tag: component
              value: snapshot
        - uuid: 777e8cdd1cfc4f4bba613ef08320f1bb
          name: Version
          type: DEPENDENT
          key: consul.version
          value_type: CHAR
          description: 'Version of Consul agent.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.Config.Version
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
          master_item:
            key: consul.get_node_info
          tags:
            - tag: component
              value: consul
          triggers:
            - uuid: fa78d269c01548a083085a3a98e5a59b
              expression: 'last(/HashiCorp Consul Node by HTTP/consul.version,#1)<>last(/HashiCorp Consul Node by HTTP/consul.version,#2) and length(last(/HashiCorp Consul Node by HTTP/consul.version))>0'
              name: 'HashiCorp Consul Node: Version has been changed'
              event_name: 'HashiCorp Consul Node: Version has changed (new version: {ITEM.VALUE})'
              priority: INFO
              description: 'Consul version has changed. Acknowledge to close the problem manually.'
              manual_close: 'YES'
              tags:
                - tag: scope
                  value: notice
        - uuid: 62c0bb503c084f9da10f1be3c716608b
          name: 'Virtual memory size'
          type: DEPENDENT
          key: consul.virtual_memory_bytes
          value_type: FLOAT
          units: B
          description: 'Virtual memory size in bytes.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - process_virtual_memory_bytes
                - value
                - ''
          master_item:
            key: consul.get_metrics
          tags:
            - tag: component
              value: memory
      discovery_rules:
        - uuid: 565c42fc4e444433aaafd656813b82f7
          name: 'HTTP API methods discovery'
          type: DEPENDENT
          key: consul.http_api_discovery
          description: 'Discovery HTTP API methods specific metrics.'
          item_prototypes:
            - uuid: 4bdb2007bada4840aa453630e701059c
              name: 'HTTP request: ["{#HTTP_METHOD}"], p50'
              type: DEPENDENT
              key: 'consul.http.api.p50["{#HTTP_METHOD}"]'
              value_type: FLOAT
              units: ms
              description: 'The 50 percentile (median) of how long it takes to service the given HTTP request for the given verb.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'consul_api_http{method = "{#HTTP_METHOD}", quantile = "0.5"}'
                    - function
                    - sum
                  error_handler: DISCARD_VALUE
              master_item:
                key: consul.get_metrics
              tags:
                - tag: component
                  value: api
                - tag: verb
                  value: '{#HTTP_METHOD}'
            - uuid: 537b455889d54deab7ada216a89f1cb2
              name: 'HTTP request: ["{#HTTP_METHOD}"], p90'
              type: DEPENDENT
              key: 'consul.http.api.p90["{#HTTP_METHOD}"]'
              value_type: FLOAT
              units: ms
              description: 'The 90 percentile of how long it takes to service the given HTTP request for the given verb.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'consul_api_http{method = "{#HTTP_METHOD}", quantile = "0.9"}'
                    - function
                    - sum
                  error_handler: DISCARD_VALUE
              master_item:
                key: consul.get_metrics
              tags:
                - tag: component
                  value: api
                - tag: verb
                  value: '{#HTTP_METHOD}'
            - uuid: 53cdb47018df434381f7fc3e401a4dee
              name: 'HTTP request: ["{#HTTP_METHOD}"], rate'
              type: DEPENDENT
              key: 'consul.http.api.rate["{#HTTP_METHOD}"]'
              value_type: FLOAT
              units: Rps
              description: 'The number of HTTP request for the given verb per second.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'consul_api_http_count{method = "{#HTTP_METHOD}"}'
                    - function
                    - sum
                  error_handler: DISCARD_VALUE
                - type: CHANGE_PER_SECOND
              master_item:
                key: consul.get_metrics
              tags:
                - tag: component
                  value: api
                - tag: verb
                  value: '{#HTTP_METHOD}'
          master_item:
            key: consul.get_metrics
          preprocessing:
            - type: PROMETHEUS_TO_JSON
              parameters:
                - 'consul_api_http{method =~ ".*"}'
              error_handler: DISCARD_VALUE
            - type: JAVASCRIPT
              parameters:
                - |
                  var lookup = {},
                  	result = [];
                  
                  JSON.parse(value).forEach(function (item) {
                  	var http_method = item.labels.method;
                  	if (!(lookup[http_method])) {
                  		lookup[http_method] = 1;
                  		result.push({ "{#HTTP_METHOD}": http_method });
                  	}
                  })
                  
                  return JSON.stringify(result);
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
        - uuid: dd87920ea8184ec793229878407a0993
          name: 'Local node services discovery'
          type: DEPENDENT
          key: consul.node_services_lld
          filter:
            conditions:
              - macro: '{#SERVICE_NAME}'
                value: '{$CONSUL.LLD.FILTER.LOCAL_SERVICE_NAME.MATCHES}'
              - macro: '{#SERVICE_NAME}'
                value: '{$CONSUL.LLD.FILTER.LOCAL_SERVICE_NAME.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
              - macro: '{#SERVICE_NAMESPACE}'
                value: '{$CONSUL.LLD.FILTER.SERVICE_NAMESPACE.MATCHES}'
              - macro: '{#SERVICE_NAMESPACE}'
                value: '{$CONSUL.LLD.FILTER.SERVICE_NAMESPACE.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          description: 'Discover metrics for services that are registered with the local agent.'
          item_prototypes:
            - uuid: 44b0f82769d244d6a20b9ce0b5cc5cb6
              name: '["{#SERVICE_NAME}"]: Aggregated status'
              type: DEPENDENT
              key: 'consul.service.aggregated_state["{#SERVICE_ID}"]'
              discover: NO_DISCOVER
              description: 'Aggregated values of all health checks for the service instance.'
              valuemap:
                name: 'Consul health state'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$[?(@.id == "{#SERVICE_ID}")].status.first()'
                - type: JAVASCRIPT
                  parameters:
                    - |
                      var state = ['passing', 'warning', 'critical'];
                      
                      return state.indexOf(value.trim()) === -1 ? 255 : state.indexOf(value.trim());
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 3h
              master_item:
                key: consul.get_local_services
              tags:
                - tag: component
                  value: service
                - tag: namespace
                  value: '{#SERVICE_NAMESPACE}'
                - tag: service
                  value: '{#SERVICE_NAME}'
              trigger_prototypes:
                - uuid: 661551e1e9e94b25b7bd6ea876640b6d
                  expression: 'last(/HashiCorp Consul Node by HTTP/consul.service.aggregated_state["{#SERVICE_ID}"]) = 2'
                  name: 'HashiCorp Consul Node: Aggregated status is ''critical'''
                  event_name: 'HashiCorp Consul Node: Node''s health score is over {$CONSUL.NODE.HEALTH_SCORE.MAX.HIGH}'
                  priority: AVERAGE
                  description: 'Aggregated state of service on the local agent is ''critical''.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: 724f6a5e16f64a779a71ad9a9378fb60
                  expression: 'last(/HashiCorp Consul Node by HTTP/consul.service.aggregated_state["{#SERVICE_ID}"]) = 1'
                  name: 'HashiCorp Consul Node: Aggregated status is ''warning'''
                  priority: WARNING
                  description: 'Aggregated state of service on the local agent is ''warning''.'
                  tags:
                    - tag: scope
                      value: availability
            - uuid: 20a0ec9e059548a192c9c37bd7aeaaed
              name: '["{#SERVICE_NAME}"]: Check ["{#SERVICE_CHECK_NAME}"]: Output'
              type: DEPENDENT
              key: 'consul.service.check.output["{#SERVICE_ID}/{#SERVICE_CHECK_ID}"]'
              value_type: CHAR
              discover: NO_DISCOVER
              description: 'Current output of health check for the service.'
              valuemap:
                name: 'Consul health state'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$[?(@.id == "{#SERVICE_ID}")].checks[?(@.CheckID == "{#SERVICE_CHECK_ID}")].Output.first()'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 3h
              master_item:
                key: consul.get_local_services
              tags:
                - tag: check
                  value: '{#SERVICE_CHECK_NAME}'
                - tag: component
                  value: service
                - tag: namespace
                  value: '{#SERVICE_NAMESPACE}'
                - tag: service
                  value: '{#SERVICE_NAME}'
            - uuid: 3b67eb4df3dc4d9b9f4ab4c35a592367
              name: '["{#SERVICE_NAME}"]: Check ["{#SERVICE_CHECK_NAME}"]: Status'
              type: DEPENDENT
              key: 'consul.service.check.state["{#SERVICE_ID}/{#SERVICE_CHECK_ID}"]'
              discover: NO_DISCOVER
              description: 'Current state of health check for the service.'
              valuemap:
                name: 'Consul health state'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$[?(@.id == "{#SERVICE_ID}")].checks[?(@.CheckID == "{#SERVICE_CHECK_ID}")].Status.first()'
                - type: JAVASCRIPT
                  parameters:
                    - |
                      var state = ['passing', 'warning', 'critical'];
                      
                      return state.indexOf(value.trim()) === -1 ? 255 : state.indexOf(value.trim());
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 3h
              master_item:
                key: consul.get_local_services
              tags:
                - tag: check
                  value: '{#SERVICE_CHECK_NAME}'
                - tag: component
                  value: service
                - tag: namespace
                  value: '{#SERVICE_NAMESPACE}'
                - tag: service
                  value: '{#SERVICE_NAME}'
          master_item:
            key: consul.get_local_services
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  var data = JSON.parse(value),
                  	result = [];
                  
                  if (data.length === 0) {
                  	return '[]'
                  };
                  data.forEach(function (service) {
                  
                  	result.push({
                  		'{#TYPE}': 'aggregated_status',
                  		'{#SERVICE_NAME}': service.name,
                  		'{#SERVICE_ID}': service.id,
                  		'{#SERVICE_NAMESPACE}': service.namespace
                  	});
                  
                  	if (service['checks'] !== 0) {
                  		service['checks'].forEach(function (check) {
                  			result.push({
                  				'{#TYPE}': 'service_check',
                  				'{#SERVICE_NAME}': service.name,
                  				'{#SERVICE_ID}': service.id,
                  				'{#SERVICE_NAMESPACE}': service.namespace,
                  				'{#SERVICE_CHECK_ID}': check["CheckID"],
                  				'{#SERVICE_CHECK_NAME}': check["Name"]
                  			});
                  		});
                  	}
                  
                  });
                  
                  return JSON.stringify(result)
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
          overrides:
            - name: 'aggregated status'
              step: '1'
              filter:
                conditions:
                  - macro: '{#TYPE}'
                    value: aggregated_status
              operations:
                - operator: LIKE
                  value: 'Aggregated status'
                  discover: DISCOVER
                - operator: LIKE
                  value: State
                  discover: DISCOVER
            - name: checks
              step: '2'
              filter:
                conditions:
                  - macro: '{#TYPE}'
                    value: service_check
              operations:
                - operator: LIKE
                  value: Check
                  discover: DISCOVER
        - uuid: 6ff39fd6911945b2baa9b762d5a86df2
          name: 'Raft leader metrics discovery'
          type: DEPENDENT
          key: consul.raft.leader.discovery
          description: 'Discover raft metrics for leader nodes.'
          item_prototypes:
            - uuid: 440e2a259cd64b918ebfb607961da2c8
              name: 'Autopilot healthy'
              type: DEPENDENT
              key: 'consul.autopilot.healthy[{#SINGLETON}]'
              value_type: FLOAT
              description: 'Tracks the overall health of the local server cluster. 1 if all servers are healthy, 0 if one or more are unhealthy.'
              valuemap:
                name: 'Consul Autopilot healthy'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - consul_autopilot_healthy
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: consul.get_metrics
              tags:
                - tag: component
                  value: health
            - uuid: 2e4fd6c5aac84054aef867fc9d8cb3c5
              name: 'Raft state: commit time, p50'
              type: DEPENDENT
              key: 'consul.raft.commit_time.p50[{#SINGLETON}]'
              value_type: FLOAT
              units: ms
              description: 'The 50 percentile (median) time it takes to commit a new entry to the raft log on the leader, in milliseconds.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'consul_raft_commitTime{quantile="0.5"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
                - type: JAVASCRIPT
                  parameters:
                    - 'return (isNaN(value)) ? 0 : value;'
              master_item:
                key: consul.get_metrics
              tags:
                - tag: component
                  value: raft
            - uuid: 9428c07a23364967aef060cf3303b996
              name: 'Raft state: commit time, p90'
              type: DEPENDENT
              key: 'consul.raft.commit_time.p90[{#SINGLETON}]'
              value_type: FLOAT
              units: ms
              description: 'The 90 percentile time it takes to commit a new entry to the raft log on the leader, in milliseconds.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'consul_raft_commitTime{quantile="0.9"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
                - type: JAVASCRIPT
                  parameters:
                    - 'return (isNaN(value)) ? 0 : value;'
              master_item:
                key: consul.get_metrics
              tags:
                - tag: component
                  value: raft
            - uuid: d54c97e8c4204f8c9f79911440f1bd13
              name: 'Raft state: commit, rate'
              type: DEPENDENT
              key: 'consul.raft.commit_time.rate[{#SINGLETON}]'
              value_type: FLOAT
              units: Rps
              description: 'The number of commits a new entry to the Raft log on the leader per second.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - consul_raft_commitTime_count
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
                - type: CHANGE_PER_SECOND
              master_item:
                key: consul.get_metrics
              tags:
                - tag: component
                  value: raft
            - uuid: 3c56ebe6e022430e861488873ac6f716
              name: 'Raft state: dispatch log, p50'
              type: DEPENDENT
              key: 'consul.raft.dispatch_log.p50[{#SINGLETON}]'
              value_type: FLOAT
              units: ms
              description: 'The 50 percentile (median) time it takes for the leader to write log entries to disk, in milliseconds.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'consul_raft_leader_dispatchLog{quantile="0.5"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
                - type: JAVASCRIPT
                  parameters:
                    - 'return (isNaN(value)) ? 0 : value;'
              master_item:
                key: consul.get_metrics
              tags:
                - tag: component
                  value: raft
            - uuid: fd1e6c33254b467f8355491dc96889eb
              name: 'Raft state: dispatch log, p90'
              type: DEPENDENT
              key: 'consul.raft.dispatch_log.p90[{#SINGLETON}]'
              value_type: FLOAT
              units: ms
              description: 'The 90 percentile time it takes for the leader to write log entries to disk, in milliseconds.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'consul_raft_leader_dispatchLog{quantile="0.9"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
                - type: JAVASCRIPT
                  parameters:
                    - 'return (isNaN(value)) ? 0 : value;'
              master_item:
                key: consul.get_metrics
              tags:
                - tag: component
                  value: raft
            - uuid: bc73aeda20a543ac957d1531f25fd5a9
              name: 'Raft state: dispatch log, rate'
              type: DEPENDENT
              key: 'consul.raft.dispatch_log.rate[{#SINGLETON}]'
              value_type: FLOAT
              description: 'The number of times a Raft leader writes a log to disk per second.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - consul_raft_leader_dispatchLog_count
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
                - type: CHANGE_PER_SECOND
              master_item:
                key: consul.get_metrics
              tags:
                - tag: component
                  value: raft
            - uuid: 526a787732224555adde561ec86844fb
              name: 'Raft state: leader last contact, p50'
              type: DEPENDENT
              key: 'consul.raft.leader_last_contact.p50[{#SINGLETON}]'
              value_type: FLOAT
              units: ms
              description: 'The 50 percentile (median) of how long it takes a leader node to communicate with followers during a leader lease check, in milliseconds.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'consul_raft_leader_lastContact{quantile="0.5"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
                - type: JAVASCRIPT
                  parameters:
                    - 'return (isNaN(value)) ? 0 : value;'
              master_item:
                key: consul.get_metrics
              tags:
                - tag: component
                  value: raft
            - uuid: 1ae3d9e4647b4972b1572946a2794715
              name: 'Raft state: leader last contact, p90'
              type: DEPENDENT
              key: 'consul.raft.leader_last_contact.p90[{#SINGLETON}]'
              value_type: FLOAT
              units: ms
              description: 'The 90 percentile of how long it takes a leader node to communicate with followers during a leader lease check, in milliseconds.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'consul_raft_leader_lastContact{quantile="0.9"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
                - type: JAVASCRIPT
                  parameters:
                    - 'return (isNaN(value)) ? 0 : value;'
              master_item:
                key: consul.get_metrics
              tags:
                - tag: component
                  value: raft
          master_item:
            key: consul.get_node_info
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  return JSON.stringify(JSON.parse(value)["Stats"]["leader"] === true
                  	? [{'{#SINGLETON}': ''}] : []);
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
        - uuid: f7dfc3d88f5440bea02080205d3f0a9b
          name: 'Raft server metrics discovery'
          type: DEPENDENT
          key: consul.raft.server.discovery
          description: 'Discover raft metrics for server nodes.'
          item_prototypes:
            - uuid: 428f1d7924634383aabcd5b37f561a41
              name: 'Raft: apply, rate'
              type: DEPENDENT
              key: 'consul.raft.apply.rate[{#SINGLETON}]'
              value_type: FLOAT
              units: Rps
              description: |
                Incremented whenever a leader first passes a message into the Raft commit process (called an Apply operation).
                This metric describes the arrival rate of new logs into Raft per second.
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - consul_raft_apply
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
                - type: CHANGE_PER_SECOND
              master_item:
                key: consul.get_metrics
              tags:
                - tag: component
                  value: raft
            - uuid: 25dd098b98124fa8a9518963c8b4e5ce
              name: 'Raft state'
              type: DEPENDENT
              key: 'consul.raft.state[{#SINGLETON}]'
              value_type: CHAR
              description: 'Current state of Consul agent.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.Stats.raft.state
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 3h
              master_item:
                key: consul.get_node_info
              tags:
                - tag: component
                  value: raft
            - uuid: 7b030c4eac68464e8c454577ab0f0f53
              name: 'Raft state: candidate'
              type: DEPENDENT
              key: 'consul.raft.state_candidate[{#SINGLETON}]'
              description: 'The number of initiated leader elections.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - consul_raft_state_candidate
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: consul.get_metrics
              tags:
                - tag: component
                  value: raft
            - uuid: e89157e341d8409c96e31a9d541a7fe8
              name: 'Raft state: leader'
              type: DEPENDENT
              key: 'consul.raft.state_leader[{#SINGLETON}]'
              description: 'Increments when a server becomes a leader.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - consul_raft_state_leader
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: consul.get_metrics
              tags:
                - tag: component
                  value: raft
          master_item:
            key: consul.get_node_info
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  return JSON.stringify(JSON.parse(value)["Config"]["Server"] === true
                  	? [{'{#SINGLETON}': ''}] : []);
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
      tags:
        - tag: class
          value: software
        - tag: subclass
          value: automation
        - tag: subclass
          value: security
        - tag: target
          value: consul
      macros:
        - macro: '{$CONSUL.LLD.FILTER.LOCAL_SERVICE_NAME.MATCHES}'
          value: '.*'
          description: 'Filter of discoverable discovered services on local node.'
          config:
            type: TEXT
            priority: '4'
            section_name: Filters
            label: 'Services on local node filter (include)'
            description: 'Filter of discoverable discovered services on local node.'
        - macro: '{$CONSUL.LLD.FILTER.LOCAL_SERVICE_NAME.NOT_MATCHES}'
          value: 'CHANGE IF NEEDED'
          description: 'Filter to exclude discovered services on local node.'
          config:
            type: TEXT
            priority: '5'
            section_name: Filters
            label: 'Services on local node filter (exclude)'
            description: 'Filter to exclude discovered services on local node.'
        - macro: '{$CONSUL.LLD.FILTER.SERVICE_NAMESPACE.MATCHES}'
          value: '.*'
          description: 'Filter of discoverable discovered service by namespace on local node. Enterprise only, in case of Open Source version Namespace will be set to ''None''.'
          config:
            type: TEXT
            priority: '6'
            section_name: Filters
            label: 'Services by namespace on local node filter (include)'
            description: 'Filter of discoverable discovered service by namespace on local node. Enterprise only, in case of Open Source version Namespace will be set to ''None''.'
        - macro: '{$CONSUL.LLD.FILTER.SERVICE_NAMESPACE.NOT_MATCHES}'
          value: 'CHANGE IF NEEDED'
          description: 'Filter to exclude discovered service by namespace on local node. Enterprise only, in case of Open Source version Namespace will be set to ''None''.'
          config:
            type: TEXT
            priority: '7'
            section_name: Filters
            label: 'Services by namespace on local node filter (exclude)'
            description: 'Filter to exclude discovered service by namespace on local node. Enterprise only, in case of Open Source version Namespace will be set to ''None''.'
        - macro: '{$CONSUL.NODE.API.URL}'
          value: 'http://localhost:8500'
          description: 'Consul instance URL.'
          config:
            type: TEXT
            priority: '1'
            label: Address
            description: 'Consul instance URL.'
            required: 'YES'
        - macro: '{$CONSUL.NODE.HEALTH_SCORE.MAX.HIGH}'
          value: '4'
          description: 'Maximum acceptable value of node''s health score for AVERAGE trigger expression.'
          config:
            type: TEXT
            priority: '9'
            section_name: Thresholds
            label: 'Max node health score for average trigger'
            description: 'Maximum acceptable value of node''s health score for AVERAGE trigger expression.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$CONSUL.NODE.HEALTH_SCORE.MAX.WARN}'
          value: '2'
          description: 'Maximum acceptable value of node''s health score for WARNING trigger expression.'
          config:
            type: TEXT
            priority: '8'
            section_name: Thresholds
            label: 'Max node health score for warning trigger'
            description: 'Maximum acceptable value of node''s health score for WARNING trigger expression.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$CONSUL.OPEN.FDS.MAX.WARN}'
          value: '90'
          description: 'Maximum percentage of used file descriptors.'
          config:
            type: TEXT
            priority: '3'
            section_name: Thresholds
            label: 'Maximum percentage of used file descriptors'
            description: 'Maximum percentage of used file descriptors. In the range from 0 to 100 inclusive.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$CONSUL.TOKEN}'
          description: 'Consul auth token.'
          config:
            type: TEXT
            priority: '2'
            label: Token
            description: 'Consul auth token.'
            required: 'YES'
      valuemaps:
        - uuid: 92638a6d5a9347edb011a8c999a9895e
          name: 'Consul Autopilot healthy'
          mappings:
            - value: '0'
              newvalue: Unhealthy
            - value: '1'
              newvalue: Healthy
        - uuid: 1f966e7c41134551870c82f013f0b2cd
          name: 'Consul health state'
          mappings:
            - value: '0'
              newvalue: passing
            - value: '1'
              newvalue: warning
            - value: '2'
              newvalue: critical
            - value: '255'
              newvalue: unknown
        - uuid: 8d8f7d7e37a44fe8ac590147f621cb4c
          name: 'Consul Node role'
          mappings:
            - value: '0'
              newvalue: Agent
            - value: '1'
              newvalue: Server
    - uuid: e2307c94f1744af7a8f1f458a67af424
      template: 'Linux by Zabbix agent active'
      name: 'Linux by Zabbix agent active'
      description: |
        This is an official Linux template. It requires Zabbix agent 8.0 or newer.
        
        Notes on filesystem (FS) discovery:
          - The ext4/3/2 FS reserves space for privileged usage, typically set at 5% by default.
          - BTRFS allocates a default of 10% of the volume for its own needs.
          - To mitigate potential disasters, FS usage triggers are based on the maximum available space.
            - Utilization formula: 'pused = 100 - 100 * (available / total - free + available)'
          - The FS utilization chart, derived from graph prototypes, reflects FS reserved space as the difference between used and available space from the total volume.
        
        You can discuss this template or leave feedback on our forum https://www.zabbix.com/forum/zabbix-suggestions-and-feedback/387225-discussion-thread-for-official-zabbix-template-for-linux
        
        Generated by official Zabbix template tool "Templator"
      wizard_ready: 'YES'
      readme: |
        ## Overview
        
        This is an official Linux template. It requires Zabbix agent 8.0 or newer.
        
        #### Notes on filesystem (FS) discovery:
        - The ext4/3/2 FS reserves space for privileged usage, typically set at 5% by default.
        - BTRFS allocates a default of 10% of the volume for its own needs.
        - To mitigate potential disasters, FS usage triggers are based on the maximum available space.
          - Utilization formula: `pused = 100 - 100 * (available / total - free + available)`
        - The FS utilization chart, derived from graph prototypes, reflects FS reserved space as the difference between used and available space from the total volume.
      vendor:
        name: Zabbix
        version: 8.0-0
      groups:
        - name: 'Templates/Operating systems'
      items:
        - uuid: a31cfdf92de04535adb957e0c72f54bd
          name: 'Host name of Zabbix agent running'
          type: ZABBIX_ACTIVE
          key: agent.hostname
          delay: 1h
          value_type: CHAR
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1d
          tags:
            - tag: component
              value: system
        - uuid: 7c266646bfa843dabfe4ba5a3fd9026e
          name: 'Zabbix agent ping'
          type: ZABBIX_ACTIVE
          key: agent.ping
          description: 'The agent always returns "1" for this item. May be used in combination with `nodata()` for the availability check.'
          valuemap:
            name: 'Zabbix agent ping status'
          tags:
            - tag: component
              value: system
          triggers:
            - uuid: c1b9fdbe6a584d2cb25ff7077c667af1
              expression: 'nodata(/Linux by Zabbix agent active/agent.ping,{$AGENT.NODATA_TIMEOUT})=1'
              name: 'Linux: Zabbix agent is not available'
              event_name: 'Linux: Zabbix agent is not available (or nodata for {$AGENT.NODATA_TIMEOUT})'
              priority: AVERAGE
              description: 'For active agents, `nodata()` with `agent.ping` is used with `{$AGENT.NODATA_TIMEOUT}` as a time threshold.'
              manual_close: 'YES'
              tags:
                - tag: scope
                  value: availability
        - uuid: 91dbe302bd8e4954b91e9ce3a795b4eb
          name: 'Version of Zabbix agent running'
          type: ZABBIX_ACTIVE
          key: agent.version
          delay: 1h
          value_type: CHAR
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1d
          tags:
            - tag: component
              value: application
        - uuid: 66ed2ffc888c40c6b80dcc259c087d08
          name: 'Maximum number of open file descriptors'
          type: ZABBIX_ACTIVE
          key: kernel.maxfiles
          delay: 1h
          description: 'May be increased by using the `sysctl` utility or modifying the file `/etc/sysctl.conf`.'
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1d
          tags:
            - tag: component
              value: system
          triggers:
            - uuid: a7716b62422243b991a2697752d7cb1f
              expression: 'last(/Linux by Zabbix agent active/kernel.maxfiles)<{$KERNEL.MAXFILES.MIN}'
              name: 'Linux: Configured max number of open filedescriptors is too low'
              event_name: 'Linux: Configured max number of open filedescriptors is too low (< {$KERNEL.MAXFILES.MIN})'
              priority: INFO
              tags:
                - tag: scope
                  value: performance
        - uuid: d60cc4367893424d9671b1f05ba83599
          name: 'Maximum number of processes'
          type: ZABBIX_ACTIVE
          key: kernel.maxproc
          delay: 1h
          description: 'May be increased by using the `sysctl` utility or modifying the file `/etc/sysctl.conf`.'
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1d
          tags:
            - tag: component
              value: system
          triggers:
            - uuid: 740ed348fb1d41dca7c410123b668a48
              expression: 'last(/Linux by Zabbix agent active/kernel.maxproc)<{$KERNEL.MAXPROC.MIN}'
              name: 'Linux: Configured max number of processes is too low'
              event_name: 'Linux: Configured max number of processes is too low (< {$KERNEL.MAXPROC.MIN})'
              priority: INFO
              dependencies:
                - name: 'Linux: Getting closer to process limit'
                  expression: 'last(/Linux by Zabbix agent active/proc.num)/last(/Linux by Zabbix agent active/kernel.maxproc)*100>80'
              tags:
                - tag: scope
                  value: performance
        - uuid: ccb6fdbe1267475780e978c0c5de986c
          name: 'Number of processes'
          type: ZABBIX_ACTIVE
          key: proc.num
          tags:
            - tag: component
              value: system
        - uuid: 436bf5615731425a97fdcdbaac5f4000
          name: 'Number of running processes'
          type: ZABBIX_ACTIVE
          key: 'proc.num[,,run]'
          tags:
            - tag: component
              value: system
        - uuid: 42bb6cbed08a4884a99328b38e4c1654
          name: 'System boot time'
          type: ZABBIX_ACTIVE
          key: system.boottime
          delay: 15m
          units: unixtime
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          tags:
            - tag: component
              value: system
        - uuid: 0a2218b9d9124c7284962f84bdefaab8
          name: 'Interrupts per second'
          type: ZABBIX_ACTIVE
          key: system.cpu.intr
          value_type: FLOAT
          description: 'Number of interrupts processed.'
          preprocessing:
            - type: CHANGE_PER_SECOND
          tags:
            - tag: component
              value: cpu
        - uuid: c692df07acc44b4ea1f4f88cd4ee64eb
          name: 'Load average (1m avg)'
          type: ZABBIX_ACTIVE
          key: 'system.cpu.load[all,avg1]'
          value_type: FLOAT
          description: 'Calculated as the system CPU load divided by the number of CPU cores.'
          tags:
            - tag: component
              value: cpu
        - uuid: 18862acd219e4259a9b9665c32550fa5
          name: 'Load average (5m avg)'
          type: ZABBIX_ACTIVE
          key: 'system.cpu.load[all,avg5]'
          value_type: FLOAT
          description: 'Calculated as the system CPU load divided by the number of CPU cores.'
          tags:
            - tag: component
              value: cpu
        - uuid: 61040b6d85df4a2087e562f0216e723d
          name: 'Load average (15m avg)'
          type: ZABBIX_ACTIVE
          key: 'system.cpu.load[all,avg15]'
          value_type: FLOAT
          description: 'Calculated as the system CPU load divided by the number of CPU cores.'
          tags:
            - tag: component
              value: cpu
        - uuid: 6e98a6a53c1a44c09b5e3c19971b834c
          name: 'Number of CPUs'
          type: ZABBIX_ACTIVE
          key: system.cpu.num
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1d
          tags:
            - tag: component
              value: cpu
        - uuid: 47e3a1d3955d4bccb07a0e32f768273d
          name: 'Context switches per second'
          type: ZABBIX_ACTIVE
          key: system.cpu.switches
          value_type: FLOAT
          description: 'The combined rate at which all processors on the computer are switched from one thread to another.'
          preprocessing:
            - type: CHANGE_PER_SECOND
          tags:
            - tag: component
              value: cpu
        - uuid: 9cb786aec7de4f749f33c6e5adfbaf75
          name: 'CPU utilization'
          type: DEPENDENT
          key: system.cpu.util
          value_type: FLOAT
          units: '%'
          description: 'CPU utilization expressed in %.'
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - 'return (100 - value)'
          master_item:
            key: 'system.cpu.util[,idle]'
          tags:
            - tag: component
              value: cpu
          triggers:
            - uuid: e299778a6fcc4805bd5806f3b2ffe1c2
              expression: 'min(/Linux by Zabbix agent active/system.cpu.util,5m)>{$CPU.UTIL.CRIT}'
              name: 'Linux: High CPU utilization'
              event_name: 'Linux: High CPU utilization (over {$CPU.UTIL.CRIT}% for 5m)'
              opdata: 'Current utilization: {ITEM.LASTVALUE1}'
              priority: WARNING
              description: 'CPU utilization is too high. The system might be slow to respond.'
              dependencies:
                - name: 'Linux: Load average is too high'
                  expression: |
                    min(/Linux by Zabbix agent active/system.cpu.load[all,avg1],5m)/last(/Linux by Zabbix agent active/system.cpu.num)>{$LOAD_AVG_PER_CPU.MAX.WARN}
                    and last(/Linux by Zabbix agent active/system.cpu.load[all,avg5])>0
                    and last(/Linux by Zabbix agent active/system.cpu.load[all,avg15])>0
              tags:
                - tag: scope
                  value: performance
        - uuid: 4ef463cc12da45e6b5a97cee93fd5ba0
          name: 'CPU guest time'
          type: ZABBIX_ACTIVE
          key: 'system.cpu.util[,guest]'
          value_type: FLOAT
          units: '%'
          description: 'Time spent on running a virtual CPU for a guest operating system.'
          tags:
            - tag: component
              value: cpu
        - uuid: 0cb7f1c9774241968208724ab56f4d86
          name: 'CPU guest nice time'
          type: ZABBIX_ACTIVE
          key: 'system.cpu.util[,guest_nice]'
          value_type: FLOAT
          units: '%'
          description: 'Time spent on running a niced guest (a virtual CPU for guest operating systems under the control of the Linux kernel).'
          tags:
            - tag: component
              value: cpu
        - uuid: 8a20c7edef6d449e8771ff57cebb87d8
          name: 'CPU idle time'
          type: ZABBIX_ACTIVE
          key: 'system.cpu.util[,idle]'
          value_type: FLOAT
          units: '%'
          description: 'Time the CPU has spent doing nothing.'
          tags:
            - tag: component
              value: cpu
        - uuid: 9329b55874bb4de7a52f941f382ba9ce
          name: 'CPU interrupt time'
          type: ZABBIX_ACTIVE
          key: 'system.cpu.util[,interrupt]'
          value_type: FLOAT
          units: '%'
          description: 'Time the CPU has spent servicing hardware interrupts.'
          tags:
            - tag: component
              value: cpu
        - uuid: 4859bb1b6e21469a917aa56fbfbe1698
          name: 'CPU iowait time'
          type: ZABBIX_ACTIVE
          key: 'system.cpu.util[,iowait]'
          value_type: FLOAT
          units: '%'
          description: 'Time the CPU has been waiting for I/O to complete.'
          tags:
            - tag: component
              value: cpu
        - uuid: d965fa68eea3454e83179116c5483322
          name: 'CPU nice time'
          type: ZABBIX_ACTIVE
          key: 'system.cpu.util[,nice]'
          value_type: FLOAT
          units: '%'
          description: 'Time the CPU has spent running users'' processes that have been niced.'
          tags:
            - tag: component
              value: cpu
        - uuid: 2ff77e25f0fe45238c64a6532735cdd5
          name: 'CPU softirq time'
          type: ZABBIX_ACTIVE
          key: 'system.cpu.util[,softirq]'
          value_type: FLOAT
          units: '%'
          description: 'Time the CPU has been servicing software interrupts.'
          tags:
            - tag: component
              value: cpu
        - uuid: 434c154ba392476f9ad8a94968840e19
          name: 'CPU steal time'
          type: ZABBIX_ACTIVE
          key: 'system.cpu.util[,steal]'
          value_type: FLOAT
          units: '%'
          description: 'The amount of "stolen" CPU from this virtual machine by the hypervisor for other tasks, such as running another virtual machine.'
          tags:
            - tag: component
              value: cpu
        - uuid: 75622323ae4447e8a21a04ef191fdc2d
          name: 'CPU system time'
          type: ZABBIX_ACTIVE
          key: 'system.cpu.util[,system]'
          value_type: FLOAT
          units: '%'
          description: 'Time the CPU has spent running the kernel and its processes.'
          tags:
            - tag: component
              value: cpu
        - uuid: c74b64926aae4a8e8c2299d8bfe2e188
          name: 'CPU user time'
          type: ZABBIX_ACTIVE
          key: 'system.cpu.util[,user]'
          value_type: FLOAT
          units: '%'
          description: 'Time the CPU has spent running users'' processes that are not niced.'
          tags:
            - tag: component
              value: cpu
        - uuid: fdf4eb1b98d04b229a1c9a3c0b5837ba
          name: 'System name'
          type: ZABBIX_ACTIVE
          key: system.hostname
          delay: 1h
          value_type: CHAR
          description: 'The host name of the system.'
          inventory_link: NAME
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 12h
          tags:
            - tag: component
              value: system
          triggers:
            - uuid: c2fc80044fa94f0d97c72bd1d749b731
              expression: 'change(/Linux by Zabbix agent active/system.hostname) and length(last(/Linux by Zabbix agent active/system.hostname))>0'
              name: 'Linux: System name has changed'
              event_name: 'Linux: System name has changed (new name: {ITEM.VALUE})'
              priority: INFO
              description: 'The name of the system has changed. Acknowledge to close the problem manually.'
              manual_close: 'YES'
              tags:
                - tag: scope
                  value: notice
                - tag: scope
                  value: security
        - uuid: c8fa467600ab48ce8cec353bab6c3a54
          name: 'System local time'
          type: ZABBIX_ACTIVE
          key: system.localtime
          units: unixtime
          description: 'The local system time of the host.'
          tags:
            - tag: component
              value: system
        - uuid: 627cbcb2432a4aeda6e90363d9b0c1db
          name: 'Operating system architecture'
          type: ZABBIX_ACTIVE
          key: system.sw.arch
          delay: 1h
          value_type: CHAR
          description: 'The architecture of the operating system.'
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1d
          tags:
            - tag: component
              value: os
        - uuid: d8c633f2fd1947028079a5939835dcd8
          name: 'Operating system'
          type: ZABBIX_ACTIVE
          key: system.sw.os
          delay: 1h
          value_type: CHAR
          inventory_link: OS
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1d
          tags:
            - tag: component
              value: os
          triggers:
            - uuid: e27cb7063ca841a2b78aa547ec0d001c
              expression: 'change(/Linux by Zabbix agent active/system.sw.os) and length(last(/Linux by Zabbix agent active/system.sw.os))>0'
              name: 'Linux: Operating system description has changed'
              priority: INFO
              description: 'The description of the operating system has changed. Possible reasons are that the system has been updated or replaced. Acknowledge to close the problem manually.'
              manual_close: 'YES'
              dependencies:
                - name: 'Linux: System name has changed'
                  expression: 'change(/Linux by Zabbix agent active/system.hostname) and length(last(/Linux by Zabbix agent active/system.hostname))>0'
              tags:
                - tag: scope
                  value: notice
        - uuid: 16b1e5ab950040ef8c29139e0649d622
          name: 'Number of installed packages'
          type: ZABBIX_ACTIVE
          key: system.sw.packages.get
          delay: 1h
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.length()
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 12h
          tags:
            - tag: component
              value: os
          triggers:
            - uuid: bd57d37531ac48f5b96a9f45453f3c35
              expression: 'change(/Linux by Zabbix agent active/system.sw.packages.get)<>0'
              name: 'Linux: Number of installed packages has been changed'
              priority: WARNING
              manual_close: 'YES'
              tags:
                - tag: scope
                  value: notice
        - uuid: f08e1de57cbd4b08b9fd3294d0d95906
          name: 'Free swap space'
          type: ZABBIX_ACTIVE
          key: 'system.swap.size[,free]'
          units: B
          description: 'The free space of the swap volume/file expressed in bytes.'
          tags:
            - tag: component
              value: memory
            - tag: component
              value: storage
        - uuid: 56b8f84d22264b92b70a6ab0c3c70f19
          name: 'Free swap space in %'
          type: ZABBIX_ACTIVE
          key: 'system.swap.size[,pfree]'
          value_type: FLOAT
          units: '%'
          description: 'The free space of the swap volume/file expressed in %.'
          tags:
            - tag: component
              value: memory
            - tag: component
              value: storage
        - uuid: 3a9fb924ab1d47168ffcab9d237d808a
          name: 'Total swap space'
          type: ZABBIX_ACTIVE
          key: 'system.swap.size[,total]'
          units: B
          description: 'The total space of the swap volume/file expressed in bytes.'
          tags:
            - tag: component
              value: memory
            - tag: component
              value: storage
        - uuid: d3d73dcc92b34511971eddf956dc4c0f
          name: 'System description'
          type: ZABBIX_ACTIVE
          key: system.uname
          delay: 15m
          value_type: CHAR
          description: 'The information as normally returned by `uname -a`.'
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 12h
          tags:
            - tag: component
              value: system
        - uuid: 51bdea745e0547ad92a74fefaea54e39
          name: 'System uptime'
          type: ZABBIX_ACTIVE
          key: system.uptime
          delay: 30s
          trends: '0'
          units: uptime
          description: 'The system uptime expressed in the following format: "N days, hh:mm:ss".'
          tags:
            - tag: component
              value: system
          triggers:
            - uuid: 64dbab85caf749f59f3da0c374746bc2
              expression: 'last(/Linux by Zabbix agent active/system.uptime)<10m'
              name: 'Linux: {HOST.NAME} has been restarted'
              event_name: 'Linux: {HOST.NAME} has been restarted (uptime < 10m)'
              priority: WARNING
              description: 'The host uptime is less than 10 minutes.'
              manual_close: 'YES'
              tags:
                - tag: scope
                  value: notice
        - uuid: 4ea1cfb5813a422b98caebcd870959ef
          name: 'Number of logged in users'
          type: ZABBIX_ACTIVE
          key: system.users.num
          description: 'The number of users who are currently logged in.'
          tags:
            - tag: component
              value: environment
        - uuid: 87f35de24ba74a8d8f70430c8da85261
          name: 'Checksum of /etc/passwd'
          type: ZABBIX_ACTIVE
          key: 'vfs.file.cksum[/etc/passwd,sha256]'
          delay: 15m
          value_type: CHAR
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          tags:
            - tag: component
              value: security
          triggers:
            - uuid: c5a76894508c4f0e9dcc9f70e6f39f49
              expression: 'last(/Linux by Zabbix agent active/vfs.file.cksum[/etc/passwd,sha256],#1)<>last(/Linux by Zabbix agent active/vfs.file.cksum[/etc/passwd,sha256],#2)'
              name: 'Linux: /etc/passwd has been changed'
              priority: INFO
              manual_close: 'YES'
              dependencies:
                - name: 'Linux: Operating system description has changed'
                  expression: 'change(/Linux by Zabbix agent active/system.sw.os) and length(last(/Linux by Zabbix agent active/system.sw.os))>0'
                - name: 'Linux: System name has changed'
                  expression: 'change(/Linux by Zabbix agent active/system.hostname) and length(last(/Linux by Zabbix agent active/system.hostname))>0'
              tags:
                - tag: scope
                  value: security
        - uuid: 6c1de983421846c9acef8f465ff2f196
          name: 'Get filesystems'
          type: ZABBIX_ACTIVE
          key: vfs.fs.get
          history: '0'
          value_type: TEXT
          description: 'The `vfs.fs.get` key acquires raw information set about the filesystems. Later to be extracted by preprocessing in dependent items.'
          tags:
            - tag: component
              value: raw
        - uuid: 5bf94ec3debc459fa3e13449199052ee
          name: 'Available memory'
          type: ZABBIX_ACTIVE
          key: 'vm.memory.size[available]'
          units: B
          description: |
            The available memory:
            - in Linux = free + buffers + cache;
            - on other platforms calculation may vary.
            
            See also Appendixes in Zabbix Documentation about parameters of the `vm.memory.size` item.
          tags:
            - tag: component
              value: memory
        - uuid: 99efd95a41b34457a2ec0d8c96324e7c
          name: 'Available memory in %'
          type: ZABBIX_ACTIVE
          key: 'vm.memory.size[pavailable]'
          value_type: FLOAT
          units: '%'
          description: 'The available memory as percentage of the total. See also Appendixes in Zabbix Documentation about parameters of the `vm.memory.size` item.'
          tags:
            - tag: component
              value: memory
        - uuid: 013fe8b15c86442eadc10763706ec594
          name: 'Total memory'
          type: ZABBIX_ACTIVE
          key: 'vm.memory.size[total]'
          units: B
          description: 'Total memory expressed in bytes.'
          tags:
            - tag: component
              value: memory
        - uuid: 07e60e812d32443ba8e8b0eb27166b98
          name: 'Memory utilization'
          type: DEPENDENT
          key: vm.memory.utilization
          value_type: FLOAT
          units: '%'
          description: 'The percentage of used memory is calculated as `100-pavailable`.'
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - 'return (100-value);'
          master_item:
            key: 'vm.memory.size[pavailable]'
          tags:
            - tag: component
              value: memory
          triggers:
            - uuid: fb368aa704064a44b9a4ed8c129cf3e8
              expression: 'min(/Linux by Zabbix agent active/vm.memory.utilization,5m)>{$MEMORY.UTIL.MAX}'
              name: 'Linux: High memory utilization'
              event_name: 'Linux: High memory utilization (>{$MEMORY.UTIL.MAX}% for 5m)'
              priority: AVERAGE
              description: 'The system is running out of free memory.'
              dependencies:
                - name: 'Linux: Lack of available memory'
                  expression: 'max(/Linux by Zabbix agent active/vm.memory.size[available],5m)<{$MEMORY.AVAILABLE.MIN} and last(/Linux by Zabbix agent active/vm.memory.size[total])>0'
              tags:
                - tag: scope
                  value: capacity
                - tag: scope
                  value: performance
        - uuid: 090fb1a5698e4e7080abf379b377b6f5
          name: 'Active agent availability'
          type: INTERNAL
          key: 'zabbix[host,active_agent,available]'
          description: |
            Availability of active checks on the host. The value of this item corresponds to availability icons in the host list.
            Possible values:
            0 - unknown
            1 - available
            2 - not available
          valuemap:
            name: zabbix.host.active_agent.available
          tags:
            - tag: component
              value: health
            - tag: component
              value: network
          triggers:
            - uuid: a022259fc3cf454f93bc82cca27391f1
              expression: 'min(/Linux by Zabbix agent active/zabbix[host,active_agent,available],{$AGENT.TIMEOUT})=2'
              name: 'Linux: Active checks are not available'
              opdata: 'Current state: {ITEM.LASTVALUE1}'
              priority: HIGH
              description: 'Active checks are considered unavailable. Agent has not sent a heartbeat for a prolonged time.'
              tags:
                - tag: scope
                  value: availability
      discovery_rules:
        - uuid: 0b47631fb1334f78a7fe5207194a5476
          name: 'Network interface discovery'
          type: ZABBIX_ACTIVE
          key: net.if.discovery
          delay: 1h
          filter:
            evaltype: AND
            conditions:
              - macro: '{#IFNAME}'
                value: '{$NET.IF.IFNAME.MATCHES}'
              - macro: '{#IFNAME}'
                value: '{$NET.IF.IFNAME.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          description: 'The discovery of network interfaces.'
          item_prototypes:
            - uuid: f1a4f18b78754e669d1ddc593765f2e4
              name: 'Interface {#IFNAME}: Inbound packets discarded'
              type: ZABBIX_ACTIVE
              key: 'net.if.in["{#IFNAME}",dropped]'
              delay: 3m
              preprocessing:
                - type: CHANGE_PER_SECOND
              tags:
                - tag: component
                  value: network
                - tag: interface
                  value: '{#IFNAME}'
            - uuid: f0eb218780ce44128117d73d65d412a9
              name: 'Interface {#IFNAME}: Inbound packets with errors'
              type: ZABBIX_ACTIVE
              key: 'net.if.in["{#IFNAME}",errors]'
              delay: 3m
              preprocessing:
                - type: CHANGE_PER_SECOND
              tags:
                - tag: component
                  value: network
                - tag: interface
                  value: '{#IFNAME}'
            - uuid: 37dd13afa2b84b0e906a80016b9b2bf5
              name: 'Interface {#IFNAME}: Bits received'
              type: ZABBIX_ACTIVE
              key: 'net.if.in["{#IFNAME}"]'
              delay: 3m
              units: bps
              preprocessing:
                - type: CHANGE_PER_SECOND
                - type: MULTIPLIER
                  parameters:
                    - '8'
              tags:
                - tag: component
                  value: network
                - tag: interface
                  value: '{#IFNAME}'
            - uuid: 12a56bb72eef43648293ce1d6c8f9c42
              name: 'Interface {#IFNAME}: Outbound packets discarded'
              type: ZABBIX_ACTIVE
              key: 'net.if.out["{#IFNAME}",dropped]'
              delay: 3m
              preprocessing:
                - type: CHANGE_PER_SECOND
              tags:
                - tag: component
                  value: network
                - tag: interface
                  value: '{#IFNAME}'
            - uuid: 90362d020e82429d87b0b1688355831d
              name: 'Interface {#IFNAME}: Outbound packets with errors'
              type: ZABBIX_ACTIVE
              key: 'net.if.out["{#IFNAME}",errors]'
              delay: 3m
              preprocessing:
                - type: CHANGE_PER_SECOND
              tags:
                - tag: component
                  value: network
                - tag: interface
                  value: '{#IFNAME}'
            - uuid: 63616a66fb5e4fd7a725c5186b47e516
              name: 'Interface {#IFNAME}: Bits sent'
              type: ZABBIX_ACTIVE
              key: 'net.if.out["{#IFNAME}"]'
              delay: 3m
              units: bps
              preprocessing:
                - type: CHANGE_PER_SECOND
                - type: MULTIPLIER
                  parameters:
                    - '8'
              tags:
                - tag: component
                  value: network
                - tag: interface
                  value: '{#IFNAME}'
            - uuid: 83b33479fd774915b100b69c527519c8
              name: 'Interface {#IFNAME}: Operational status'
              type: ZABBIX_ACTIVE
              key: 'vfs.file.contents["/sys/class/net/{#IFNAME}/operstate"]'
              trends: '0'
              description: 'Reference: https://www.kernel.org/doc/Documentation/networking/operstates.txt'
              valuemap:
                name: ifOperStatus
              preprocessing:
                - type: JAVASCRIPT
                  parameters:
                    - |
                      var newvalue;
                      switch(value) {
                        case "unknown":
                      	newvalue = 0;
                      	break;
                        case "notpresent":
                      	newvalue = 1;
                      	break;
                        case "down":
                      	newvalue = 2;
                      	break;
                        case "lowerlayerdown":
                      	newvalue = 3;
                      	break;
                        case "testing":
                      	newvalue = 4;
                      	break;
                        case "dormant":
                      	newvalue = 5;
                      	break;
                        case "up":
                      	newvalue = 6;
                      	break;  default:
                      	newvalue = "Problem parsing interface operstate in JS";
                      }
                      return newvalue;
              tags:
                - tag: component
                  value: network
                - tag: interface
                  value: '{#IFNAME}'
              trigger_prototypes:
                - uuid: 1b8e42925e1b48969f35d91800fe5229
                  expression: '{$IFCONTROL:"{#IFNAME}"}=1 and last(/Linux by Zabbix agent active/vfs.file.contents["/sys/class/net/{#IFNAME}/operstate"])=2 and (last(/Linux by Zabbix agent active/vfs.file.contents["/sys/class/net/{#IFNAME}/operstate"],#1)<>last(/Linux by Zabbix agent active/vfs.file.contents["/sys/class/net/{#IFNAME}/operstate"],#2))'
                  recovery_mode: RECOVERY_EXPRESSION
                  recovery_expression: 'last(/Linux by Zabbix agent active/vfs.file.contents["/sys/class/net/{#IFNAME}/operstate"])<>2 or {$IFCONTROL:"{#IFNAME}"}=0'
                  name: 'Linux: Interface {#IFNAME}: Link down'
                  opdata: 'Current state: {ITEM.LASTVALUE1}'
                  priority: AVERAGE
                  description: |
                    This trigger expression works as follows:
                    1. It can be triggered if the operations status is down.
                    2. `{$IFCONTROL:"{#IFNAME}"}=1` - a user can redefine the context macro to "0", marking this interface as not important. No new trigger will be fired if this interface is down.
                    3. `last(/TEMPLATE_NAME/METRIC,#1)<>last(/TEMPLATE_NAME/METRIC,#2)` - the trigger fires only if the operational status was up to (1) sometime before (so, does not fire for "eternal off" interfaces.)
                    
                    WARNING: if closed manually - it will not fire again on the next poll, because of .diff.
                  manual_close: 'YES'
                  tags:
                    - tag: scope
                      value: availability
            - uuid: 86dd61015ecc43428803b309bdfa9691
              name: 'Interface {#IFNAME}: Speed'
              type: ZABBIX_ACTIVE
              key: 'vfs.file.contents["/sys/class/net/{#IFNAME}/speed"]'
              delay: 5m
              trends: '0'
              units: bps
              description: |
                It indicates the latest or current speed value of the interface. The value is an integer representing the link speed expressed in bits/sec.
                This attribute is only valid for the interfaces that implement the ethtool `get_link_ksettings` method (mostly Ethernet).
                
                Reference: https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-class-net
              preprocessing:
                - type: MULTIPLIER
                  parameters:
                    - '1000000'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              tags:
                - tag: component
                  value: network
                - tag: interface
                  value: '{#IFNAME}'
            - uuid: e675114e23414b9dbc2d19d00f32bc70
              name: 'Interface {#IFNAME}: Interface type'
              type: ZABBIX_ACTIVE
              key: 'vfs.file.contents["/sys/class/net/{#IFNAME}/type"]'
              delay: 1h
              trends: '0'
              description: |
                It indicates the interface protocol type as a decimal value.
                See `include/uapi/linux/if_arp.h` for all possible values.
                Reference: https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-class-net
              valuemap:
                name: 'Linux::Interface protocol types'
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1d
              tags:
                - tag: component
                  value: network
                - tag: interface
                  value: '{#IFNAME}'
          trigger_prototypes:
            - uuid: c0fd4630351f424aa6c8b7f2e85f0f9e
              expression: |
                change(/Linux by Zabbix agent active/vfs.file.contents["/sys/class/net/{#IFNAME}/speed"])<0 and last(/Linux by Zabbix agent active/vfs.file.contents["/sys/class/net/{#IFNAME}/speed"])>0
                and
                (last(/Linux by Zabbix agent active/vfs.file.contents["/sys/class/net/{#IFNAME}/type"])=6 or last(/Linux by Zabbix agent active/vfs.file.contents["/sys/class/net/{#IFNAME}/type"])=1)
                and
                (last(/Linux by Zabbix agent active/vfs.file.contents["/sys/class/net/{#IFNAME}/operstate"])<>2)
              recovery_mode: RECOVERY_EXPRESSION
              recovery_expression: |
                (change(/Linux by Zabbix agent active/vfs.file.contents["/sys/class/net/{#IFNAME}/speed"])>0 and last(/Linux by Zabbix agent active/vfs.file.contents["/sys/class/net/{#IFNAME}/speed"],#2)>0) or
                (last(/Linux by Zabbix agent active/vfs.file.contents["/sys/class/net/{#IFNAME}/operstate"])=2)
              name: 'Linux: Interface {#IFNAME}: Ethernet has changed to lower speed than it was before'
              opdata: 'Current reported speed: {ITEM.LASTVALUE1}'
              priority: INFO
              description: 'This Ethernet connection has transitioned down from its known maximum speed. This might be a sign of autonegotiation issues. Acknowledge to close the problem manually.'
              manual_close: 'YES'
              dependencies:
                - name: 'Linux: Interface {#IFNAME}: Link down'
                  expression: '{$IFCONTROL:"{#IFNAME}"}=1 and last(/Linux by Zabbix agent active/vfs.file.contents["/sys/class/net/{#IFNAME}/operstate"])=2 and (last(/Linux by Zabbix agent active/vfs.file.contents["/sys/class/net/{#IFNAME}/operstate"],#1)<>last(/Linux by Zabbix agent active/vfs.file.contents["/sys/class/net/{#IFNAME}/operstate"],#2))'
                  recovery_expression: 'last(/Linux by Zabbix agent active/vfs.file.contents["/sys/class/net/{#IFNAME}/operstate"])<>2 or {$IFCONTROL:"{#IFNAME}"}=0'
              tags:
                - tag: scope
                  value: performance
            - uuid: 5370cb085c454077a2dd6c39890f706a
              expression: |
                (avg(/Linux by Zabbix agent active/net.if.in["{#IFNAME}"],15m)>({$IF.UTIL.MAX:"{#IFNAME}"}/100)*last(/Linux by Zabbix agent active/vfs.file.contents["/sys/class/net/{#IFNAME}/speed"]) or
                avg(/Linux by Zabbix agent active/net.if.out["{#IFNAME}"],15m)>({$IF.UTIL.MAX:"{#IFNAME}"}/100)*last(/Linux by Zabbix agent active/vfs.file.contents["/sys/class/net/{#IFNAME}/speed"])) and
                last(/Linux by Zabbix agent active/vfs.file.contents["/sys/class/net/{#IFNAME}/speed"])>0
              recovery_mode: RECOVERY_EXPRESSION
              recovery_expression: |
                avg(/Linux by Zabbix agent active/net.if.in["{#IFNAME}"],15m)<(({$IF.UTIL.MAX:"{#IFNAME}"}-3)/100)*last(/Linux by Zabbix agent active/vfs.file.contents["/sys/class/net/{#IFNAME}/speed"]) and
                avg(/Linux by Zabbix agent active/net.if.out["{#IFNAME}"],15m)<(({$IF.UTIL.MAX:"{#IFNAME}"}-3)/100)*last(/Linux by Zabbix agent active/vfs.file.contents["/sys/class/net/{#IFNAME}/speed"])
              name: 'Linux: Interface {#IFNAME}: High bandwidth usage'
              event_name: 'Linux: Interface {#IFNAME}: High bandwidth usage (>{$IF.UTIL.MAX:"{#IFNAME}"}%)'
              opdata: 'In: {ITEM.LASTVALUE1}, out: {ITEM.LASTVALUE3}, speed: {ITEM.LASTVALUE2}'
              priority: WARNING
              description: 'The utilization of the network interface is close to its estimated maximum bandwidth.'
              manual_close: 'YES'
              dependencies:
                - name: 'Linux: Interface {#IFNAME}: Link down'
                  expression: '{$IFCONTROL:"{#IFNAME}"}=1 and last(/Linux by Zabbix agent active/vfs.file.contents["/sys/class/net/{#IFNAME}/operstate"])=2 and (last(/Linux by Zabbix agent active/vfs.file.contents["/sys/class/net/{#IFNAME}/operstate"],#1)<>last(/Linux by Zabbix agent active/vfs.file.contents["/sys/class/net/{#IFNAME}/operstate"],#2))'
                  recovery_expression: 'last(/Linux by Zabbix agent active/vfs.file.contents["/sys/class/net/{#IFNAME}/operstate"])<>2 or {$IFCONTROL:"{#IFNAME}"}=0'
              tags:
                - tag: scope
                  value: performance
            - uuid: 58f4ba4b2795407896752da57462629d
              expression: |
                min(/Linux by Zabbix agent active/net.if.in["{#IFNAME}",errors],5m)>{$IF.ERRORS.WARN:"{#IFNAME}"}
                or min(/Linux by Zabbix agent active/net.if.out["{#IFNAME}",errors],5m)>{$IF.ERRORS.WARN:"{#IFNAME}"}
              recovery_mode: RECOVERY_EXPRESSION
              recovery_expression: |
                max(/Linux by Zabbix agent active/net.if.in["{#IFNAME}",errors],5m)<{$IF.ERRORS.WARN:"{#IFNAME}"}*0.8
                and max(/Linux by Zabbix agent active/net.if.out["{#IFNAME}",errors],5m)<{$IF.ERRORS.WARN:"{#IFNAME}"}*0.8
              name: 'Linux: Interface {#IFNAME}: High error rate'
              event_name: 'Linux: Interface {#IFNAME}: High error rate (>{$IF.ERRORS.WARN:"{#IFNAME}"} for 5m)'
              opdata: 'errors in: {ITEM.LASTVALUE1}, errors out: {ITEM.LASTVALUE2}'
              priority: WARNING
              description: 'It recovers when it is below 80% of the `{$IF.ERRORS.WARN:"{#IFNAME}"}` threshold.'
              manual_close: 'YES'
              dependencies:
                - name: 'Linux: Interface {#IFNAME}: Link down'
                  expression: '{$IFCONTROL:"{#IFNAME}"}=1 and last(/Linux by Zabbix agent active/vfs.file.contents["/sys/class/net/{#IFNAME}/operstate"])=2 and (last(/Linux by Zabbix agent active/vfs.file.contents["/sys/class/net/{#IFNAME}/operstate"],#1)<>last(/Linux by Zabbix agent active/vfs.file.contents["/sys/class/net/{#IFNAME}/operstate"],#2))'
                  recovery_expression: 'last(/Linux by Zabbix agent active/vfs.file.contents["/sys/class/net/{#IFNAME}/operstate"])<>2 or {$IFCONTROL:"{#IFNAME}"}=0'
              tags:
                - tag: scope
                  value: availability
                - tag: scope
                  value: performance
          graph_prototypes:
            - uuid: 6e2814a0ef824df7b418bbd86b260181
              name: 'Interface {#IFNAME}: Network traffic'
              graph_items:
                - drawtype: GRADIENT_LINE
                  color: 199C0D
                  item:
                    host: 'Linux by Zabbix agent active'
                    key: 'net.if.in["{#IFNAME}"]'
                - sortorder: '1'
                  drawtype: BOLD_LINE
                  color: F63100
                  item:
                    host: 'Linux by Zabbix agent active'
                    key: 'net.if.out["{#IFNAME}"]'
                - sortorder: '2'
                  color: 00611C
                  yaxisside: RIGHT
                  item:
                    host: 'Linux by Zabbix agent active'
                    key: 'net.if.out["{#IFNAME}",errors]'
                - sortorder: '3'
                  color: F7941D
                  yaxisside: RIGHT
                  item:
                    host: 'Linux by Zabbix agent active'
                    key: 'net.if.in["{#IFNAME}",errors]'
                - sortorder: '4'
                  color: FC6EA3
                  yaxisside: RIGHT
                  item:
                    host: 'Linux by Zabbix agent active'
                    key: 'net.if.out["{#IFNAME}",dropped]'
                - sortorder: '5'
                  color: 6C59DC
                  yaxisside: RIGHT
                  item:
                    host: 'Linux by Zabbix agent active'
                    key: 'net.if.in["{#IFNAME}",dropped]'
        - uuid: ff825e7028c24138a7ea6625353a1790
          name: 'Block devices discovery'
          type: ZABBIX_ACTIVE
          key: vfs.dev.discovery
          delay: 1h
          filter:
            evaltype: AND
            conditions:
              - macro: '{#DEVNAME}'
                value: '{$VFS.DEV.DEVNAME.MATCHES}'
              - macro: '{#DEVNAME}'
                value: '{$VFS.DEV.DEVNAME.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
              - macro: '{#DEVTYPE}'
                value: disk
          item_prototypes:
            - uuid: 9a0448cf8a184d52a7872df410f25d6b
              name: '{#DEVNAME}: Disk average queue size (avgqu-sz)'
              type: DEPENDENT
              key: 'vfs.dev.queue_size[{#DEVNAME}]'
              value_type: FLOAT
              description: 'The current average disk queue; the number of requests outstanding on the disk while the performance data is being collected.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$[10]'
                - type: CHANGE_PER_SECOND
                - type: MULTIPLIER
                  parameters:
                    - '0.001'
              master_item:
                key: 'vfs.file.contents[/sys/block/{#DEVNAME}/stat]'
              tags:
                - tag: component
                  value: storage
                - tag: disk
                  value: '{#DEVNAME}'
            - uuid: 1b3559f0d90948f0a72c2fdfdc80930b
              name: '{#DEVNAME}: Disk read request avg waiting time (r_await)'
              type: CALCULATED
              key: 'vfs.dev.read.await[{#DEVNAME}]'
              value_type: FLOAT
              units: '!ms'
              params: '(last(//vfs.dev.read.time.rate[{#DEVNAME}])/(last(//vfs.dev.read.rate[{#DEVNAME}])+(last(//vfs.dev.read.rate[{#DEVNAME}])=0)))*1000*(last(//vfs.dev.read.rate[{#DEVNAME}]) > 0)'
              description: 'This formula contains two Boolean expressions that evaluate to 1 or 0 in order to set the calculated metric to zero and to avoid the exception - division by zero.'
              tags:
                - tag: component
                  value: storage
                - tag: disk
                  value: '{#DEVNAME}'
            - uuid: 3bb5f84b2e954c28843fa1fb3898c034
              name: '{#DEVNAME}: Disk read rate'
              type: DEPENDENT
              key: 'vfs.dev.read.rate[{#DEVNAME}]'
              value_type: FLOAT
              units: '!r/s'
              description: 'r/s (read operations per second) - the number (after merges) of read requests completed per second for the device.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$[0]'
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'vfs.file.contents[/sys/block/{#DEVNAME}/stat]'
              tags:
                - tag: component
                  value: storage
                - tag: disk
                  value: '{#DEVNAME}'
            - uuid: df02934521b54864b2538b764c5d549b
              name: '{#DEVNAME}: Disk read time (rate)'
              type: DEPENDENT
              key: 'vfs.dev.read.time.rate[{#DEVNAME}]'
              value_type: FLOAT
              description: 'The rate of total read time counter; used in `r_await` calculation.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$[3]'
                - type: CHANGE_PER_SECOND
                - type: MULTIPLIER
                  parameters:
                    - '0.001'
              master_item:
                key: 'vfs.file.contents[/sys/block/{#DEVNAME}/stat]'
              tags:
                - tag: component
                  value: storage
                - tag: disk
                  value: '{#DEVNAME}'
            - uuid: 72546bd5eefb4ac7a0b2992a25e5f0c5
              name: '{#DEVNAME}: Disk utilization'
              type: DEPENDENT
              key: 'vfs.dev.util[{#DEVNAME}]'
              value_type: FLOAT
              units: '%'
              description: 'The percentage of elapsed time during which the selected disk drive was busy while servicing read or write requests.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$[9]'
                - type: CHANGE_PER_SECOND
                - type: MULTIPLIER
                  parameters:
                    - '0.1'
              master_item:
                key: 'vfs.file.contents[/sys/block/{#DEVNAME}/stat]'
              tags:
                - tag: component
                  value: storage
                - tag: disk
                  value: '{#DEVNAME}'
            - uuid: 8422c37735774134996be62580e7bf0f
              name: '{#DEVNAME}: Disk write request avg waiting time (w_await)'
              type: CALCULATED
              key: 'vfs.dev.write.await[{#DEVNAME}]'
              value_type: FLOAT
              units: '!ms'
              params: '(last(//vfs.dev.write.time.rate[{#DEVNAME}])/(last(//vfs.dev.write.rate[{#DEVNAME}])+(last(//vfs.dev.write.rate[{#DEVNAME}])=0)))*1000*(last(//vfs.dev.write.rate[{#DEVNAME}]) > 0)'
              description: 'This formula contains two Boolean expressions that evaluate to 1 or 0 in order to set the calculated metric to zero and to avoid the exception - division by zero.'
              tags:
                - tag: component
                  value: storage
                - tag: disk
                  value: '{#DEVNAME}'
            - uuid: 4ba78909402d4bb8ab32f12c679ea3db
              name: '{#DEVNAME}: Disk write rate'
              type: DEPENDENT
              key: 'vfs.dev.write.rate[{#DEVNAME}]'
              value_type: FLOAT
              units: '!w/s'
              description: 'w/s (write operations per second) - the number (after merges) of write requests completed per second for the device.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$[4]'
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'vfs.file.contents[/sys/block/{#DEVNAME}/stat]'
              tags:
                - tag: component
                  value: storage
                - tag: disk
                  value: '{#DEVNAME}'
            - uuid: 7717dd9841004fa08b35b0e9f42bffaf
              name: '{#DEVNAME}: Disk write time (rate)'
              type: DEPENDENT
              key: 'vfs.dev.write.time.rate[{#DEVNAME}]'
              value_type: FLOAT
              description: 'The rate of total write time counter; used in `w_await` calculation.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$[7]'
                - type: CHANGE_PER_SECOND
                - type: MULTIPLIER
                  parameters:
                    - '0.001'
              master_item:
                key: 'vfs.file.contents[/sys/block/{#DEVNAME}/stat]'
              tags:
                - tag: component
                  value: storage
                - tag: disk
                  value: '{#DEVNAME}'
            - uuid: 39877664726f4886aa88f3d1592bbcb1
              name: '{#DEVNAME}: Get stats'
              type: ZABBIX_ACTIVE
              key: 'vfs.file.contents[/sys/block/{#DEVNAME}/stat]'
              history: '0'
              value_type: TEXT
              description: 'The contents of get `/sys/block/{#DEVNAME}/stat` to get the disk statistics.'
              preprocessing:
                - type: JAVASCRIPT
                  parameters:
                    - 'return JSON.stringify(value.trim().split(/ +/));'
              tags:
                - tag: component
                  value: raw
          trigger_prototypes:
            - uuid: fd5732c3cf5249f9a05e3b6cedc2d2fd
              expression: 'min(/Linux by Zabbix agent active/vfs.dev.read.await[{#DEVNAME}],15m) > {$VFS.DEV.READ.AWAIT.WARN:"{#DEVNAME}"} or min(/Linux by Zabbix agent active/vfs.dev.write.await[{#DEVNAME}],15m) > {$VFS.DEV.WRITE.AWAIT.WARN:"{#DEVNAME}"}'
              name: 'Linux: {#DEVNAME}: Disk read/write request responses are too high'
              event_name: 'Linux: {#DEVNAME}: Disk read/write request responses are too high (read > {$VFS.DEV.READ.AWAIT.WARN:"{#DEVNAME}"} ms for 15m or write > {$VFS.DEV.WRITE.AWAIT.WARN:"{#DEVNAME}"} ms for 15m)'
              priority: WARNING
              description: 'This trigger might indicate the disk `{#DEVNAME}` saturation.'
              manual_close: 'YES'
              tags:
                - tag: scope
                  value: performance
          graph_prototypes:
            - uuid: feca6a365b8d49d2a66ff4bfac089fc8
              name: '{#DEVNAME}: Disk average waiting time'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'Linux by Zabbix agent active'
                    key: 'vfs.dev.read.await[{#DEVNAME}]'
                - sortorder: '1'
                  drawtype: GRADIENT_LINE
                  color: F63100
                  item:
                    host: 'Linux by Zabbix agent active'
                    key: 'vfs.dev.write.await[{#DEVNAME}]'
            - uuid: b136583f822a4d48a52a17f4bb0d07d9
              name: '{#DEVNAME}: Disk read/write rates'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'Linux by Zabbix agent active'
                    key: 'vfs.dev.read.rate[{#DEVNAME}]'
                - sortorder: '1'
                  drawtype: GRADIENT_LINE
                  color: F63100
                  item:
                    host: 'Linux by Zabbix agent active'
                    key: 'vfs.dev.write.rate[{#DEVNAME}]'
            - uuid: 8863772fb82b49a891ea50cbec5cdd05
              name: '{#DEVNAME}: Disk utilization and queue'
              graph_items:
                - color: 199C0D
                  yaxisside: RIGHT
                  item:
                    host: 'Linux by Zabbix agent active'
                    key: 'vfs.dev.queue_size[{#DEVNAME}]'
                - sortorder: '1'
                  drawtype: GRADIENT_LINE
                  color: F63100
                  item:
                    host: 'Linux by Zabbix agent active'
                    key: 'vfs.dev.util[{#DEVNAME}]'
        - uuid: 5c9b5dbed44c4af0957ff9316f8fb761
          name: 'Mounted filesystem discovery'
          type: DEPENDENT
          key: vfs.fs.dependent.discovery
          filter:
            evaltype: AND
            conditions:
              - macro: '{#FSNAME}'
                value: '{$VFS.FS.FSNAME.MATCHES}'
              - macro: '{#FSNAME}'
                value: '{$VFS.FS.FSNAME.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
              - macro: '{#FSTYPE}'
                value: '{$VFS.FS.FSTYPE.MATCHES}'
              - macro: '{#FSTYPE}'
                value: '{$VFS.FS.FSTYPE.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          description: 'The discovery of mounted filesystems with different types.'
          item_prototypes:
            - uuid: 5cc9099851ee4f4498fd74ec2c377eb4
              name: 'FS [{#FSNAME}]: Inodes: Free, in %'
              type: DEPENDENT
              key: 'vfs.fs.dependent.inode[{#FSNAME},pfree]'
              value_type: FLOAT
              units: '%'
              description: 'Free metadata space expressed in %.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.inodes.pfree
              master_item:
                key: 'vfs.fs.dependent[{#FSNAME},data]'
              tags:
                - tag: component
                  value: storage
                - tag: filesystem
                  value: '{#FSNAME}'
                - tag: fstype
                  value: '{#FSTYPE}'
              trigger_prototypes:
                - uuid: 98e196ffb6f0422baf007fcff5f45b60
                  expression: 'min(/Linux by Zabbix agent active/vfs.fs.dependent.inode[{#FSNAME},pfree],5m)<{$VFS.FS.INODE.PFREE.MIN.CRIT:"{#FSNAME}"}'
                  name: 'Linux: FS [{#FSNAME}]: Running out of free inodes'
                  event_name: 'Linux: {#FSNAME}: Running out of free inodes (free < {$VFS.FS.INODE.PFREE.MIN.CRIT:"{#FSNAME}"}%)'
                  opdata: 'Free inodes: {ITEM.LASTVALUE1}'
                  priority: AVERAGE
                  description: 'Disk writing may fail if index nodes are exhausted, leading to error messages like "No space left on device" or "Disk is full", despite available free space.'
                  tags:
                    - tag: scope
                      value: capacity
                    - tag: scope
                      value: performance
                - uuid: a17e14a65c53447a9ce607799a62e7dd
                  expression: 'min(/Linux by Zabbix agent active/vfs.fs.dependent.inode[{#FSNAME},pfree],5m)<{$VFS.FS.INODE.PFREE.MIN.WARN:"{#FSNAME}"}'
                  name: 'Linux: FS [{#FSNAME}]: Running out of free inodes'
                  event_name: 'Linux: FS [{#FSNAME}]: Running out of free inodes (free < {$VFS.FS.INODE.PFREE.MIN.WARN:"{#FSNAME}"}%)'
                  opdata: 'Free inodes: {ITEM.LASTVALUE1}'
                  priority: WARNING
                  description: 'Disk writing may fail if index nodes are exhausted, leading to error messages like "No space left on device" or "Disk is full", despite available free space.'
                  dependencies:
                    - name: 'Linux: FS [{#FSNAME}]: Running out of free inodes'
                      expression: 'min(/Linux by Zabbix agent active/vfs.fs.dependent.inode[{#FSNAME},pfree],5m)<{$VFS.FS.INODE.PFREE.MIN.CRIT:"{#FSNAME}"}'
                  tags:
                    - tag: scope
                      value: capacity
                    - tag: scope
                      value: performance
            - uuid: 4c658024f34c49d7bd5f6ca9b33c13d7
              name: 'FS [{#FSNAME}]: Space: Available'
              type: DEPENDENT
              key: 'vfs.fs.dependent.size[{#FSNAME},free]'
              units: B
              description: 'Available storage space expressed in bytes.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.bytes.free
              master_item:
                key: 'vfs.fs.dependent[{#FSNAME},data]'
              tags:
                - tag: component
                  value: storage
                - tag: filesystem
                  value: '{#FSNAME}'
                - tag: fstype
                  value: '{#FSTYPE}'
            - uuid: b33989051217493cb9124302297e409f
              name: 'FS [{#FSNAME}]: Space: Used, in %'
              type: DEPENDENT
              key: 'vfs.fs.dependent.size[{#FSNAME},pused]'
              value_type: FLOAT
              units: '%'
              description: 'Calculated as the percentage of currently used space compared to the maximum available space.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.bytes.pused
              master_item:
                key: 'vfs.fs.dependent[{#FSNAME},data]'
              tags:
                - tag: component
                  value: storage
                - tag: filesystem
                  value: '{#FSNAME}'
                - tag: fstype
                  value: '{#FSTYPE}'
              trigger_prototypes:
                - uuid: cf4079132a9d4124aa5e29d6839ae35b
                  expression: 'min(/Linux by Zabbix agent active/vfs.fs.dependent.size[{#FSNAME},pused],5m)>{$VFS.FS.PUSED.MAX.CRIT:"{#FSNAME}"}'
                  name: 'Linux: FS [{#FSNAME}]: Space is critically low'
                  event_name: 'Linux: FS [{#FSNAME}]: Space is critically low (used > {$VFS.FS.PUSED.MAX.CRIT:"{#FSNAME}"}%, total {{?last(//vfs.fs.dependent.size[{#FSNAME},total])/1024/1024/1024}.fmtnum(1)}GB)'
                  opdata: 'Space used: {{ITEM.LASTVALUE1}.fmtnum(1)}%'
                  priority: AVERAGE
                  description: |
                    The volume's space usage exceeds the `{$VFS.FS.PUSED.MAX.CRIT:"{#FSNAME}"}%` limit.
                    The trigger expression is based on the current used and maximum available spaces.
                    Event name represents the total volume space, which can differ from the maximum available space, depending on the filesystem type.
                  manual_close: 'YES'
                  tags:
                    - tag: scope
                      value: availability
                    - tag: scope
                      value: capacity
                - uuid: b56b8cad3bb34fab8132e07a32c432d9
                  expression: 'min(/Linux by Zabbix agent active/vfs.fs.dependent.size[{#FSNAME},pused],5m)>{$VFS.FS.PUSED.MAX.WARN:"{#FSNAME}"}'
                  name: 'Linux: FS [{#FSNAME}]: Space is low'
                  event_name: 'Linux: FS [{#FSNAME}]: Space is low (used > {$VFS.FS.PUSED.MAX.WARN:"{#FSNAME}"}%, total {{?last(//vfs.fs.dependent.size[{#FSNAME},total])/1024/1024/1024}.fmtnum(1)}GB)'
                  opdata: 'Space used: {{ITEM.LASTVALUE1}.fmtnum(1)}%'
                  priority: WARNING
                  description: |
                    The volume's space usage exceeds the `{$VFS.FS.PUSED.MAX.WARN:"{#FSNAME}"}%` limit.
                    The trigger expression is based on the current used and maximum available spaces.
                    Event name represents the total volume space, which can differ from the maximum available space, depending on the filesystem type.
                  manual_close: 'YES'
                  dependencies:
                    - name: 'Linux: FS [{#FSNAME}]: Space is critically low'
                      expression: 'min(/Linux by Zabbix agent active/vfs.fs.dependent.size[{#FSNAME},pused],5m)>{$VFS.FS.PUSED.MAX.CRIT:"{#FSNAME}"}'
                  tags:
                    - tag: scope
                      value: availability
                    - tag: scope
                      value: capacity
            - uuid: 5cee504041e347719b35ee2c5a6056b8
              name: 'FS [{#FSNAME}]: Space: Total'
              type: DEPENDENT
              key: 'vfs.fs.dependent.size[{#FSNAME},total]'
              units: B
              description: 'Total space expressed in bytes.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.bytes.total
              master_item:
                key: 'vfs.fs.dependent[{#FSNAME},data]'
              tags:
                - tag: component
                  value: storage
                - tag: filesystem
                  value: '{#FSNAME}'
                - tag: fstype
                  value: '{#FSTYPE}'
            - uuid: f23970d301be4085ab9038d3078b3871
              name: 'FS [{#FSNAME}]: Space: Used'
              type: DEPENDENT
              key: 'vfs.fs.dependent.size[{#FSNAME},used]'
              units: B
              description: 'Used storage expressed in bytes.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.bytes.used
              master_item:
                key: 'vfs.fs.dependent[{#FSNAME},data]'
              tags:
                - tag: component
                  value: storage
                - tag: filesystem
                  value: '{#FSNAME}'
                - tag: fstype
                  value: '{#FSTYPE}'
            - uuid: 7eb5cb610b1e4c438af380383c75047f
              name: 'FS [{#FSNAME}]: Get data'
              type: DEPENDENT
              key: 'vfs.fs.dependent[{#FSNAME},data]'
              history: 1h
              value_type: TEXT
              description: 'Intermediate data of `{#FSNAME}` filesystem.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$.[?(@.fsname==''{#FSNAME}'')].first()'
              master_item:
                key: vfs.fs.get
              tags:
                - tag: component
                  value: raw
                - tag: component
                  value: storage
                - tag: filesystem
                  value: '{#FSNAME}'
                - tag: fstype
                  value: '{#FSTYPE}'
            - uuid: e335d40e5d0e4e41b29f1b355018dd91
              name: 'FS [{#FSNAME}]: Option: Read-only'
              type: DEPENDENT
              key: 'vfs.fs.dependent[{#FSNAME},readonly]'
              description: 'The filesystem is mounted as read-only. It is available only for Zabbix agents 6.4 and higher.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.options
                  error_handler: DISCARD_VALUE
                - type: REGEX
                  parameters:
                    - '(?:^|,)ro\b'
                    - '1'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '0'
              master_item:
                key: 'vfs.fs.dependent[{#FSNAME},data]'
              tags:
                - tag: component
                  value: storage
                - tag: filesystem
                  value: '{#FSNAME}'
                - tag: fstype
                  value: '{#FSTYPE}'
              trigger_prototypes:
                - uuid: 001c20d581824f0380244745ce0fae9e
                  expression: 'last(/Linux by Zabbix agent active/vfs.fs.dependent[{#FSNAME},readonly],#2)=0 and last(/Linux by Zabbix agent active/vfs.fs.dependent[{#FSNAME},readonly])=1'
                  recovery_mode: RECOVERY_EXPRESSION
                  recovery_expression: 'last(/Linux by Zabbix agent active/vfs.fs.dependent[{#FSNAME},readonly])=0'
                  name: 'Linux: FS [{#FSNAME}]: Filesystem has become read-only'
                  priority: AVERAGE
                  description: 'The filesystem has become read-only, possibly due to an I/O error. Available only for Zabbix agents 6.4 and higher.'
                  manual_close: 'YES'
                  tags:
                    - tag: scope
                      value: availability
                    - tag: scope
                      value: performance
          graph_prototypes:
            - uuid: 7af98afdf5ad43c9b77dddbe4e68b84f
              name: 'FS [{#FSTYPE}({#FSNAME})]: Space usage graph, in % (relative to max available)'
              width: '600'
              height: '340'
              ymin_type_1: FIXED
              ymax_type_1: FIXED
              graph_items:
                - drawtype: FILLED_REGION
                  color: F63100
                  calc_fnc: ALL
                  item:
                    host: 'Linux by Zabbix agent active'
                    key: 'vfs.fs.dependent.size[{#FSNAME},pused]'
            - uuid: 1c4fcab8d16440529fb3f2347cd04f51
              name: 'FS [{#FSTYPE}({#FSNAME})]: Space utilization chart (relative to total)'
              width: '600'
              height: '340'
              type: PIE
              show_3d: 'YES'
              graph_items:
                - color: '787878'
                  calc_fnc: LAST
                  type: GRAPH_SUM
                  item:
                    host: 'Linux by Zabbix agent active'
                    key: 'vfs.fs.dependent.size[{#FSNAME},total]'
                - sortorder: '1'
                  color: F63100
                  calc_fnc: LAST
                  item:
                    host: 'Linux by Zabbix agent active'
                    key: 'vfs.fs.dependent.size[{#FSNAME},used]'
                - sortorder: '2'
                  color: 199C09
                  calc_fnc: LAST
                  item:
                    host: 'Linux by Zabbix agent active'
                    key: 'vfs.fs.dependent.size[{#FSNAME},free]'
          master_item:
            key: vfs.fs.get
          lld_macro_paths:
            - lld_macro: '{#FSNAME}'
              path: $.fsname
            - lld_macro: '{#FSTYPE}'
              path: $.fstype
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  var filesystems = JSON.parse(value);
                  
                  result = filesystems.map(function (filesystem) {
                  	return {
                  		'fsname': filesystem.fsname,
                  		'fstype': filesystem.fstype
                  	};
                  });
                  
                  return JSON.stringify(result);
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          overrides:
            - name: 'Skip metadata collection for dynamic FS'
              step: '1'
              filter:
                conditions:
                  - macro: '{#FSTYPE}'
                    value: ^(btrfs|zfs)$
              operations:
                - operator: LIKE
                  value: Inodes
                  discover: NO_DISCOVER
      tags:
        - tag: class
          value: os
        - tag: target
          value: linux
      macros:
        - macro: '{$AGENT.NODATA_TIMEOUT}'
          value: 30m
          description: 'No data timeout for active agents. Consider to keep it relatively high.'
          config:
            type: TEXT
            priority: '1'
            section_name: Thresholds
            label: 'Time since the last agent data was received'
            description: 'Threshold value of time since the last data was received from the agent.'
        - macro: '{$AGENT.TIMEOUT}'
          value: 5m
          description: 'Timeout after which agent is considered unavailable.'
          config:
            type: TEXT
            priority: '2'
            label: 'Seconds since the last Zabbix agent seen'
            description: 'Timeout after which agent is considered unavailable.'
        - macro: '{$CPU.UTIL.CRIT}'
          value: '90'
          description: 'Critical threshold of CPU utilization expressed in %.'
          config:
            type: TEXT
            priority: '3'
            section_name: Thresholds
            label: 'Threshold of CPU utilization expressed'
            description: 'Critical threshold of CPU utilization expressed in %. In the range from 0 to 100 inclusive.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$IF.ERRORS.WARN}'
          value: '2'
          description: 'Warning threshold of error packet rate. Can be used with interface name as context.'
          config:
            type: TEXT
            priority: '22'
            section_name: Thresholds
            label: 'Threshold of error packet rate'
            description: 'Warning threshold of error packet rate. No less than 0.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$IF.UTIL.MAX}'
          value: '90'
          description: 'Used as a threshold in the interface utilization trigger.'
          config:
            type: TEXT
            priority: '21'
            section_name: Thresholds
            label: 'The threshold in the interface utilization'
            description: 'Used as a threshold in the interface utilization trigger. In the range from 0 to 100 inclusive.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$IFCONTROL}'
          value: '1'
          description: 'Link status trigger will be fired only for interfaces where the context macro equals "1".'
          config:
            type: CHECKBOX
            priority: '20'
            label: 'Interfaces control'
            description: 'Control for operational state "link down" of interfaces.'
            options:
              - checked: '1'
                unchecked: '0'
        - macro: '{$KERNEL.MAXFILES.MIN}'
          value: '256'
          config:
            type: TEXT
            priority: '26'
            section_name: Thresholds
            label: 'Number of open filedescriptors'
            description: 'Configured max number of open filedescriptors. No less than 0.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$KERNEL.MAXPROC.MIN}'
          value: '1024'
          config:
            type: TEXT
            priority: '25'
            section_name: Thresholds
            label: 'Number of processes'
            description: 'Configured max number of processes. No less than 0.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$LOAD_AVG_PER_CPU.MAX.WARN}'
          value: '1.5'
          description: 'The CPU load per core is considered sustainable. If necessary, it can be tuned.'
          config:
            type: TEXT
            priority: '4'
            section_name: Thresholds
            label: 'The CPU load per core'
            description: 'CPU load per core is considered sustainable. No less than 0.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$MEMORY.AVAILABLE.MIN}'
          value: 20M
          description: 'Used as a thresholdin the memory available trigger.'
          config:
            type: TEXT
            priority: '14'
            section_name: Thresholds
            label: 'Threshold in the available memory'
            description: 'Used as a threshold in the available memory trigger.'
        - macro: '{$MEMORY.UTIL.MAX}'
          value: '90'
          description: 'Used as a thresholdin the memory utilization trigger.'
          config:
            type: TEXT
            priority: '13'
            section_name: Thresholds
            label: 'Threshold in the memory utilization'
            description: 'Used as a threshold in the memory utilization trigger. In the range from 0 to 100 inclusive.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$NET.IF.IFNAME.MATCHES}'
          value: '^.*$'
          description: 'Used for network interface discovery. Can be overridden on the host or linked template level.'
          config:
            type: TEXT
            priority: '23'
            section_name: Filters
            label: 'Network interface discovery'
            description: 'Network interface discovery.'
        - macro: '{$NET.IF.IFNAME.NOT_MATCHES}'
          value: '(^Software Loopback Interface|^NULL[0-9.]*$|^[Ll]o[0-9.]*$|^[Ss]ystem$|^Nu[0-9.]*$|^veth[0-9A-z]+$|docker[0-9]+|br-[a-z0-9]{12})'
          description: 'Filters out `loopbacks`, `nulls`, docker `veth` links and `docker0` bridge by default.'
          config:
            type: TEXT
            priority: '24'
            section_name: Filters
            label: 'Filter for network interface by name.'
            description: 'Filters out `loopbacks`, `nulls`, docker `veth` links and `docker0` bridge by default.'
        - macro: '{$SWAP.PFREE.MIN.WARN}'
          value: '50'
          description: 'The warning threshold of the minimum free swap.'
          config:
            type: TEXT
            priority: '15'
            section_name: Thresholds
            label: 'Threshold of the minimum free swap'
            description: 'Warning threshold of the minimum free swap. In the range from 0 to 100 inclusive.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$VFS.DEV.DEVNAME.MATCHES}'
          value: .+
          description: 'Used for block device discovery. Can be overridden on the host or linked template level.'
          config:
            type: TEXT
            priority: '18'
            section_name: Filters
            label: 'Filter for block device discovery'
            description: 'Block device discovery.'
        - macro: '{$VFS.DEV.DEVNAME.NOT_MATCHES}'
          value: '^(loop[0-9]*|sd[a-z][0-9]+|nbd[0-9]+|sr[0-9]+|fd[0-9]+|dm-[0-9]+|ram[0-9]+|ploop[a-z0-9]+|md[0-9]*|hcp[0-9]*|zram[0-9]*)'
          description: 'Used for block device discovery. Can be overridden on the host or linked template level.'
          config:
            type: TEXT
            priority: '19'
            section_name: Filters
            label: 'Filter for block device discovery (exclude)'
            description: 'Block device discovery.'
        - macro: '{$VFS.DEV.READ.AWAIT.WARN}'
          value: '20'
          description: 'The average response time (in ms) of disk read before the trigger fires.'
          config:
            type: TEXT
            priority: '16'
            section_name: Thresholds
            label: 'The average read time (in ms)'
            description: 'Average response time (in ms) of disk read before the trigger fires. No less than 0.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$VFS.DEV.WRITE.AWAIT.WARN}'
          value: '20'
          description: 'The average response time (in ms) of disk write before the trigger fires.'
          config:
            type: TEXT
            priority: '17'
            section_name: Thresholds
            label: 'The average write time (in ms)'
            description: 'Average response time (in ms) of disk write before the trigger fires. No less than 0.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$VFS.FS.FSNAME.MATCHES}'
          value: .+
          description: 'Used for filesystem discovery. Can be overridden on the host or linked template level.'
          config:
            type: TEXT
            priority: '9'
            section_name: Filters
            label: 'Filter filesystem by name'
            description: 'Filesystem discovery.'
        - macro: '{$VFS.FS.FSNAME.NOT_MATCHES}'
          value: ^(/dev|/sys|/run|/proc|.+/shm$)
          description: 'Used for filesystem discovery. Can be overridden on the host or linked template level.'
          config:
            type: TEXT
            priority: '10'
            section_name: Filters
            label: 'Filter filesystem by name (exclude)'
            description: 'Filesystem discovery.'
        - macro: '{$VFS.FS.FSTYPE.MATCHES}'
          value: ^(btrfs|ext2|ext3|ext4|reiser|xfs|ffs|ufs|jfs|jfs2|vxfs|hfs|apfs|refs|ntfs|fat32|zfs)$
          description: 'Used for filesystem discovery. Can be overridden on the host or linked template level.'
          config:
            type: TEXT
            priority: '11'
            section_name: Filters
            label: 'Filter filesystem by type'
            description: 'Filesystem discovery.'
        - macro: '{$VFS.FS.FSTYPE.NOT_MATCHES}'
          value: ^\s$
          description: 'Used for filesystem discovery. Can be overridden on the host or linked template level.'
          config:
            type: TEXT
            priority: '12'
            section_name: Filters
            label: 'Filter filesystem by name (exclude)'
            description: 'Filesystem discovery.'
        - macro: '{$VFS.FS.INODE.PFREE.MIN.CRIT}'
          value: '10'
          description: 'The critical threshold of the filesystem metadata utilization.'
          config:
            type: TEXT
            priority: '8'
            section_name: Thresholds
            label: 'Threshold of the filesystem metadata utilization (critical)'
            description: 'Critical threshold of the filesystem metadata utilization. In the range from 0 to 100 inclusive.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$VFS.FS.INODE.PFREE.MIN.WARN}'
          value: '20'
          description: 'The warning threshold of the filesystem metadata utilization.'
          config:
            type: TEXT
            priority: '7'
            section_name: Thresholds
            label: 'Threshold of the filesystem metadata utilization'
            description: 'Warning threshold of the filesystem metadata utilization. In the range from 0 to 100 inclusive.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$VFS.FS.PUSED.MAX.CRIT}'
          value: '90'
          description: 'The critical threshold of the filesystem utilization.'
          config:
            type: TEXT
            priority: '6'
            section_name: Thresholds
            label: 'Threshold of the filesystem utilization (critical)'
            description: 'Critical threshold of the filesystem utilization. In the range from 0 to 100 inclusive.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$VFS.FS.PUSED.MAX.WARN}'
          value: '80'
          description: 'The warning threshold of the filesystem utilization.'
          config:
            type: TEXT
            priority: '5'
            section_name: Thresholds
            label: 'Threshold of the filesystem utilization'
            description: 'Warning threshold of the filesystem utilization. In the range from 0 to 100 inclusive.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
      dashboards:
        - uuid: 9dca5f83cd664db1ba41b8751ce3d055
          name: Filesystems
          pages:
            - name: Overview
              widgets:
                - type: graphprototype
                  width: '72'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '3'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'Linux by Zabbix agent active'
                        name: 'FS [{#FSTYPE}({#FSNAME})]: Space utilization chart (relative to total)'
                    - type: STRING
                      name: reference
                      value: AAAEB
                - type: graphprototype
                  'y': '5'
                  width: '72'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'Linux by Zabbix agent active'
                        name: 'FS [{#FSTYPE}({#FSNAME})]: Space usage graph, in % (relative to max available)'
                    - type: STRING
                      name: reference
                      value: AAAEC
        - uuid: 6d179c1f45c2438e9e6a3aa567d46b0c
          name: 'Network interfaces'
          pages:
            - name: Overview
              widgets:
                - type: graphprototype
                  width: '72'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'Linux by Zabbix agent active'
                        name: 'Interface {#IFNAME}: Network traffic'
                    - type: STRING
                      name: reference
                      value: AAAAJ
        - uuid: 3e6ceed431734cc29836019e93b5f89e
          name: 'System performance'
          pages:
            - widgets:
                - type: graph
                  width: '36'
                  height: '5'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Linux by Zabbix agent active'
                        name: 'Linux: System load'
                    - type: STRING
                      name: reference
                      value: AAAAA
                - type: graph
                  'y': '5'
                  width: '36'
                  height: '5'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Linux by Zabbix agent active'
                        name: 'Linux: Memory usage'
                    - type: STRING
                      name: reference
                      value: AAAAC
                - type: graphprototype
                  'y': '10'
                  width: '72'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '3'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'Linux by Zabbix agent active'
                        name: 'FS [{#FSTYPE}({#FSNAME})]: Space utilization chart (relative to total)'
                    - type: STRING
                      name: reference
                      value: AAAEA
                - type: graphprototype
                  'y': '15'
                  width: '72'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'Linux by Zabbix agent active'
                        name: '{#DEVNAME}: Disk read/write rates'
                    - type: STRING
                      name: reference
                      value: AAAAF
                - type: graphprototype
                  'y': '20'
                  width: '72'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'Linux by Zabbix agent active'
                        name: '{#DEVNAME}: Disk average waiting time'
                    - type: STRING
                      name: reference
                      value: AAAAG
                - type: graphprototype
                  'y': '25'
                  width: '72'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'Linux by Zabbix agent active'
                        name: '{#DEVNAME}: Disk utilization and queue'
                    - type: STRING
                      name: reference
                      value: AAAAH
                - type: graphprototype
                  'y': '30'
                  width: '72'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'Linux by Zabbix agent active'
                        name: 'Interface {#IFNAME}: Network traffic'
                    - type: STRING
                      name: reference
                      value: AAAAI
                - type: graph
                  x: '36'
                  width: '36'
                  height: '5'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Linux by Zabbix agent active'
                        name: 'Linux: CPU usage'
                    - type: STRING
                      name: reference
                      value: AAAAB
                - type: graph
                  x: '36'
                  'y': '5'
                  width: '36'
                  height: '5'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Linux by Zabbix agent active'
                        name: 'Linux: Swap usage'
                    - type: STRING
                      name: reference
                      value: AAAAD
      valuemaps:
        - uuid: 276914b5aee2435da609d3112ecd359d
          name: ifOperStatus
          mappings:
            - value: '0'
              newvalue: unknown
            - value: '1'
              newvalue: notpresent
            - value: '2'
              newvalue: down
            - value: '3'
              newvalue: lowerlayerdown
            - value: '4'
              newvalue: testing
            - value: '5'
              newvalue: dormant
            - value: '6'
              newvalue: up
        - uuid: 79afe98a54a648bb981c29e70ba6652c
          name: 'Linux::Interface protocol types'
          mappings:
            - value: '0'
              newvalue: 'from KA9Q: NET/ROM pseudo'
            - value: '1'
              newvalue: Ethernet
            - value: '2'
              newvalue: 'Experimental Ethernet'
            - value: '3'
              newvalue: 'AX.25 Level 2'
            - value: '4'
              newvalue: 'PROnet token ring'
            - value: '5'
              newvalue: Chaosnet
            - value: '6'
              newvalue: 'IEEE 802.2 Ethernet/TR/TB'
            - value: '7'
              newvalue: ARCnet
            - value: '8'
              newvalue: APPLEtalk
            - value: '15'
              newvalue: 'Frame Relay DLCI'
            - value: '19'
              newvalue: ATM
            - value: '23'
              newvalue: 'Metricom STRIP (new IANA id)'
            - value: '24'
              newvalue: 'IEEE 1394 IPv4 - RFC 2734'
            - value: '27'
              newvalue: EUI-64
            - value: '32'
              newvalue: InfiniBand
            - value: '256'
              newvalue: ARPHRD_SLIP
            - value: '257'
              newvalue: ARPHRD_CSLIP
            - value: '258'
              newvalue: ARPHRD_SLIP6
            - value: '259'
              newvalue: ARPHRD_CSLIP6
            - value: '260'
              newvalue: 'Notional KISS type'
            - value: '264'
              newvalue: ARPHRD_ADAPT
            - value: '270'
              newvalue: ARPHRD_ROSE
            - value: '271'
              newvalue: 'CCITT X.25'
            - value: '272'
              newvalue: 'Boards with X.25 in firmware'
            - value: '280'
              newvalue: 'Controller Area Network'
            - value: '512'
              newvalue: ARPHRD_PPP
            - value: '513'
              newvalue: 'Cisco HDLC'
            - value: '516'
              newvalue: LAPB
            - value: '517'
              newvalue: 'Digital''s DDCMP protocol'
            - value: '518'
              newvalue: 'Raw HDLC'
            - value: '519'
              newvalue: 'Raw IP'
            - value: '768'
              newvalue: 'IPIP tunnel'
            - value: '769'
              newvalue: 'IP6IP6 tunnel'
            - value: '770'
              newvalue: 'Frame Relay Access Device'
            - value: '771'
              newvalue: 'SKIP vif'
            - value: '772'
              newvalue: 'Loopback device'
            - value: '773'
              newvalue: 'Localtalk device'
            - value: '774'
              newvalue: 'Fiber Distributed Data Interface'
            - value: '775'
              newvalue: 'AP1000 BIF'
            - value: '776'
              newvalue: 'sit0 device - IPv6-in-IPv4'
            - value: '777'
              newvalue: 'IP over DDP tunneller'
            - value: '778'
              newvalue: 'GRE over IP'
            - value: '779'
              newvalue: 'PIMSM register interface'
            - value: '780'
              newvalue: 'High Performance Parallel Interface'
            - value: '781'
              newvalue: 'Nexus 64Mbps Ash'
            - value: '782'
              newvalue: 'Acorn Econet'
            - value: '783'
              newvalue: Linux-IrDA
            - value: '784'
              newvalue: 'Point to point fibrechannel'
            - value: '785'
              newvalue: 'Fibrechannel arbitrated loop'
            - value: '786'
              newvalue: 'Fibrechannel public loop'
            - value: '787'
              newvalue: 'Fibrechannel fabric'
            - value: '800'
              newvalue: 'Magic type ident for TR'
            - value: '801'
              newvalue: 'IEEE 802.11'
            - value: '802'
              newvalue: 'IEEE 802.11 + Prism2 header'
            - value: '803'
              newvalue: 'IEEE 802.11 + radiotap header'
            - value: '804'
              newvalue: ARPHRD_IEEE802154
            - value: '805'
              newvalue: 'IEEE 802.15.4 network monitor'
            - value: '820'
              newvalue: 'PhoNet media type'
            - value: '821'
              newvalue: 'PhoNet pipe header'
            - value: '822'
              newvalue: 'CAIF media type'
            - value: '823'
              newvalue: 'GRE over IPv6'
            - value: '824'
              newvalue: 'Netlink header'
            - value: '825'
              newvalue: 'IPv6 over LoWPAN'
            - value: '826'
              newvalue: 'Vsock monitor header'
        - uuid: d4a5821461a243c9bf320ea58be1af23
          name: zabbix.host.active_agent.available
          mappings:
            - value: '0'
              newvalue: unknown
            - value: '1'
              newvalue: available
            - value: '2'
              newvalue: 'not available'
        - uuid: e815d397c5e44f1791622fd598bc1131
          name: 'Zabbix agent ping status'
          mappings:
            - value: '1'
              newvalue: Up
    - uuid: a60798c651604d93a062bec0f8a89751
      template: 'Mellanox by SNMP'
      name: 'Mellanox by SNMP'
      description: |
        The updated template for monitoring the Mellanox network switches over SNMP agent. All items collected in one template without any linked templates.
        
        MIBs used:
        HOST-RESOURCES-MIB
        SNMPv2-MIB
        ENTITY-SENSORS-MIB
        ENTITY-STATE-MIB
        ENTITY-MIB
        IF-MIB
        
        Generated by official Zabbix template tool "Templator"
      wizard_ready: 'YES'
      vendor:
        name: Zabbix
        version: 8.0-2
      groups:
        - name: 'Templates/Network devices'
      items:
        - uuid: 87480ce035a94f299c4cf4103eaaf066
          name: 'ICMP ping'
          type: SIMPLE
          key: icmpping
          valuemap:
            name: 'Service state'
          tags:
            - tag: component
              value: health
            - tag: component
              value: network
          triggers:
            - uuid: fe4c81a386814dfa80ffc76e1b7da9a1
              expression: 'max(/Mellanox by SNMP/icmpping,#3)=0'
              name: 'Mellanox: Unavailable by ICMP ping'
              priority: HIGH
              description: 'Last three attempts returned timeout.  Please check device connectivity.'
              tags:
                - tag: scope
                  value: availability
        - uuid: 50e85be3969447c58fcfeca5d9a1a9bb
          name: 'ICMP loss'
          type: SIMPLE
          key: icmppingloss
          value_type: FLOAT
          units: '%'
          tags:
            - tag: component
              value: health
            - tag: component
              value: network
          triggers:
            - uuid: 52b307324c37481693d419df236cbbd7
              expression: 'min(/Mellanox by SNMP/icmppingloss,5m)>{$ICMP_LOSS_WARN} and min(/Mellanox by SNMP/icmppingloss,5m)<100'
              name: 'Mellanox: High ICMP ping loss'
              opdata: 'Loss: {ITEM.LASTVALUE1}'
              priority: WARNING
              dependencies:
                - name: 'Mellanox: Unavailable by ICMP ping'
                  expression: 'max(/Mellanox by SNMP/icmpping,#3)=0'
              tags:
                - tag: scope
                  value: availability
                - tag: scope
                  value: performance
        - uuid: 7567e999d75442379066babdc9b50894
          name: 'ICMP response time'
          type: SIMPLE
          key: icmppingsec
          value_type: FLOAT
          units: s
          tags:
            - tag: component
              value: health
            - tag: component
              value: network
          triggers:
            - uuid: 39a9cff305074e1a8b7c6ed0c526fda9
              expression: 'avg(/Mellanox by SNMP/icmppingsec,5m)>{$ICMP_RESPONSE_TIME_WARN}'
              name: 'Mellanox: High ICMP ping response time'
              opdata: 'Value: {ITEM.LASTVALUE1}'
              priority: WARNING
              dependencies:
                - name: 'Mellanox: High ICMP ping loss'
                  expression: 'min(/Mellanox by SNMP/icmppingloss,5m)>{$ICMP_LOSS_WARN} and min(/Mellanox by SNMP/icmppingloss,5m)<100'
                - name: 'Mellanox: Unavailable by ICMP ping'
                  expression: 'max(/Mellanox by SNMP/icmpping,#3)=0'
              tags:
                - tag: scope
                  value: availability
                - tag: scope
                  value: performance
        - uuid: 0cb8aadeb5554583a65c3496cfed2c1b
          name: 'SNMP traps (fallback)'
          type: SNMP_TRAP
          key: snmptrap.fallback
          value_type: LOG
          description: 'The item is used to collect all SNMP traps unmatched by other snmptrap items'
          logtimefmt: 'hh:mm:sszyyyy/MM/dd'
          tags:
            - tag: component
              value: network
        - uuid: f62a8b653c3d44d09864a4a4c910aeb1
          name: 'System contact details'
          type: SNMP_AGENT
          snmp_oid: 'get[1.3.6.1.2.1.1.4.0]'
          key: 'system.contact[sysContact.0]'
          delay: 15m
          value_type: CHAR
          description: |
            MIB: SNMPv2-MIB
            The textual identification of the contact person for this managed node, together with information on how to contact this person.  If no contact information is known, the value is the zero-length string.
          inventory_link: CONTACT
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 12h
          tags:
            - tag: component
              value: system
        - uuid: c33470549bda45e88ecb8ded7d0b5e87
          name: 'CPU utilization'
          type: SNMP_AGENT
          snmp_oid: 'discovery[{#CPU.UTIL},1.3.6.1.2.1.25.3.3.1.2]'
          key: system.cpu.util
          value_type: FLOAT
          units: '%'
          description: |
            MIB: HOST-RESOURCES-MIB
            The average, over the last minute, of the percentage of time that processors was not idle.
            Implementations may approximate this one minute smoothing period if necessary.
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$..[''{#CPU.UTIL}''].avg()'
          tags:
            - tag: component
              value: cpu
          triggers:
            - uuid: 26913093ab414fe69ff157102ae54796
              expression: 'min(/Mellanox by SNMP/system.cpu.util,5m)>{$CPU.UTIL.CRIT}'
              name: 'Mellanox: High CPU utilization'
              event_name: 'Mellanox: High CPU utilization (over {$CPU.UTIL.CRIT}% for 5m)'
              opdata: 'Current utilization: {ITEM.LASTVALUE1}'
              priority: WARNING
              description: 'The CPU utilization is too high. The system might be slow to respond.'
              tags:
                - tag: scope
                  value: performance
        - uuid: 64c4f3e890ec4c29be07ba2d06345534
          name: 'System description'
          type: SNMP_AGENT
          snmp_oid: 'get[1.3.6.1.2.1.1.1.0]'
          key: 'system.descr[sysDescr.0]'
          delay: 15m
          value_type: CHAR
          description: |
            MIB: SNMPv2-MIB
            A textual description of the entity. This value should
            include the full name and version identification of the system's hardware type, software operating-system, and
            networking software.
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 12h
          tags:
            - tag: component
              value: system
        - uuid: f867fb976e0b49a895129865e95096c2
          name: 'Uptime (hardware)'
          type: SNMP_AGENT
          snmp_oid: 'get[1.3.6.1.2.1.25.1.1.0]'
          key: 'system.hw.uptime[hrSystemUptime.0]'
          delay: 30s
          trends: '0'
          units: uptime
          description: |
            MIB: HOST-RESOURCES-MIB
            The amount of time since this host was last initialized. Note that this is different from sysUpTime in the SNMPv2-MIB [RFC1907] because sysUpTime is the uptime of the network management portion of the system.
          preprocessing:
            - type: CHECK_NOT_SUPPORTED
              parameters:
                - '-1'
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
            - type: MULTIPLIER
              parameters:
                - '0.01'
          tags:
            - tag: component
              value: system
        - uuid: e0d2149e1a114f3a971c324673beae2f
          name: 'System location'
          type: SNMP_AGENT
          snmp_oid: 'get[1.3.6.1.2.1.1.6.0]'
          key: 'system.location[sysLocation.0]'
          delay: 15m
          value_type: CHAR
          description: |
            MIB: SNMPv2-MIB
            The physical location of this node (e.g., `telephone closet, 3rd floor').  If the location is unknown, the value is the zero-length string.
          inventory_link: LOCATION
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 12h
          tags:
            - tag: component
              value: system
        - uuid: f63d1f71a97e45b0ab5716299ef298ea
          name: 'System name'
          type: SNMP_AGENT
          snmp_oid: 'get[1.3.6.1.2.1.1.5.0]'
          key: system.name
          delay: 15m
          value_type: CHAR
          description: |
            MIB: SNMPv2-MIB
            An administratively-assigned name for this managed node.By convention, this is the node's fully-qualified domain name.  If the name is unknown, the value is the zero-length string.
          inventory_link: NAME
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 12h
          tags:
            - tag: component
              value: system
          triggers:
            - uuid: ff7ad0676a774cf49a4568e752dd916b
              expression: 'last(/Mellanox by SNMP/system.name,#1)<>last(/Mellanox by SNMP/system.name,#2) and length(last(/Mellanox by SNMP/system.name))>0'
              name: 'Mellanox: System name has changed'
              event_name: 'Mellanox: System name has changed (new name: {ITEM.VALUE})'
              priority: INFO
              description: 'The name of the system has changed. Acknowledge to close the problem manually.'
              manual_close: 'YES'
              tags:
                - tag: scope
                  value: notice
                - tag: scope
                  value: security
        - uuid: d7f06d23f6b14677b5183f2cc94fc10d
          name: 'Uptime (network)'
          type: SNMP_AGENT
          snmp_oid: 'get[1.3.6.1.2.1.1.3.0]'
          key: 'system.net.uptime[sysUpTime.0]'
          delay: 30s
          trends: '0'
          units: uptime
          description: |
            MIB: SNMPv2-MIB
            The time (in hundredths of a second) since the network management portion of the system was last re-initialized.
          preprocessing:
            - type: MULTIPLIER
              parameters:
                - '0.01'
          tags:
            - tag: component
              value: system
        - uuid: f1535f45138b472c945e231a9beb9cc5
          name: 'System object ID'
          type: SNMP_AGENT
          snmp_oid: 'get[1.3.6.1.2.1.1.2.0]'
          key: 'system.objectid[sysObjectID.0]'
          delay: 15m
          value_type: CHAR
          description: |
            MIB: SNMPv2-MIB
            The vendor's authoritative identification of the network management subsystem contained in the entity.  This value is allocated within the SMI enterprises subtree (1.3.6.1.4.1) and provides an easy and unambiguous means for determining`what kind of box' is being managed.  For example, if vendor`Flintstones, Inc.' was assigned the subtree1.3.6.1.4.1.4242, it could assign the identifier 1.3.6.1.4.1.4242.1.1 to its `Fred Router'.
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 12h
          tags:
            - tag: component
              value: system
        - uuid: aba117057e824b6789fca847cae9e0fc
          name: 'SNMP agent availability'
          type: INTERNAL
          key: 'zabbix[host,snmp,available]'
          description: |
            Availability of SNMP checks on the host. The value of this item corresponds to availability icons in the host list.
            Possible values:
            0 - not available
            1 - available
            2 - unknown
          valuemap:
            name: zabbix.host.available
          tags:
            - tag: component
              value: health
            - tag: component
              value: network
          triggers:
            - uuid: 6e476399963a414a847c4c514055bf43
              expression: 'max(/Mellanox by SNMP/zabbix[host,snmp,available],{$SNMP.TIMEOUT})=0'
              name: 'Mellanox: No SNMP data collection'
              opdata: 'Current state: {ITEM.LASTVALUE1}'
              priority: WARNING
              description: 'SNMP is not available for polling. Please check device connectivity and SNMP settings.'
              dependencies:
                - name: 'Mellanox: Unavailable by ICMP ping'
                  expression: 'max(/Mellanox by SNMP/icmpping,#3)=0'
              tags:
                - tag: scope
                  value: availability
      discovery_rules:
        - uuid: 55a44fb2235f4e25b960422338674193
          name: 'Entity Discovery'
          type: SNMP_AGENT
          snmp_oid: 'discovery[{#ENT_CLASS},1.3.6.1.2.1.47.1.1.1.1.5,{#ENT_NAME},1.3.6.1.2.1.47.1.1.1.1.7]'
          key: entity.discovery
          delay: 1h
          filter:
            conditions:
              - macro: '{#ENT_CLASS}'
                value: '3'
          item_prototypes:
            - uuid: d3643a044d4544e8a3487ed79c3a5390
              name: '{#ENT_NAME}: Hardware model name'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.47.1.1.1.1.13.{#SNMPINDEX}]'
              key: 'system.hw.model[entPhysicalModelName.{#SNMPINDEX}]'
              delay: 1h
              value_type: CHAR
              description: 'MIB: ENTITY-MIB'
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1d
              tags:
                - tag: component
                  value: system
            - uuid: 9f2e2fd678e94554be29654a5746099f
              name: '{#ENT_NAME}: Hardware serial number'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.47.1.1.1.1.11.{#SNMPINDEX}]'
              key: 'system.hw.serialnumber[entPhysicalSerialNum.{#SNMPINDEX}]'
              delay: 1h
              value_type: CHAR
              description: 'MIB: ENTITY-MIB'
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1d
              tags:
                - tag: component
                  value: system
              trigger_prototypes:
                - uuid: 585db2b2a42b4eb09770ca2241a557d0
                  expression: 'last(/Mellanox by SNMP/system.hw.serialnumber[entPhysicalSerialNum.{#SNMPINDEX}],#1)<>last(/Mellanox by SNMP/system.hw.serialnumber[entPhysicalSerialNum.{#SNMPINDEX}],#2) and length(last(/Mellanox by SNMP/system.hw.serialnumber[entPhysicalSerialNum.{#SNMPINDEX}]))>0'
                  name: 'Mellanox: {#ENT_NAME}: Device has been replaced'
                  event_name: 'Mellanox: {#ENT_NAME}: Device has been replaced (new serial number received)'
                  priority: INFO
                  description: 'Device serial number has changed. Acknowledge to close the problem manually.'
                  manual_close: 'YES'
                  tags:
                    - tag: scope
                      value: notice
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
        - uuid: 2c10f61247804bd4a8aa59fb3568d938
          name: 'Fan Discovery'
          type: SNMP_AGENT
          snmp_oid: 'discovery[{#SNMPVALUE},1.3.6.1.2.1.99.1.1.1.1,{#SENSOR_INFO},1.3.6.1.2.1.47.1.1.1.1.2]'
          key: fan.discovery
          delay: 1h
          filter:
            evaltype: OR
            conditions:
              - macro: '{#SNMPVALUE}'
                value: '10'
          description: 'ENTITY-SENSORS-MIB::EntitySensorDataType discovery with rpm filter'
          item_prototypes:
            - uuid: 284de830d5924f528b0c86abe5dbc48d
              name: '{#SENSOR_INFO}: Fan speed'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.99.1.1.1.4.{#SNMPINDEX}]'
              key: 'sensor.fan.speed[entPhySensorValue.{#SNMPINDEX}]'
              units: rpm
              description: |
                MIB: ENTITY-SENSORS-MIB
                The most recent measurement obtained by the agent for this sensor.
                To correctly interpret the value of this object, the associated entPhySensorType,
                entPhySensorScale, and entPhySensorPrecision objects must also be examined.
              tags:
                - tag: component
                  value: fan
            - uuid: 401d26902e6f4080ab2b0123d95a08ba
              name: '{#SENSOR_INFO}: Fan status'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.99.1.1.1.5.{#SNMPINDEX}]'
              key: 'sensor.fan.status[entPhySensorOperStatus.{#SNMPINDEX}]'
              delay: 3m
              trends: '0'
              description: |
                MIB: ENTITY-SENSORS-MIB
                The operational status of the sensor {#SENSOR_INFO}
              valuemap:
                name: 'ENTITY-SENSORS-MIB::EntitySensorStatus'
              tags:
                - tag: component
                  value: fan
              trigger_prototypes:
                - uuid: de81ef4f2c3f4f44a745a1fa1f179784
                  expression: 'count(/Mellanox by SNMP/sensor.fan.status[entPhySensorOperStatus.{#SNMPINDEX}],#1,"eq","{$FAN_CRIT_STATUS}")=1'
                  name: 'Mellanox: {#SENSOR_INFO}: Fan is in critical state'
                  opdata: 'Current state: {ITEM.LASTVALUE1}'
                  priority: AVERAGE
                  description: 'Please check the fan unit'
                  tags:
                    - tag: scope
                      value: availability
                    - tag: scope
                      value: performance
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  var data = JSON.parse(value).filter(function (item) {
                    return (typeof item['{#SNMPVALUE}'] !== 'undefined');
                  });
                  
                  return JSON.stringify(data);
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
        - uuid: 9e0d4ed074214f22bbbc9c8a5e3b9d0d
          name: 'Network interfaces discovery'
          type: SNMP_AGENT
          snmp_oid: 'discovery[{#IFOPERSTATUS},1.3.6.1.2.1.2.2.1.8,{#IFADMINSTATUS},1.3.6.1.2.1.2.2.1.7,{#IFALIAS},1.3.6.1.2.1.31.1.1.1.18,{#IFNAME},1.3.6.1.2.1.31.1.1.1.1,{#IFDESCR},1.3.6.1.2.1.2.2.1.2,{#IFTYPE},1.3.6.1.2.1.2.2.1.3]'
          key: net.if.discovery
          delay: 1h
          filter:
            evaltype: AND
            conditions:
              - macro: '{#IFADMINSTATUS}'
                value: '{$NET.IF.IFADMINSTATUS.MATCHES}'
              - macro: '{#IFADMINSTATUS}'
                value: '{$NET.IF.IFADMINSTATUS.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
              - macro: '{#IFALIAS}'
                value: '{$NET.IF.IFALIAS.MATCHES}'
              - macro: '{#IFALIAS}'
                value: '{$NET.IF.IFALIAS.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
              - macro: '{#IFDESCR}'
                value: '{$NET.IF.IFDESCR.MATCHES}'
              - macro: '{#IFDESCR}'
                value: '{$NET.IF.IFDESCR.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
              - macro: '{#IFNAME}'
                value: '{$NET.IF.IFNAME.MATCHES}'
              - macro: '{#IFNAME}'
                value: '{$NET.IF.IFNAME.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
              - macro: '{#IFOPERSTATUS}'
                value: '{$NET.IF.IFOPERSTATUS.MATCHES}'
              - macro: '{#IFOPERSTATUS}'
                value: '{$NET.IF.IFOPERSTATUS.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
              - macro: '{#IFTYPE}'
                value: '{$NET.IF.IFTYPE.MATCHES}'
              - macro: '{#IFTYPE}'
                value: '{$NET.IF.IFTYPE.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          description: 'Discovering interfaces from IF-MIB.'
          item_prototypes:
            - uuid: 8f6e736b5c9c48a68e16122d592534b2
              name: 'Interface {#IFNAME}({#IFALIAS}): Inbound packets discarded'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.2.2.1.13.{#SNMPINDEX}]'
              key: 'net.if.in.discards[ifInDiscards.{#SNMPINDEX}]'
              delay: 3m
              description: |
                MIB: IF-MIB
                The number of inbound packets which were chosen to be discarded
                even though no errors had been detected to prevent their being deliverable to a higher-layer protocol.
                One possible reason for discarding such a packet could be to free up buffer space.
                Discontinuities in the value of this counter can occur at re-initialization of the management system,
                and at other times as indicated by the value of ifCounterDiscontinuityTime.
              preprocessing:
                - type: CHANGE_PER_SECOND
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#IFALIAS}'
                - tag: interface
                  value: '{#IFNAME}'
            - uuid: c625b20266a04a1ba0421b4a64629dcc
              name: 'Interface {#IFNAME}({#IFALIAS}): Inbound packets with errors'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.2.2.1.14.{#SNMPINDEX}]'
              key: 'net.if.in.errors[ifInErrors.{#SNMPINDEX}]'
              delay: 3m
              description: |
                MIB: IF-MIB
                For packet-oriented interfaces, the number of inbound packets that contained errors preventing them from being deliverable to a higher-layer protocol.  For character-oriented or fixed-length interfaces, the number of inbound transmission units that contained errors preventing them from being deliverable to a higher-layer protocol. Discontinuities in the value of this counter can occur at re-initialization of the management system, and at other times as indicated by the value of ifCounterDiscontinuityTime.
              preprocessing:
                - type: CHANGE_PER_SECOND
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#IFALIAS}'
                - tag: interface
                  value: '{#IFNAME}'
            - uuid: 262f5aa5582441ecb93fd7df6a59a76d
              name: 'Interface {#IFNAME}({#IFALIAS}): Bits received'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.31.1.1.1.6.{#SNMPINDEX}]'
              key: 'net.if.in[ifHCInOctets.{#SNMPINDEX}]'
              delay: 3m
              units: bps
              description: |
                MIB: IF-MIB
                The total number of octets received on the interface, including framing characters. This object is a 64-bit version of ifInOctets. Discontinuities in the value of this counter can occur at re-initialization of the management system, and at other times as indicated by the value of ifCounterDiscontinuityTime.
              preprocessing:
                - type: CHANGE_PER_SECOND
                - type: MULTIPLIER
                  parameters:
                    - '8'
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#IFALIAS}'
                - tag: interface
                  value: '{#IFNAME}'
            - uuid: b7c510be904e4d06830ae13a16bc9668
              name: 'Interface {#IFNAME}({#IFALIAS}): Outbound packets discarded'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.2.2.1.19.{#SNMPINDEX}]'
              key: 'net.if.out.discards[ifOutDiscards.{#SNMPINDEX}]'
              delay: 3m
              description: |
                MIB: IF-MIB
                The number of outbound packets which were chosen to be discarded
                even though no errors had been detected to prevent their being deliverable to a higher-layer protocol.
                One possible reason for discarding such a packet could be to free up buffer space.
                Discontinuities in the value of this counter can occur at re-initialization of the management system,
                and at other times as indicated by the value of ifCounterDiscontinuityTime.
              preprocessing:
                - type: CHANGE_PER_SECOND
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#IFALIAS}'
                - tag: interface
                  value: '{#IFNAME}'
            - uuid: 67b4b6520bbd45fd96d78a5942b54c09
              name: 'Interface {#IFNAME}({#IFALIAS}): Outbound packets with errors'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.2.2.1.20.{#SNMPINDEX}]'
              key: 'net.if.out.errors[ifOutErrors.{#SNMPINDEX}]'
              delay: 3m
              description: |
                MIB: IF-MIB
                For packet-oriented interfaces, the number of outbound packets that contained errors preventing them from being deliverable to a higher-layer protocol.  For character-oriented or fixed-length interfaces, the number of outbound transmission units that contained errors preventing them from being deliverable to a higher-layer protocol. Discontinuities in the value of this counter can occur at re-initialization of the management system, and at other times as indicated by the value of ifCounterDiscontinuityTime.
              preprocessing:
                - type: CHANGE_PER_SECOND
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#IFALIAS}'
                - tag: interface
                  value: '{#IFNAME}'
            - uuid: 8e149281afb742758a00b699a281a584
              name: 'Interface {#IFNAME}({#IFALIAS}): Bits sent'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.31.1.1.1.10.{#SNMPINDEX}]'
              key: 'net.if.out[ifHCOutOctets.{#SNMPINDEX}]'
              delay: 3m
              units: bps
              description: |
                MIB: IF-MIB
                The total number of octets transmitted out of the interface, including framing characters. This object is a 64-bit version of ifOutOctets.Discontinuities in the value of this counter can occur at re-initialization of the management system, and at other times as indicated by the value of ifCounterDiscontinuityTime.
              preprocessing:
                - type: CHANGE_PER_SECOND
                - type: MULTIPLIER
                  parameters:
                    - '8'
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#IFALIAS}'
                - tag: interface
                  value: '{#IFNAME}'
            - uuid: ddbde55ce98f465a8973d60b1ecb0f8c
              name: 'Interface {#IFNAME}({#IFALIAS}): Speed'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.31.1.1.1.15.{#SNMPINDEX}]'
              key: 'net.if.speed[ifHighSpeed.{#SNMPINDEX}]'
              delay: 5m
              trends: '0'
              units: bps
              description: |
                MIB: IF-MIB
                An estimate of the interface's current bandwidth in units of 1,000,000 bits per second. If this object reports a value of `n' then the speed of the interface is somewhere in the range of `n-500,000' to`n+499,999'.  For interfaces which do not vary in bandwidth or for those where no accurate estimation can be made, this object should contain the nominal bandwidth. For a sub-layer which has no concept of bandwidth, this object should be zero.
              preprocessing:
                - type: MULTIPLIER
                  parameters:
                    - '1000000'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#IFALIAS}'
                - tag: interface
                  value: '{#IFNAME}'
            - uuid: 6a1429de015640768d2cdd2adc4b09d7
              name: 'Interface {#IFNAME}({#IFALIAS}): Operational status'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.2.2.1.8.{#SNMPINDEX}]'
              key: 'net.if.status[ifOperStatus.{#SNMPINDEX}]'
              trends: '0'
              description: |
                MIB: IF-MIB
                The current operational state of the interface.
                - The testing(3) state indicates that no operational packet scan be passed
                - If ifAdminStatus is down(2) then ifOperStatus should be down(2)
                - If ifAdminStatus is changed to up(1) then ifOperStatus should change to up(1) if the interface is ready to transmit and receive network traffic
                - It should change todormant(5) if the interface is waiting for external actions (such as a serial line waiting for an incoming connection)
                - It should remain in the down(2) state if and only if there is a fault that prevents it from going to the up(1) state
                - It should remain in the notPresent(6) state if the interface has missing(typically, hardware) components.
              valuemap:
                name: 'IF-MIB::ifOperStatus'
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#IFALIAS}'
                - tag: interface
                  value: '{#IFNAME}'
              trigger_prototypes:
                - uuid: 46918cfc713a4b1da7eed32cead0070b
                  expression: '{$IFCONTROL:"{#IFNAME}"}=1 and last(/Mellanox by SNMP/net.if.status[ifOperStatus.{#SNMPINDEX}])=2 and (last(/Mellanox by SNMP/net.if.status[ifOperStatus.{#SNMPINDEX}],#1)<>last(/Mellanox by SNMP/net.if.status[ifOperStatus.{#SNMPINDEX}],#2))'
                  recovery_mode: RECOVERY_EXPRESSION
                  recovery_expression: 'last(/Mellanox by SNMP/net.if.status[ifOperStatus.{#SNMPINDEX}])<>2 or {$IFCONTROL:"{#IFNAME}"}=0'
                  name: 'Mellanox: Interface {#IFNAME}({#IFALIAS}): Link down'
                  opdata: 'Current state: {ITEM.LASTVALUE1}'
                  priority: AVERAGE
                  description: |
                    This trigger expression works as follows:
                    1. It can be triggered if the operations status is down.
                    2. `{$IFCONTROL:"{#IFNAME}"}=1` - a user can redefine context macro to value - 0. That marks this interface as not important. No new trigger will be fired if this interface is down.
                    3. `{TEMPLATE_NAME:METRIC.diff()}=1` - the trigger fires only if the operational status was up to (1) sometime before (so, do not fire for the 'eternal off' interfaces.)
                    
                    WARNING: if closed manually - it will not fire again on the next poll, because of .diff.
                  manual_close: 'YES'
                  tags:
                    - tag: scope
                      value: availability
            - uuid: 7ecba23625b64d94873b938ebbce500b
              name: 'Interface {#IFNAME}({#IFALIAS}): Interface type'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.2.2.1.3.{#SNMPINDEX}]'
              key: 'net.if.type[ifType.{#SNMPINDEX}]'
              delay: 1h
              trends: '0'
              description: |
                MIB: IF-MIB
                The type of interface.
                Additional values for ifType are assigned by the Internet Assigned Numbers Authority (IANA),
                through updating the syntax of the IANAifType textual convention.
              valuemap:
                name: 'IF-MIB::ifType'
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1d
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#IFALIAS}'
                - tag: interface
                  value: '{#IFNAME}'
          trigger_prototypes:
            - uuid: 2dc62fe3cd624e2ba99caa9ff94273f6
              expression: |
                change(/Mellanox by SNMP/net.if.speed[ifHighSpeed.{#SNMPINDEX}])<0 and last(/Mellanox by SNMP/net.if.speed[ifHighSpeed.{#SNMPINDEX}])>0
                and (
                last(/Mellanox by SNMP/net.if.type[ifType.{#SNMPINDEX}])=6 or
                last(/Mellanox by SNMP/net.if.type[ifType.{#SNMPINDEX}])=7 or
                last(/Mellanox by SNMP/net.if.type[ifType.{#SNMPINDEX}])=11 or
                last(/Mellanox by SNMP/net.if.type[ifType.{#SNMPINDEX}])=62 or
                last(/Mellanox by SNMP/net.if.type[ifType.{#SNMPINDEX}])=69 or
                last(/Mellanox by SNMP/net.if.type[ifType.{#SNMPINDEX}])=117
                )
                and
                (last(/Mellanox by SNMP/net.if.status[ifOperStatus.{#SNMPINDEX}])<>2)
              recovery_mode: RECOVERY_EXPRESSION
              recovery_expression: |
                (change(/Mellanox by SNMP/net.if.speed[ifHighSpeed.{#SNMPINDEX}])>0 and last(/Mellanox by SNMP/net.if.speed[ifHighSpeed.{#SNMPINDEX}],#2)>0) or
                (last(/Mellanox by SNMP/net.if.status[ifOperStatus.{#SNMPINDEX}])=2)
              name: 'Mellanox: Interface {#IFNAME}({#IFALIAS}): Ethernet has changed to lower speed than it was before'
              opdata: 'Current reported speed: {ITEM.LASTVALUE1}'
              priority: INFO
              description: 'This Ethernet connection has transitioned down from its known maximum speed. This might be a sign of autonegotiation issues. Acknowledge to close the problem manually.'
              manual_close: 'YES'
              dependencies:
                - name: 'Mellanox: Interface {#IFNAME}({#IFALIAS}): Link down'
                  expression: '{$IFCONTROL:"{#IFNAME}"}=1 and last(/Mellanox by SNMP/net.if.status[ifOperStatus.{#SNMPINDEX}])=2 and (last(/Mellanox by SNMP/net.if.status[ifOperStatus.{#SNMPINDEX}],#1)<>last(/Mellanox by SNMP/net.if.status[ifOperStatus.{#SNMPINDEX}],#2))'
                  recovery_expression: 'last(/Mellanox by SNMP/net.if.status[ifOperStatus.{#SNMPINDEX}])<>2 or {$IFCONTROL:"{#IFNAME}"}=0'
              tags:
                - tag: scope
                  value: performance
            - uuid: 20e8f28ebc304ba185d475dbba51c4b8
              expression: |
                (avg(/Mellanox by SNMP/net.if.in[ifHCInOctets.{#SNMPINDEX}],15m)>({$IF.UTIL.MAX:"{#IFNAME}"}/100)*last(/Mellanox by SNMP/net.if.speed[ifHighSpeed.{#SNMPINDEX}]) or
                avg(/Mellanox by SNMP/net.if.out[ifHCOutOctets.{#SNMPINDEX}],15m)>({$IF.UTIL.MAX:"{#IFNAME}"}/100)*last(/Mellanox by SNMP/net.if.speed[ifHighSpeed.{#SNMPINDEX}])) and
                last(/Mellanox by SNMP/net.if.speed[ifHighSpeed.{#SNMPINDEX}])>0
              recovery_mode: RECOVERY_EXPRESSION
              recovery_expression: |
                avg(/Mellanox by SNMP/net.if.in[ifHCInOctets.{#SNMPINDEX}],15m)<(({$IF.UTIL.MAX:"{#IFNAME}"}-3)/100)*last(/Mellanox by SNMP/net.if.speed[ifHighSpeed.{#SNMPINDEX}]) and
                avg(/Mellanox by SNMP/net.if.out[ifHCOutOctets.{#SNMPINDEX}],15m)<(({$IF.UTIL.MAX:"{#IFNAME}"}-3)/100)*last(/Mellanox by SNMP/net.if.speed[ifHighSpeed.{#SNMPINDEX}])
              name: 'Mellanox: Interface {#IFNAME}({#IFALIAS}): High bandwidth usage'
              event_name: 'Mellanox: Interface {#IFNAME}({#IFALIAS}): High bandwidth usage (>{$IF.UTIL.MAX:"{#IFNAME}"}%)'
              opdata: 'In: {ITEM.LASTVALUE1}, out: {ITEM.LASTVALUE3}, speed: {ITEM.LASTVALUE2}'
              priority: WARNING
              description: 'The utilization of the network interface is close to its estimated maximum bandwidth.'
              manual_close: 'YES'
              dependencies:
                - name: 'Mellanox: Interface {#IFNAME}({#IFALIAS}): Link down'
                  expression: '{$IFCONTROL:"{#IFNAME}"}=1 and last(/Mellanox by SNMP/net.if.status[ifOperStatus.{#SNMPINDEX}])=2 and (last(/Mellanox by SNMP/net.if.status[ifOperStatus.{#SNMPINDEX}],#1)<>last(/Mellanox by SNMP/net.if.status[ifOperStatus.{#SNMPINDEX}],#2))'
                  recovery_expression: 'last(/Mellanox by SNMP/net.if.status[ifOperStatus.{#SNMPINDEX}])<>2 or {$IFCONTROL:"{#IFNAME}"}=0'
              tags:
                - tag: scope
                  value: performance
            - uuid: 6740479821cd49c199c345dd736a11f7
              expression: |
                min(/Mellanox by SNMP/net.if.in.errors[ifInErrors.{#SNMPINDEX}],5m)>{$IF.ERRORS.WARN:"{#IFNAME}"}
                or min(/Mellanox by SNMP/net.if.out.errors[ifOutErrors.{#SNMPINDEX}],5m)>{$IF.ERRORS.WARN:"{#IFNAME}"}
              recovery_mode: RECOVERY_EXPRESSION
              recovery_expression: |
                max(/Mellanox by SNMP/net.if.in.errors[ifInErrors.{#SNMPINDEX}],5m)<{$IF.ERRORS.WARN:"{#IFNAME}"}*0.8
                and max(/Mellanox by SNMP/net.if.out.errors[ifOutErrors.{#SNMPINDEX}],5m)<{$IF.ERRORS.WARN:"{#IFNAME}"}*0.8
              name: 'Mellanox: Interface {#IFNAME}({#IFALIAS}): High error rate'
              event_name: 'Mellanox: Interface {#IFNAME}({#IFALIAS}): High error rate (>{$IF.ERRORS.WARN:"{#IFNAME}"} for 5m)'
              opdata: 'errors in: {ITEM.LASTVALUE1}, errors out: {ITEM.LASTVALUE2}'
              priority: WARNING
              description: 'It recovers when it is below 80% of the `{$IF.ERRORS.WARN:"{#IFNAME}"}` threshold.'
              manual_close: 'YES'
              dependencies:
                - name: 'Mellanox: Interface {#IFNAME}({#IFALIAS}): Link down'
                  expression: '{$IFCONTROL:"{#IFNAME}"}=1 and last(/Mellanox by SNMP/net.if.status[ifOperStatus.{#SNMPINDEX}])=2 and (last(/Mellanox by SNMP/net.if.status[ifOperStatus.{#SNMPINDEX}],#1)<>last(/Mellanox by SNMP/net.if.status[ifOperStatus.{#SNMPINDEX}],#2))'
                  recovery_expression: 'last(/Mellanox by SNMP/net.if.status[ifOperStatus.{#SNMPINDEX}])<>2 or {$IFCONTROL:"{#IFNAME}"}=0'
              tags:
                - tag: scope
                  value: availability
                - tag: scope
                  value: performance
          graph_prototypes:
            - uuid: cabe6db1b71f42d9bc3cef730221a14b
              name: 'Interface {#IFNAME}({#IFALIAS}): Network traffic'
              graph_items:
                - drawtype: GRADIENT_LINE
                  color: 199C0D
                  item:
                    host: 'Mellanox by SNMP'
                    key: 'net.if.in[ifHCInOctets.{#SNMPINDEX}]'
                - sortorder: '1'
                  drawtype: BOLD_LINE
                  color: F63100
                  item:
                    host: 'Mellanox by SNMP'
                    key: 'net.if.out[ifHCOutOctets.{#SNMPINDEX}]'
                - sortorder: '2'
                  color: 00611C
                  yaxisside: RIGHT
                  item:
                    host: 'Mellanox by SNMP'
                    key: 'net.if.out.errors[ifOutErrors.{#SNMPINDEX}]'
                - sortorder: '3'
                  color: F7941D
                  yaxisside: RIGHT
                  item:
                    host: 'Mellanox by SNMP'
                    key: 'net.if.in.errors[ifInErrors.{#SNMPINDEX}]'
                - sortorder: '4'
                  color: FC6EA3
                  yaxisside: RIGHT
                  item:
                    host: 'Mellanox by SNMP'
                    key: 'net.if.out.discards[ifOutDiscards.{#SNMPINDEX}]'
                - sortorder: '5'
                  color: 6C59DC
                  yaxisside: RIGHT
                  item:
                    host: 'Mellanox by SNMP'
                    key: 'net.if.in.discards[ifInDiscards.{#SNMPINDEX}]'
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
        - uuid: 8d0cb484e4544ffca4319ccece754123
          name: 'PSU Discovery'
          type: SNMP_AGENT
          snmp_oid: 'discovery[{#ENT_CLASS},1.3.6.1.2.1.47.1.1.1.1.5,{#ENT_NAME},1.3.6.1.2.1.47.1.1.1.1.7]'
          key: psu.discovery
          delay: 1h
          filter:
            conditions:
              - macro: '{#ENT_CLASS}'
                value: '6'
          item_prototypes:
            - uuid: 38a00c9f9f9447d0a0c9788ca9dcc9f2
              name: '{#ENT_NAME}: Power supply status'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.131.1.1.1.3.{#SNMPINDEX}]'
              key: 'sensor.psu.status[entStateOper.{#SNMPINDEX}]'
              delay: 3m
              trends: '0'
              description: 'MIB: ENTITY-STATE-MIB'
              valuemap:
                name: 'ENTITY-STATE-MIB::EntityOperState'
              tags:
                - tag: component
                  value: power
              trigger_prototypes:
                - uuid: 5d2d688ad68343ff8884c11e9d233b98
                  expression: 'count(/Mellanox by SNMP/sensor.psu.status[entStateOper.{#SNMPINDEX}],#1,"eq","{$PSU.STATUS.CRIT}")=1'
                  name: 'Mellanox: {#ENT_NAME}: Power supply is in critical state'
                  opdata: 'Current state: {ITEM.LASTVALUE1}'
                  priority: AVERAGE
                  description: 'Please check the power supply unit for errors'
                  tags:
                    - tag: scope
                      value: availability
                    - tag: scope
                      value: performance
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
        - uuid: 247124c5f8db4825bf4ea593bd0ff413
          name: 'Temperature Discovery'
          type: SNMP_AGENT
          snmp_oid: 'discovery[{#SENSOR_TYPE},1.3.6.1.2.1.99.1.1.1.1,{#SENSOR_INFO},1.3.6.1.2.1.47.1.1.1.1.2,{#SENSOR_PRECISION},1.3.6.1.2.1.99.1.1.1.3]'
          key: temp.discovery
          delay: 1h
          filter:
            evaltype: AND
            conditions:
              - macro: '{#SENSOR_PRECISION}'
                value: '1'
              - macro: '{#SENSOR_TYPE}'
                value: '8'
          description: 'ENTITY-SENSORS-MIB::EntitySensorDataType discovery with temperature filter'
          item_prototypes:
            - uuid: 4f298c0f2b6547b7b1827b3faebd1089
              name: '{#SENSOR_INFO}: Temperature status'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.99.1.1.1.5.{#SNMPINDEX}]'
              key: 'sensor.temp.status[entPhySensorOperStatus.{#SNMPINDEX}]'
              delay: 3m
              trends: '0'
              description: |
                MIB: ENTITY-SENSORS-MIB
                The operational status of the sensor {#SENSOR_INFO}. Possible values:
                - ok(1) indicates that the agent can obtain the sensor value.
                - unavailable(2) indicates that the agent presently cannot obtain the sensor value.
                - nonoperational(3) indicates that the agent believes the sensor is broken. The sensor could have a hard failure (disconnected wire), or a soft failure such as out-of-range, jittery, or wildly fluctuating readings.
              valuemap:
                name: 'ENTITY-SENSORS-MIB::EntitySensorStatus'
              tags:
                - tag: component
                  value: temperature
            - uuid: ffe7f6dff12f4b4ba24ddc28c6d1182b
              name: '{#SENSOR_INFO}: Temperature'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.99.1.1.1.4.{#SNMPINDEX}]'
              key: 'sensor.temp.value[entPhySensorValue.{#SNMPINDEX}]'
              delay: 3m
              value_type: FLOAT
              units: °C
              description: |
                MIB: ENTITY-SENSORS-MIB
                The most recent measurement obtained by the agent for this sensor.
                To correctly interpret the value of this object, the associated entPhySensorType,
                entPhySensorScale, and entPhySensorPrecision objects must also be examined.
              preprocessing:
                - type: MULTIPLIER
                  parameters:
                    - '0.1'
              tags:
                - tag: component
                  value: temperature
              trigger_prototypes:
                - uuid: 7259bdafbe7f4227999d7365a99e536d
                  expression: 'avg(/Mellanox by SNMP/sensor.temp.value[entPhySensorValue.{#SNMPINDEX}],5m)>{$TEMP.MAX.CRIT:"{#SENSOR_INFO}"}'
                  recovery_mode: RECOVERY_EXPRESSION
                  recovery_expression: 'max(/Mellanox by SNMP/sensor.temp.value[entPhySensorValue.{#SNMPINDEX}],5m)<{$TEMP.MAX.CRIT:"{#SENSOR_INFO}"}-3'
                  name: 'Mellanox: {#SENSOR_INFO}: Temperature is above critical threshold'
                  event_name: 'Mellanox: {#SENSOR_INFO}: Temperature is above critical threshold: >{$TEMP.MAX.CRIT:"{#SENSOR_INFO}"}'
                  opdata: 'Current value: {ITEM.LASTVALUE1}'
                  priority: HIGH
                  description: 'This trigger uses temperature sensor values as well as temperature sensor status if available'
                  tags:
                    - tag: scope
                      value: availability
                    - tag: scope
                      value: performance
                - uuid: 7bfa2bd0177940f4aff8dc95867ceb44
                  expression: 'avg(/Mellanox by SNMP/sensor.temp.value[entPhySensorValue.{#SNMPINDEX}],5m)<{$TEMP.MIN.CRIT:"{#SENSOR_INFO}"}'
                  recovery_mode: RECOVERY_EXPRESSION
                  recovery_expression: 'min(/Mellanox by SNMP/sensor.temp.value[entPhySensorValue.{#SNMPINDEX}],5m)>{$TEMP.MIN.CRIT:"{#SENSOR_INFO}"}+3'
                  name: 'Mellanox: {#SENSOR_INFO}: Temperature is too low'
                  event_name: 'Mellanox: {#SENSOR_INFO}: Temperature is too low: <{$TEMP.MIN.CRIT:"{#SENSOR_INFO}"}'
                  opdata: 'Current value: {ITEM.LASTVALUE1}'
                  priority: AVERAGE
                  tags:
                    - tag: scope
                      value: availability
                    - tag: scope
                      value: performance
          trigger_prototypes:
            - uuid: 352650536eef4858be1437a720712932
              expression: |
                avg(/Mellanox by SNMP/sensor.temp.value[entPhySensorValue.{#SNMPINDEX}],5m)>{$TEMP.MAX.WARN:"{#SENSOR_INFO}"}
                or
                last(/Mellanox by SNMP/sensor.temp.status[entPhySensorOperStatus.{#SNMPINDEX}])={$TEMP.STATUS.WARN}
              recovery_mode: RECOVERY_EXPRESSION
              recovery_expression: 'max(/Mellanox by SNMP/sensor.temp.value[entPhySensorValue.{#SNMPINDEX}],5m)<{$TEMP.MAX.WARN:"{#SENSOR_INFO}"}-3'
              name: 'Mellanox: {#SENSOR_INFO}: Temperature is above warning threshold'
              event_name: 'Mellanox: {#SENSOR_INFO}: Temperature is above warning threshold: >{$TEMP.MAX.WARN:"{#SENSOR_INFO}"}'
              opdata: 'Current value: {ITEM.LASTVALUE1}'
              priority: WARNING
              description: 'This trigger uses temperature sensor values as well as temperature sensor status if available'
              dependencies:
                - name: 'Mellanox: {#SENSOR_INFO}: Temperature is above critical threshold'
                  expression: 'avg(/Mellanox by SNMP/sensor.temp.value[entPhySensorValue.{#SNMPINDEX}],5m)>{$TEMP.MAX.CRIT:"{#SENSOR_INFO}"}'
                  recovery_expression: 'max(/Mellanox by SNMP/sensor.temp.value[entPhySensorValue.{#SNMPINDEX}],5m)<{$TEMP.MAX.CRIT:"{#SENSOR_INFO}"}-3'
              tags:
                - tag: scope
                  value: availability
                - tag: scope
                  value: performance
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  var data = JSON.parse(value).filter(function (item) {
                    return (typeof item['{#SENSOR_PRECISION}'] !== 'undefined');
                  });
                  
                  return JSON.stringify(data);
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
        - uuid: f4c83472c88b419da104e4c5a35d6fc9
          name: 'Storage discovery'
          type: SNMP_AGENT
          snmp_oid: 'discovery[{#FSNAME},1.3.6.1.2.1.25.2.3.1.3,{#FSTYPE},1.3.6.1.2.1.25.2.3.1.2,{#ALLOC_UNITS},1.3.6.1.2.1.25.2.3.1.4]'
          key: 'vfs.fs.discovery[snmp]'
          delay: 1h
          filter:
            evaltype: AND
            conditions:
              - macro: '{#FSNAME}'
                value: '{$VFS.FS.FSNAME.MATCHES}'
              - macro: '{#FSNAME}'
                value: '{$VFS.FS.FSNAME.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
              - macro: '{#FSTYPE}'
                value: '{$VFS.FS.FSTYPE.MATCHES}'
              - macro: '{#FSTYPE}'
                value: '{$VFS.FS.FSTYPE.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          description: 'HOST-RESOURCES-MIB::hrStorage discovery with storage filter.'
          item_prototypes:
            - uuid: 84e47981247243bd888a870700da8be3
              name: '{#FSNAME}: Space utilization'
              type: CALCULATED
              key: 'vfs.fs.pused[storageUsedPercentage.{#SNMPINDEX}]'
              value_type: FLOAT
              units: '%'
              params: '(last(//vfs.fs.used[hrStorageUsed.{#SNMPINDEX}])/last(//vfs.fs.total[hrStorageSize.{#SNMPINDEX}]))*100'
              description: 'The space utilization expressed in % for {#FSNAME}.'
              tags:
                - tag: component
                  value: storage
                - tag: filesystem
                  value: '{#FSNAME}'
            - uuid: 1a743f5b617f4800b5b2b9672f34693c
              name: '{#FSNAME}: Total space'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.25.2.3.1.5.{#SNMPINDEX}]'
              key: 'vfs.fs.total[hrStorageSize.{#SNMPINDEX}]'
              units: B
              description: |
                MIB: HOST-RESOURCES-MIB
                The size of the storage represented by this entry, in units of hrStorageAllocationUnits.
                This object is writable to allow remote configuration of the size of the storage area in those cases where such an operation makes sense and is possible on the underlying system.
                For example, the amount of main storage allocated to a buffer pool might be modified or the amount of disk space allocated to virtual storage might be modified.
              preprocessing:
                - type: MULTIPLIER
                  parameters:
                    - '{#ALLOC_UNITS}'
              tags:
                - tag: component
                  value: storage
                - tag: filesystem
                  value: '{#FSNAME}'
            - uuid: 82fadd771c3040c9ba001a9a40a83163
              name: '{#FSNAME}: Used space'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.25.2.3.1.6.{#SNMPINDEX}]'
              key: 'vfs.fs.used[hrStorageUsed.{#SNMPINDEX}]'
              units: B
              description: |
                MIB: HOST-RESOURCES-MIB
                The amount of the storage represented by this entry that is allocated, in units of hrStorageAllocationUnits.
              preprocessing:
                - type: MULTIPLIER
                  parameters:
                    - '{#ALLOC_UNITS}'
              tags:
                - tag: component
                  value: storage
                - tag: filesystem
                  value: '{#FSNAME}'
          trigger_prototypes:
            - uuid: f1eb2ddb27d24cd99d8aba4485dfeeb9
              expression: |
                last(/Mellanox by SNMP/vfs.fs.pused[storageUsedPercentage.{#SNMPINDEX}])>{$VFS.FS.PUSED.MAX.CRIT:"{#FSNAME}"} and
                ((last(/Mellanox by SNMP/vfs.fs.total[hrStorageSize.{#SNMPINDEX}])-last(/Mellanox by SNMP/vfs.fs.used[hrStorageUsed.{#SNMPINDEX}]))<{$VFS.FS.FREE.MIN.CRIT:"{#FSNAME}"} or timeleft(/Mellanox by SNMP/vfs.fs.pused[storageUsedPercentage.{#SNMPINDEX}],1h,100)<1d)
              name: 'Mellanox: {#FSNAME}: Disk space is critically low'
              event_name: 'Mellanox: {#FSNAME}: Disk space is critically low (used > {$VFS.FS.PUSED.MAX.CRIT:"{#FSNAME}"}%)'
              opdata: 'Space used: {ITEM.LASTVALUE3} of {ITEM.LASTVALUE2} ({ITEM.LASTVALUE1})'
              priority: AVERAGE
              description: |
                Two conditions should match: First, space utilization should be above {$VFS.FS.PUSED.MAX.CRIT:"{#FSNAME}"}.
                 Second condition should be one of the following:
                 - The disk free space is less than {$VFS.FS.FREE.MIN.CRIT:"{#FSNAME}"}.
                 - The disk will be full in less than 24 hours.
              manual_close: 'YES'
              tags:
                - tag: scope
                  value: availability
                - tag: scope
                  value: capacity
            - uuid: b2e084f280434a3a8291e5dc691dfd7b
              expression: |
                last(/Mellanox by SNMP/vfs.fs.pused[storageUsedPercentage.{#SNMPINDEX}])>{$VFS.FS.PUSED.MAX.WARN:"{#FSNAME}"} and
                ((last(/Mellanox by SNMP/vfs.fs.total[hrStorageSize.{#SNMPINDEX}])-last(/Mellanox by SNMP/vfs.fs.used[hrStorageUsed.{#SNMPINDEX}]))<{$VFS.FS.FREE.MIN.WARN:"{#FSNAME}"} or timeleft(/Mellanox by SNMP/vfs.fs.pused[storageUsedPercentage.{#SNMPINDEX}],1h,100)<1d)
              name: 'Mellanox: {#FSNAME}: Disk space is low'
              event_name: 'Mellanox: {#FSNAME}: Disk space is low (used > {$VFS.FS.PUSED.MAX.WARN:"{#FSNAME}"}%)'
              opdata: 'Space used: {ITEM.LASTVALUE3} of {ITEM.LASTVALUE2} ({ITEM.LASTVALUE1})'
              priority: WARNING
              description: |
                Two conditions should match: First, space utilization should be above {$VFS.FS.PUSED.MAX.WARN:"{#FSNAME}"}.
                 Second condition should be one of the following:
                 - The disk free space is less than {$VFS.FS.FREE.MIN.WARN:"{#FSNAME}"}.
                 - The disk will be full in less than 24 hours.
              manual_close: 'YES'
              dependencies:
                - name: 'Mellanox: {#FSNAME}: Disk space is critically low'
                  expression: |
                    last(/Mellanox by SNMP/vfs.fs.pused[storageUsedPercentage.{#SNMPINDEX}])>{$VFS.FS.PUSED.MAX.CRIT:"{#FSNAME}"} and
                    ((last(/Mellanox by SNMP/vfs.fs.total[hrStorageSize.{#SNMPINDEX}])-last(/Mellanox by SNMP/vfs.fs.used[hrStorageUsed.{#SNMPINDEX}]))<{$VFS.FS.FREE.MIN.CRIT:"{#FSNAME}"} or timeleft(/Mellanox by SNMP/vfs.fs.pused[storageUsedPercentage.{#SNMPINDEX}],1h,100)<1d)
              tags:
                - tag: scope
                  value: availability
                - tag: scope
                  value: capacity
          graph_prototypes:
            - uuid: 323ae8e8795543958fe6affc78a3853c
              name: '{#FSNAME}: Disk space usage'
              width: '600'
              height: '340'
              type: PIE
              show_3d: 'YES'
              graph_items:
                - color: '969696'
                  calc_fnc: LAST
                  type: GRAPH_SUM
                  item:
                    host: 'Mellanox by SNMP'
                    key: 'vfs.fs.total[hrStorageSize.{#SNMPINDEX}]'
                - sortorder: '1'
                  color: C80000
                  calc_fnc: LAST
                  item:
                    host: 'Mellanox by SNMP'
                    key: 'vfs.fs.used[hrStorageUsed.{#SNMPINDEX}]'
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
        - uuid: 32a20a1f65d64db3bf17d6d405321253
          name: 'Memory discovery'
          type: SNMP_AGENT
          snmp_oid: 'discovery[{#MEMNAME},1.3.6.1.2.1.25.2.3.1.3,{#MEMTYPE},1.3.6.1.2.1.25.2.3.1.2,{#ALLOC_UNITS},1.3.6.1.2.1.25.2.3.1.4]'
          key: vm.memory.discovery
          delay: 1h
          filter:
            evaltype: AND
            conditions:
              - macro: '{#MEMNAME}'
                value: '{$MEMORY.NAME.MATCHES}'
              - macro: '{#MEMNAME}'
                value: '{$MEMORY.NAME.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
              - macro: '{#MEMTYPE}'
                value: '{$MEMORY.TYPE.MATCHES}'
              - macro: '{#MEMTYPE}'
                value: '{$MEMORY.TYPE.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          description: 'HOST-RESOURCES-MIB::hrStorage discovery with memory filter'
          item_prototypes:
            - uuid: 70918ede8bff4f76be467a806a015b21
              name: '{#MEMNAME}: Total memory'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.25.2.3.1.5.{#SNMPINDEX}]'
              key: 'vm.memory.total[hrStorageSize.{#SNMPINDEX}]'
              units: B
              description: |
                MIB: HOST-RESOURCES-MIB
                The size of the storage represented by this entry, in units of hrStorageAllocationUnits.
                This object is writable to allow remote configuration of the size of the storage area in those cases where such an operation makes sense and is possible on the underlying system.
                For example, the amount of main memory allocated to a buffer pool might be modified or the amount of disk space allocated to virtual memory might be modified.
              preprocessing:
                - type: MULTIPLIER
                  parameters:
                    - '{#ALLOC_UNITS}'
              tags:
                - tag: component
                  value: memory
            - uuid: e661062e7fcb45968ca1e9a1306f4848
              name: '{#MEMNAME}: Used memory'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.25.2.3.1.6.{#SNMPINDEX}]'
              key: 'vm.memory.used[hrStorageUsed.{#SNMPINDEX}]'
              units: B
              description: |
                MIB: HOST-RESOURCES-MIB
                The amount of the storage represented by this entry that is allocated, in units of hrStorageAllocationUnits.
              preprocessing:
                - type: MULTIPLIER
                  parameters:
                    - '{#ALLOC_UNITS}'
              tags:
                - tag: component
                  value: memory
            - uuid: cedea4befd6a47b8983eff5dee9feed9
              name: '{#MEMNAME}: Memory utilization'
              type: CALCULATED
              key: 'vm.memory.util[memoryUsedPercentage.{#SNMPINDEX}]'
              value_type: FLOAT
              units: '%'
              params: 'last(//vm.memory.used[hrStorageUsed.{#SNMPINDEX}])/last(//vm.memory.total[hrStorageSize.{#SNMPINDEX}])*100'
              description: 'Memory utilization in %.'
              tags:
                - tag: component
                  value: memory
              trigger_prototypes:
                - uuid: 912430a103414c6eb9c8e55c45246f48
                  expression: 'min(/Mellanox by SNMP/vm.memory.util[memoryUsedPercentage.{#SNMPINDEX}],5m)>{$MEMORY.UTIL.MAX}'
                  name: 'Mellanox: {#MEMNAME}: High memory utilization'
                  event_name: 'Mellanox: {#MEMNAME}: High memory utilization (>{$MEMORY.UTIL.MAX}% for 5m)'
                  priority: AVERAGE
                  description: 'The system is running out of free memory.'
                  tags:
                    - tag: scope
                      value: capacity
                    - tag: scope
                      value: performance
          graph_prototypes:
            - uuid: bc2042eaf8244d28891e6d71414847da
              name: '{#MEMNAME}: Memory utilization'
              ymin_type_1: FIXED
              ymax_type_1: FIXED
              graph_items:
                - drawtype: GRADIENT_LINE
                  color: 199C0D
                  item:
                    host: 'Mellanox by SNMP'
                    key: 'vm.memory.util[memoryUsedPercentage.{#SNMPINDEX}]'
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
      tags:
        - tag: class
          value: network
        - tag: target
          value: mellanox
      macros:
        - macro: '{$CPU.UTIL.CRIT}'
          value: '90'
          config:
            type: TEXT
            priority: '36'
            section_name: Thresholds
            label: 'Threshold for CPU utilization (critical)'
            description: 'In the range from 0 to 100 inclusive.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$FAN_CRIT_STATUS}'
          value: '3'
          description: 'The critical value of the FAN sensor for trigger expression.'
          config:
            type: TEXT
            priority: '5'
            section_name: Thresholds
            label: 'Fan critical status'
            description: 'The critical value of the FAN sensor for trigger expression.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$ICMP.LOSS.WARN}'
          value: '20'
          config:
            type: TEXT
            priority: '32'
            section_name: Thresholds
            label: 'ICMP losses warning'
            description: 'In the range from 0 to 100 inclusive.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$ICMP.RESPONSE_TIME.WARN}'
          value: '0.15'
          config:
            type: TEXT
            priority: '33'
            section_name: Thresholds
            label: 'ICMP response time'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$ICMP_LOSS_WARN}'
          value: '20'
          config:
            type: TEXT
            priority: '3'
            section_name: Thresholds
            label: 'Threshold of ICMP packet loss'
            description: 'In the range from 0 to 100 inclusive.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$ICMP_RESPONSE_TIME_WARN}'
          value: '0.15'
          config:
            type: TEXT
            priority: '4'
            section_name: Thresholds
            label: 'Threshold of the average ICMP response'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$IFCONTROL}'
          value: '1'
          config:
            type: TEXT
            priority: '1'
            section_name: Other
            label: 'Interfaces control'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$MEMORY.NAME.MATCHES}'
          value: '.*'
          description: 'This macro is used in memory discovery. Can be overridden on the host level.'
          config:
            type: TEXT
            priority: '17'
            section_name: Filters
            label: 'Memory name filter (include)'
            description: 'This macro is used in memory discovery. Can be overridden on the host level.'
        - macro: '{$MEMORY.NAME.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'This macro is used in memory discovery. Can be overridden on the host level if you need to filter out results.'
          config:
            type: TEXT
            priority: '18'
            section_name: Filters
            label: 'Memory name filter (exclude)'
            description: 'This macro is used in memory discovery. Can be overridden on the host level if you need to filter out results.'
        - macro: '{$MEMORY.TYPE.MATCHES}'
          value: '.*(\.2|hrStorageRam)$'
          description: 'This macro is used in memory discovery. Can be overridden on the host level.'
          config:
            type: TEXT
            priority: '16'
            section_name: Filters
            label: 'Memory type filter (include)'
            description: 'This macro is used in memory discovery. Can be overridden on the host level.'
        - macro: '{$MEMORY.TYPE.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'This macro is used in memory discovery. Can be overridden on the host level if you need to filter out results.'
          config:
            type: TEXT
            priority: '15'
            section_name: Filters
            label: 'Memory type filter (exclude)'
            description: 'This macro is used in memory discovery. Can be overridden on the host level if you need to filter out results.'
        - macro: '{$MEMORY.UTIL.MAX}'
          value: '90'
          description: 'The warning threshold of the "Physical memory: Memory utilization" item.'
          config:
            type: TEXT
            priority: '14'
            section_name: Thresholds
            label: 'Threshold for memory utilization'
            description: 'The warning threshold of the "Physical memory: Memory utilization" item. In the range from 0 to 100 inclusive.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$NET.IF.IFADMINSTATUS.MATCHES}'
          value: '^.*'
          config:
            type: TEXT
            priority: '23'
            section_name: Filters
            label: 'Filter for network interface by adminstatus'
        - macro: '{$NET.IF.IFADMINSTATUS.NOT_MATCHES}'
          value: ^2$
          description: 'Ignore down(2) administrative status.'
          config:
            type: TEXT
            priority: '24'
            section_name: Filters
            label: 'Filter for network interface by adminstatus (exclude)'
        - macro: '{$NET.IF.IFALIAS.MATCHES}'
          value: '.*'
          config:
            type: TEXT
            priority: '27'
            section_name: Filters
            label: 'Filter for network interfaces by alias'
        - macro: '{$NET.IF.IFALIAS.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          config:
            type: TEXT
            priority: '28'
            section_name: Filters
            label: 'Filter for network interfaces by alias (exclude)'
        - macro: '{$NET.IF.IFDESCR.MATCHES}'
          value: '.*'
          config:
            type: TEXT
            priority: '25'
            section_name: Filters
            label: 'Filter for network interfaces by description'
        - macro: '{$NET.IF.IFDESCR.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          config:
            type: TEXT
            priority: '26'
            section_name: Filters
            label: 'Filter for network interfaces by description (exclude)'
        - macro: '{$NET.IF.IFNAME.MATCHES}'
          value: '^.*$'
          config:
            type: TEXT
            priority: '19'
            section_name: Filters
            label: 'Filter for network interface by name'
        - macro: '{$NET.IF.IFNAME.NOT_MATCHES}'
          value: '(^Software Loopback Interface|^NULL[0-9.]*$|^[Ll]o[0-9.]*$|^[Ss]ystem$|^Nu[0-9.]*$|^veth[0-9a-z]+$|docker[0-9]+|br-[a-z0-9]{12})'
          description: 'Filter out loopbacks, nulls, docker veth links and docker0 bridge by default.'
          config:
            type: TEXT
            priority: '20'
            section_name: Filters
            label: 'Filter for network interface by name (exclude)'
            description: 'Filter out loopbacks, nulls, docker veth links and docker0 bridge by default.'
        - macro: '{$NET.IF.IFOPERSTATUS.MATCHES}'
          value: '^.*$'
          config:
            type: TEXT
            priority: '21'
            section_name: Filters
            label: 'Filter for network interface by status'
        - macro: '{$NET.IF.IFOPERSTATUS.NOT_MATCHES}'
          value: ^6$
          description: 'Ignore notPresent(6).'
          config:
            type: TEXT
            priority: '22'
            section_name: Filters
            label: 'Filter for network interface by status (exclude)'
        - macro: '{$NET.IF.IFTYPE.MATCHES}'
          value: '.*'
          config:
            type: TEXT
            priority: '29'
            section_name: Filters
            label: 'Filter for network interfaces by type'
        - macro: '{$NET.IF.IFTYPE.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          config:
            type: TEXT
            priority: '30'
            section_name: Filters
            label: 'Filter for network interfaces by type (exclude)'
        - macro: '{$PSU.STATUS.CRIT}'
          value: '2'
          description: 'The critical value of the PSU sensor for trigger expression.'
          config:
            type: TEXT
            priority: '2'
            section_name: Thresholds
            label: 'PSU critical status'
            description: 'The critical value of the PSU sensor for trigger expression.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$SNMP.TIMEOUT}'
          value: 5m
          description: 'The time interval for SNMP agent availability trigger expression.'
          config:
            type: TEXT
            priority: '31'
            section_name: Other
            label: 'Time interval'
            description: 'The time interval for SNMP agent availability trigger expression.'
        - macro: '{$TEMP.MAX.CRIT}'
          value: '60'
          description: 'The temperature maximum critical value for trigger expression.'
          config:
            type: TEXT
            priority: '7'
            section_name: Thresholds
            label: 'Temperature maximum critical value'
            description: 'The temperature maximum critical value for trigger expression.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$TEMP.MAX.WARN}'
          value: '50'
          description: 'The temperature maximum warning value for trigger expression.'
          config:
            type: TEXT
            priority: '8'
            section_name: Thresholds
            label: 'Temperature maximum warning value'
            description: 'The temperature maximum warning value for trigger expression.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$TEMP.MIN.CRIT}'
          value: '5'
          description: 'The temperature minimum critical value for trigger expression.'
          config:
            type: TEXT
            priority: '9'
            section_name: Thresholds
            label: 'Temperature minimum critical value'
            description: 'The temperature minimum critical value for trigger expression.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$TEMP.STATUS.WARN}'
          value: '3'
          description: 'The critical value of the TEMP sensor for trigger expression.'
          config:
            type: TEXT
            priority: '6'
            section_name: Thresholds
            label: 'Temperature critical value'
            description: 'The critical value of the TEMP sensor for trigger expression.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$VFS.FS.FREE.MIN.CRIT}'
          value: 5G
          description: 'The critical threshold of the filesystem utilization.'
          config:
            type: TEXT
            priority: '34'
            section_name: Thresholds
            label: 'Filesystem free space minimum (critical)'
            description: 'The critical threshold of the filesystem utilization.'
        - macro: '{$VFS.FS.FREE.MIN.WARN}'
          value: 10G
          description: 'The warning threshold of the filesystem utilization.'
          config:
            type: TEXT
            priority: '35'
            section_name: Thresholds
            label: 'Filesystem free space minimum (warning)'
            description: 'The warning threshold of the filesystem utilization.'
        - macro: '{$VFS.FS.FSNAME.MATCHES}'
          value: .+
          description: 'This macro is used in filesystems discovery. Can be overridden on the host level.'
          config:
            type: TEXT
            priority: '11'
            section_name: Filters
            label: 'Filter for filesystems by name'
            description: 'This macro is used in filesystems discovery. Can be overridden on the host level.'
        - macro: '{$VFS.FS.FSNAME.NOT_MATCHES}'
          value: ^(/dev|/sys|/$|/run|/proc|.+/shm$)
          description: 'This macro is used in filesystems discovery. Can be overridden on the host level.'
          config:
            type: TEXT
            priority: '10'
            section_name: Filters
            label: 'Filter for filesystems by name (exclude)'
            description: 'This macro is used in filesystems discovery. Can be overridden on the host level.'
        - macro: '{$VFS.FS.FSTYPE.MATCHES}'
          value: '.*(\.4|\.9|hrStorageFixedDisk|hrStorageFlashMemory)$'
          description: 'This macro is used in filesystems discovery. Can be overridden on the host level.'
          config:
            type: TEXT
            priority: '13'
            section_name: Filters
            label: 'Filter for filesystems by type'
            description: 'This macro is used in filesystems discovery. Can be overridden on the host level.'
        - macro: '{$VFS.FS.FSTYPE.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'This macro is used in filesystems discovery. Can be overridden on the host level.'
          config:
            type: TEXT
            priority: '12'
            section_name: Filters
            label: 'Filter for filesystems by type (exclude)'
            description: 'This macro is used in filesystems discovery. Can be overridden on the host level.'
      dashboards:
        - uuid: 5d189179d9144198b020fce10f645872
          name: 'Network interfaces'
          pages:
            - widgets:
                - type: graphprototype
                  width: '72'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'Mellanox by SNMP'
                        name: 'Interface {#IFNAME}({#IFALIAS}): Network traffic'
                    - type: STRING
                      name: reference
                      value: AAAAD
        - uuid: e41382f2a3394e52b885bb6a70df35ff
          name: 'System performance'
          pages:
            - widgets:
                - type: graph
                  name: 'CPU utilization'
                  width: '36'
                  height: '5'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Mellanox by SNMP'
                        name: 'Mellanox: CPU utilization'
                    - type: STRING
                      name: reference
                      value: AAAAA
                - type: graphprototype
                  name: '{#MEMNAME}: Memory utilization'
                  'y': '5'
                  width: '36'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'Mellanox by SNMP'
                        name: '{#MEMNAME}: Memory utilization'
                    - type: STRING
                      name: reference
                      value: AAAAB
                    - type: INTEGER
                      name: rows
                      value: '5'
                - type: graphprototype
                  name: '{#FSNAME}: Disk space usage'
                  'y': '10'
                  width: '36'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'Mellanox by SNMP'
                        name: '{#FSNAME}: Disk space usage'
                    - type: STRING
                      name: reference
                      value: AAAAC
                    - type: INTEGER
                      name: rows
                      value: '5'
      valuemaps:
        - uuid: d42214398aea4362b4fc61a090f188e1
          name: 'ENTITY-SENSORS-MIB::EntitySensorStatus'
          mappings:
            - value: '1'
              newvalue: ok
            - value: '2'
              newvalue: unavailable
            - value: '3'
              newvalue: nonoperational
        - uuid: bd1dc90aa54849d0a5ae9bdf368d03a9
          name: 'ENTITY-STATE-MIB::EntityOperState'
          mappings:
            - value: '1'
              newvalue: unknown
            - value: '2'
              newvalue: disabled
            - value: '3'
              newvalue: enabled
            - value: '4'
              newvalue: testing
        - uuid: 04fa3aad27e044a094dce939b3d361ec
          name: 'IF-MIB::ifOperStatus'
          mappings:
            - value: '1'
              newvalue: up
            - value: '2'
              newvalue: down
            - value: '3'
              newvalue: testing
            - value: '4'
              newvalue: unknown
            - value: '5'
              newvalue: dormant
            - value: '6'
              newvalue: notPresent
            - value: '7'
              newvalue: lowerLayerDown
        - uuid: afe0ce28ed5d49dd822cc7013356c599
          name: 'IF-MIB::ifType'
          mappings:
            - value: '1'
              newvalue: other
            - value: '2'
              newvalue: regular1822
            - value: '3'
              newvalue: hdh1822
            - value: '4'
              newvalue: ddnX25
            - value: '5'
              newvalue: rfc877x25
            - value: '6'
              newvalue: ethernetCsmacd
            - value: '7'
              newvalue: iso88023Csmacd
            - value: '8'
              newvalue: iso88024TokenBus
            - value: '9'
              newvalue: iso88025TokenRing
            - value: '10'
              newvalue: iso88026Man
            - value: '11'
              newvalue: starLan
            - value: '12'
              newvalue: proteon10Mbit
            - value: '13'
              newvalue: proteon80Mbit
            - value: '14'
              newvalue: hyperchannel
            - value: '15'
              newvalue: fddi
            - value: '16'
              newvalue: lapb
            - value: '17'
              newvalue: sdlc
            - value: '18'
              newvalue: ds1
            - value: '19'
              newvalue: e1
            - value: '20'
              newvalue: basicISDN
            - value: '21'
              newvalue: primaryISDN
            - value: '22'
              newvalue: propPointToPointSerial
            - value: '23'
              newvalue: ppp
            - value: '24'
              newvalue: softwareLoopback
            - value: '25'
              newvalue: eon
            - value: '26'
              newvalue: ethernet3Mbit
            - value: '27'
              newvalue: nsip
            - value: '28'
              newvalue: slip
            - value: '29'
              newvalue: ultra
            - value: '30'
              newvalue: ds3
            - value: '31'
              newvalue: sip
            - value: '32'
              newvalue: frameRelay
            - value: '33'
              newvalue: rs232
            - value: '34'
              newvalue: para
            - value: '35'
              newvalue: arcnet
            - value: '36'
              newvalue: arcnetPlus
            - value: '37'
              newvalue: atm
            - value: '38'
              newvalue: miox25
            - value: '39'
              newvalue: sonet
            - value: '40'
              newvalue: x25ple
            - value: '41'
              newvalue: iso88022llc
            - value: '42'
              newvalue: localTalk
            - value: '43'
              newvalue: smdsDxi
            - value: '44'
              newvalue: frameRelayService
            - value: '45'
              newvalue: v35
            - value: '46'
              newvalue: hssi
            - value: '47'
              newvalue: hippi
            - value: '48'
              newvalue: modem
            - value: '49'
              newvalue: aal5
            - value: '50'
              newvalue: sonetPath
            - value: '51'
              newvalue: sonetVT
            - value: '52'
              newvalue: smdsIcip
            - value: '53'
              newvalue: propVirtual
            - value: '54'
              newvalue: propMultiplexor
            - value: '55'
              newvalue: ieee80212
            - value: '56'
              newvalue: fibreChannel
            - value: '57'
              newvalue: hippiInterface
            - value: '58'
              newvalue: frameRelayInterconnect
            - value: '59'
              newvalue: aflane8023
            - value: '60'
              newvalue: aflane8025
            - value: '61'
              newvalue: cctEmul
            - value: '62'
              newvalue: fastEther
            - value: '63'
              newvalue: isdn
            - value: '64'
              newvalue: v11
            - value: '65'
              newvalue: v36
            - value: '66'
              newvalue: g703at64k
            - value: '67'
              newvalue: g703at2mb
            - value: '68'
              newvalue: qllc
            - value: '69'
              newvalue: fastEtherFX
            - value: '70'
              newvalue: channel
            - value: '71'
              newvalue: ieee80211
            - value: '72'
              newvalue: ibm370parChan
            - value: '73'
              newvalue: escon
            - value: '74'
              newvalue: dlsw
            - value: '75'
              newvalue: isdns
            - value: '76'
              newvalue: isdnu
            - value: '77'
              newvalue: lapd
            - value: '78'
              newvalue: ipSwitch
            - value: '79'
              newvalue: rsrb
            - value: '80'
              newvalue: atmLogical
            - value: '81'
              newvalue: ds0
            - value: '82'
              newvalue: ds0Bundle
            - value: '83'
              newvalue: bsc
            - value: '84'
              newvalue: async
            - value: '85'
              newvalue: cnr
            - value: '86'
              newvalue: iso88025Dtr
            - value: '87'
              newvalue: eplrs
            - value: '88'
              newvalue: arap
            - value: '89'
              newvalue: propCnls
            - value: '90'
              newvalue: hostPad
            - value: '91'
              newvalue: termPad
            - value: '92'
              newvalue: frameRelayMPI
            - value: '93'
              newvalue: x213
            - value: '94'
              newvalue: adsl
            - value: '95'
              newvalue: radsl
            - value: '96'
              newvalue: sdsl
            - value: '97'
              newvalue: vdsl
            - value: '98'
              newvalue: iso88025CRFPInt
            - value: '99'
              newvalue: myrinet
            - value: '100'
              newvalue: voiceEM
            - value: '101'
              newvalue: voiceFXO
            - value: '102'
              newvalue: voiceFXS
            - value: '103'
              newvalue: voiceEncap
            - value: '104'
              newvalue: voiceOverIp
            - value: '105'
              newvalue: atmDxi
            - value: '106'
              newvalue: atmFuni
            - value: '107'
              newvalue: atmIma
            - value: '108'
              newvalue: pppMultilinkBundle
            - value: '109'
              newvalue: ipOverCdlc
            - value: '110'
              newvalue: ipOverClaw
            - value: '111'
              newvalue: stackToStack
            - value: '112'
              newvalue: virtualIpAddress
            - value: '113'
              newvalue: mpc
            - value: '114'
              newvalue: ipOverAtm
            - value: '115'
              newvalue: iso88025Fiber
            - value: '116'
              newvalue: tdlc
            - value: '117'
              newvalue: gigabitEthernet
            - value: '118'
              newvalue: hdlc
            - value: '119'
              newvalue: lapf
            - value: '120'
              newvalue: v37
            - value: '121'
              newvalue: x25mlp
            - value: '122'
              newvalue: x25huntGroup
            - value: '123'
              newvalue: trasnpHdlc
            - value: '124'
              newvalue: interleave
            - value: '125'
              newvalue: fast
            - value: '126'
              newvalue: ip
            - value: '127'
              newvalue: docsCableMaclayer
            - value: '128'
              newvalue: docsCableDownstream
            - value: '129'
              newvalue: docsCableUpstream
            - value: '130'
              newvalue: a12MppSwitch
            - value: '131'
              newvalue: tunnel
            - value: '132'
              newvalue: coffee
            - value: '133'
              newvalue: ces
            - value: '134'
              newvalue: atmSubInterface
            - value: '135'
              newvalue: l2vlan
            - value: '136'
              newvalue: l3ipvlan
            - value: '137'
              newvalue: l3ipxvlan
            - value: '138'
              newvalue: digitalPowerline
            - value: '139'
              newvalue: mediaMailOverIp
            - value: '140'
              newvalue: dtm
            - value: '141'
              newvalue: dcn
            - value: '142'
              newvalue: ipForward
            - value: '143'
              newvalue: msdsl
            - value: '144'
              newvalue: ieee1394
            - value: '145'
              newvalue: if-gsn
            - value: '146'
              newvalue: dvbRccMacLayer
            - value: '147'
              newvalue: dvbRccDownstream
            - value: '148'
              newvalue: dvbRccUpstream
            - value: '149'
              newvalue: atmVirtual
            - value: '150'
              newvalue: mplsTunnel
            - value: '151'
              newvalue: srp
            - value: '152'
              newvalue: voiceOverAtm
            - value: '153'
              newvalue: voiceOverFrameRelay
            - value: '154'
              newvalue: idsl
            - value: '155'
              newvalue: compositeLink
            - value: '156'
              newvalue: ss7SigLink
            - value: '157'
              newvalue: propWirelessP2P
            - value: '158'
              newvalue: frForward
            - value: '159'
              newvalue: rfc1483
            - value: '160'
              newvalue: usb
            - value: '161'
              newvalue: ieee8023adLag
            - value: '162'
              newvalue: bgppolicyaccounting
            - value: '163'
              newvalue: frf16MfrBundle
            - value: '164'
              newvalue: h323Gatekeeper
            - value: '165'
              newvalue: h323Proxy
            - value: '166'
              newvalue: mpls
            - value: '167'
              newvalue: mfSigLink
            - value: '168'
              newvalue: hdsl2
            - value: '169'
              newvalue: shdsl
            - value: '170'
              newvalue: ds1FDL
            - value: '171'
              newvalue: pos
            - value: '172'
              newvalue: dvbAsiIn
            - value: '173'
              newvalue: dvbAsiOut
            - value: '174'
              newvalue: plc
            - value: '175'
              newvalue: nfas
            - value: '176'
              newvalue: tr008
            - value: '177'
              newvalue: gr303RDT
            - value: '178'
              newvalue: gr303IDT
            - value: '179'
              newvalue: isup
            - value: '180'
              newvalue: propDocsWirelessMaclayer
            - value: '181'
              newvalue: propDocsWirelessDownstream
            - value: '182'
              newvalue: propDocsWirelessUpstream
            - value: '183'
              newvalue: hiperlan2
            - value: '184'
              newvalue: propBWAp2Mp
            - value: '185'
              newvalue: sonetOverheadChannel
            - value: '186'
              newvalue: digitalWrapperOverheadChannel
            - value: '187'
              newvalue: aal2
            - value: '188'
              newvalue: radioMAC
            - value: '189'
              newvalue: atmRadio
            - value: '190'
              newvalue: imt
            - value: '191'
              newvalue: mvl
            - value: '192'
              newvalue: reachDSL
            - value: '193'
              newvalue: frDlciEndPt
            - value: '194'
              newvalue: atmVciEndPt
            - value: '195'
              newvalue: opticalChannel
            - value: '196'
              newvalue: opticalTransport
            - value: '197'
              newvalue: propAtm
            - value: '198'
              newvalue: voiceOverCable
            - value: '199'
              newvalue: infiniband
            - value: '200'
              newvalue: teLink
            - value: '201'
              newvalue: q2931
            - value: '202'
              newvalue: virtualTg
            - value: '203'
              newvalue: sipTg
            - value: '204'
              newvalue: sipSig
            - value: '205'
              newvalue: docsCableUpstreamChannel
            - value: '206'
              newvalue: econet
            - value: '207'
              newvalue: pon155
            - value: '208'
              newvalue: pon622
            - value: '209'
              newvalue: bridge
            - value: '210'
              newvalue: linegroup
            - value: '211'
              newvalue: voiceEMFGD
            - value: '212'
              newvalue: voiceFGDEANA
            - value: '213'
              newvalue: voiceDID
            - value: '214'
              newvalue: mpegTransport
            - value: '215'
              newvalue: sixToFour
            - value: '216'
              newvalue: gtp
            - value: '217'
              newvalue: pdnEtherLoop1
            - value: '218'
              newvalue: pdnEtherLoop2
            - value: '219'
              newvalue: opticalChannelGroup
            - value: '220'
              newvalue: homepna
            - value: '221'
              newvalue: gfp
            - value: '222'
              newvalue: ciscoISLvlan
            - value: '223'
              newvalue: actelisMetaLOOP
            - value: '224'
              newvalue: fcipLink
            - value: '225'
              newvalue: rpr
            - value: '226'
              newvalue: qam
            - value: '227'
              newvalue: lmp
            - value: '228'
              newvalue: cblVectaStar
            - value: '229'
              newvalue: docsCableMCmtsDownstream
            - value: '230'
              newvalue: adsl2
            - value: '231'
              newvalue: macSecControlledIF
            - value: '232'
              newvalue: macSecUncontrolledIF
            - value: '233'
              newvalue: aviciOpticalEther
            - value: '234'
              newvalue: atmbond
            - value: '235'
              newvalue: voiceFGDOS
            - value: '236'
              newvalue: mocaVersion1
            - value: '237'
              newvalue: ieee80216WMAN
            - value: '238'
              newvalue: adsl2plus
            - value: '239'
              newvalue: dvbRcsMacLayer
            - value: '240'
              newvalue: dvbTdm
            - value: '241'
              newvalue: dvbRcsTdma
            - value: '242'
              newvalue: x86Laps
            - value: '243'
              newvalue: wwanPP
            - value: '244'
              newvalue: wwanPP2
            - value: '245'
              newvalue: voiceEBS
            - value: '246'
              newvalue: ifPwType
            - value: '247'
              newvalue: ilan
            - value: '248'
              newvalue: pip
            - value: '249'
              newvalue: aluELP
            - value: '250'
              newvalue: gpon
            - value: '251'
              newvalue: vdsl2
            - value: '252'
              newvalue: capwapDot11Profile
            - value: '253'
              newvalue: capwapDot11Bss
            - value: '254'
              newvalue: capwapWtpVirtualRadio
            - value: '255'
              newvalue: bits
            - value: '256'
              newvalue: docsCableUpstreamRfPort
            - value: '257'
              newvalue: cableDownstreamRfPort
            - value: '258'
              newvalue: vmwareVirtualNic
            - value: '259'
              newvalue: ieee802154
            - value: '260'
              newvalue: otnOdu
            - value: '261'
              newvalue: otnOtu
            - value: '262'
              newvalue: ifVfiType
            - value: '263'
              newvalue: g9981
            - value: '264'
              newvalue: g9982
            - value: '265'
              newvalue: g9983
            - value: '266'
              newvalue: aluEpon
            - value: '267'
              newvalue: aluEponOnu
            - value: '268'
              newvalue: aluEponPhysicalUni
            - value: '269'
              newvalue: aluEponLogicalLink
            - value: '270'
              newvalue: aluGponOnu
            - value: '271'
              newvalue: aluGponPhysicalUni
            - value: '272'
              newvalue: vmwareNicTeam
            - value: '277'
              newvalue: docsOfdmDownstream
            - value: '278'
              newvalue: docsOfdmaUpstream
            - value: '279'
              newvalue: gfast
            - value: '280'
              newvalue: sdci
            - value: '281'
              newvalue: xboxWireless
            - value: '282'
              newvalue: fastdsl
            - value: '283'
              newvalue: docsCableScte55d1FwdOob
            - value: '284'
              newvalue: docsCableScte55d1RetOob
            - value: '285'
              newvalue: docsCableScte55d2DsOob
            - value: '286'
              newvalue: docsCableScte55d2UsOob
            - value: '287'
              newvalue: docsCableNdf
            - value: '288'
              newvalue: docsCableNdr
            - value: '289'
              newvalue: ptm
            - value: '290'
              newvalue: ghn
        - uuid: deb16b99706645929e300b0590f013f3
          name: 'Service state'
          mappings:
            - value: '0'
              newvalue: Down
            - value: '1'
              newvalue: Up
        - uuid: a85fe23199cd4d779655f690a706d7c7
          name: zabbix.host.available
          mappings:
            - value: '0'
              newvalue: 'not available'
            - value: '1'
              newvalue: available
            - value: '2'
              newvalue: unknown
    - uuid: d0ef7d659a8f4beaaabfc4b6134e737a
      template: 'PostgreSQL by Zabbix agent 2'
      name: 'PostgreSQL by Zabbix agent 2'
      description: |
        This template is designed for the deployment of PostgreSQL monitoring by Zabbix via Zabbix agent 2 and uses a loadable plugin to run SQL queries.
        
        Setup:
        
        1. Deploy Zabbix agent 2 with the PostgreSQL plugin. Starting with Zabbix versions 6.0.10 / 6.2.4 / 6.4 PostgreSQL metrics are moved to a loadable plugin and require installation of a separate package or compilation of the plugin from sources (https://www.zabbix.com/documentation/8.0/manual/extensions/plugins/build).
        
        2. Create the PostgreSQL user for monitoring (`<password>` at your discretion) and inherit permissions from the default role `pg_monitor`:
        CREATE USER zbx_monitor WITH PASSWORD '<PASSWORD>' INHERIT;
        GRANT pg_monitor TO zbx_monitor;
        
        3. Edit the `pg_hba.conf` configuration file to allow connections for the user `zbx_monitor`. You can check the PostgreSQL documentation for examples (https://www.postgresql.org/docs/current/auth-pg-hba-conf.html).
        
        4. Set the connection string for the PostgreSQL instance in the `{$PG.CONNSTRING.AGENT2}` macro as URI, such as `<protocol(host:port)>`, or specify the named session - `<sessionname>`.
        
        Note: if you want to use SSL/TLS encryption to protect communications with the remote PostgreSQL instance, a named session must be used. In that case, the instance URI should be specified in the `Plugins.PostgreSQL.Sessions.*.Uri` parameter in the PostgreSQL plugin configuration files alongside all the encryption parameters (type, certificate/key filepaths if needed etc.).
        
        You can check the PostgreSQL plugin documentation (https://git.zabbix.com/projects/AP/repos/postgresql/browse?at=refs%2Fheads%2Frelease%2F8.0) for details about agent plugin parameters and named sessions.
        
        Also, it is assumed that you set up the PostgreSQL instance to work in the desired encryption mode. Check the PostgreSQL documentation (https://www.postgresql.org/docs/current/ssl-tcp.html) for details.
        
        Note that plugin TLS certificate validation relies on checking the Subject Alternative Names (SAN) instead of the Common Name (CN), check the cryptography package documentation (https://pkg.go.dev/crypto/x509) for details.
        
        For example, to enable required encryption in transport mode without identity checks you could create the file `/etc/zabbix/zabbix_agent2.d/postgresql_myconn.conf` with the following configuration for the named session `myconn` (replace `<instanceip>` with the address of the PostgreSQL instance):
        Plugins.PostgreSQL.Sessions.myconn.Uri=tcp://<instanceip>:5432
        Plugins.PostgreSQL.Sessions.myconn.TLSConnect=required
        
        Then set the `{$PG.CONNSTRING.AGENT2}` macro to `myconn` to use this named session.
        
        5. Set the password that you specified in step 2 in the macro `{$PG.PASSWORD}`.
        
        You can discuss this template or leave feedback on our forum https://www.zabbix.com/forum/zabbix-suggestions-and-feedback/384190-%C2%A0discussion-thread-for-official-zabbix-template-db-postgresql
        
        Generated by official Zabbix template tool "Templator"
      wizard_ready: 'YES'
      readme: |
        ## Overview
        
        This template is designed for the deployment of PostgreSQL monitoring by Zabbix via Zabbix agent 2 and uses a loadable plugin to run SQL queries.
        
        ## Setup
        
        1. Create the PostgreSQL user for monitoring (`<password>` at your discretion) and inherit permissions from the default role `pg_monitor`:
        
        ```sql
        CREATE USER zbx_monitor WITH PASSWORD '<PASSWORD>' INHERIT;
        GRANT pg_monitor TO zbx_monitor;
        ```
        
        3. Edit the `pg_hba.conf` configuration file to allow connections for the user `zbx_monitor`. For example, you could add one of the following rows to allow local TCP connections from the same host:
        
        ```bash
        # TYPE  DATABASE        USER            ADDRESS                 METHOD
          host       all        zbx_monitor     localhost               trust
          host       all        zbx_monitor     127.0.0.1/32            md5
          host       all        zbx_monitor     ::1/128                 scram-sha-256
        ```
        
        For more information please read the PostgreSQL documentation `https://www.postgresql.org/docs/current/auth-pg-hba-conf.html`.
        
        4. Set the connection string for the PostgreSQL instance in the `PostgreSQL connection string` host wizard configuration field as URI, such as `<protocol(host:port)>`, or specify the named session - `<sessionname>`.
        
        **Note:** if you want to use SSL/TLS encryption to protect communications with the remote PostgreSQL instance, a named session must be used. In that case, the instance URI should be specified in the `Plugins.PostgreSQL.Sessions.*.Uri` parameter in the PostgreSQL plugin configuration files alongside all the encryption parameters (type, certificate/key filepaths if needed etc.).
        
        You can check the [`PostgreSQL plugin documentation`](https://git.zabbix.com/projects/AP/repos/postgresql/browse?at=refs%2Fheads%2Frelease%2F8.0) for details about agent plugin parameters and named sessions.
        
        Also, it is assumed that you set up the PostgreSQL instance to work in the desired encryption mode. Check the [`PostgreSQL documentation`](https://www.postgresql.org/docs/current/ssl-tcp.html) for details.
        
        **Note:** plugin TLS certificate validation relies on checking the Subject Alternative Names (SAN) instead of the Common Name (CN), check the cryptography package [`documentation`](https://pkg.go.dev/crypto/x509) for details.
        
        For example, to enable required encryption in transport mode without identity checks you could create the file `/etc/zabbix/zabbix_agent2.d/postgresql_myconn.conf` with the following configuration for the named session `myconn` (replace `<instanceip>` with the address of the PostgreSQL instance):
        
        ```bash
        Plugins.PostgreSQL.Sessions.myconn.Uri=tcp://<instanceip>:5432
        Plugins.PostgreSQL.Sessions.myconn.TLSConnect=required
        ```
        
        Then set the `PostgreSQL connection string` field to `myconn` to use this named session.
        
        5. Set the password that you specified in step 2 in the `PostgreSQL user password` field.
      vendor:
        name: Zabbix
        version: 8.0-0
      groups:
        - name: Templates/Databases
      items:
        - uuid: 04b1c83463f247b0a42f17c5d0a9ce14
          name: 'Archive: Count of archived files'
          type: DEPENDENT
          key: pgsql.archive.count_archived_files
          value_type: FLOAT
          description: 'Count of archived files.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.archived_count
          master_item:
            key: 'pgsql.archive["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: archive
        - uuid: 729208d50ef64e50b0bb342899e211c2
          name: 'Archive: Count of files in archive_status need to archive'
          type: DEPENDENT
          key: pgsql.archive.count_files_to_archive
          value_type: FLOAT
          description: 'Count of files to archive.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.count_files
          master_item:
            key: 'pgsql.archive["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: archive
        - uuid: b60523c62afc4813aeb64cf9598fb7bd
          name: 'Archive: Count of failed attempts to archive files'
          type: DEPENDENT
          key: pgsql.archive.failed_trying_to_archive
          value_type: FLOAT
          description: 'Count of failed attempts to archive files.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.failed_count
          master_item:
            key: 'pgsql.archive["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: archive
        - uuid: 285f434f79864d24a4e66d5a49c539e9
          name: 'Archive: Size of files need to archive'
          type: DEPENDENT
          key: pgsql.archive.size_files_to_archive
          value_type: FLOAT
          description: 'Size of files to archive.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.size_files
          master_item:
            key: 'pgsql.archive["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: archive
        - uuid: e9f4284fd3a1459e9c519dbdd8ee3425
          name: 'Get archive'
          key: 'pgsql.archive["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          history: '0'
          value_type: TEXT
          description: 'Collect archive status metrics.'
          tags:
            - tag: component
              value: raw
        - uuid: d9169b4b31554063b9d01d0d27b4beee
          name: 'Count of autovacuum workers'
          key: 'pgsql.autovacuum.count["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          value_type: FLOAT
          description: 'Number of autovacuum workers.'
          tags:
            - tag: component
              value: system
        - uuid: c49f777ae0db48879bc946989bfc36f6
          name: 'Bgwriter: Buffers allocated per second'
          type: DEPENDENT
          key: pgsql.bgwriter.buffers_alloc.rate
          value_type: FLOAT
          description: 'Number of buffers allocated per second.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.buffers_alloc
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.bgwriter["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: bgwriter
        - uuid: 1624e89567824e0493492a3dcc979788
          name: 'Bgwriter: Buffers written directly by a backend per second'
          type: DEPENDENT
          key: pgsql.bgwriter.buffers_backend.rate
          value_type: FLOAT
          description: 'Number of buffers written directly by a backend per second. Available in PostgreSQL versions prior to 17.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.buffers_backend
              error_handler: DISCARD_VALUE
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.bgwriter["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: bgwriter
        - uuid: 6e5990d8a0854efd83b3e6a57aa2c2f9
          name: 'Bgwriter: Times a backend executed its own fsync per second'
          type: DEPENDENT
          key: pgsql.bgwriter.buffers_backend_fsync.rate
          value_type: FLOAT
          description: 'Number of times a backend had to execute its own fsync call per second (normally the background writer handles those even when the backend does its own write). Available in PostgreSQL versions prior to 17.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.buffers_backend_fsync
              error_handler: DISCARD_VALUE
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.bgwriter["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: bgwriter
        - uuid: 3bf0496d313f4dfea67c95010be54372
          name: 'Checkpoint: Buffers written during checkpoints per second'
          type: DEPENDENT
          key: pgsql.bgwriter.buffers_checkpoint.rate
          value_type: FLOAT
          description: 'Number of buffers written during checkpoints per second.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.buffers_checkpoint
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.bgwriter["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: bgwriter
        - uuid: 65f4aeedbc7d40ed9a14e0dbd8024c4b
          name: 'Checkpoint: Buffers written by the background writer per second'
          type: DEPENDENT
          key: pgsql.bgwriter.buffers_clean.rate
          value_type: FLOAT
          description: 'Number of buffers written by the background writer per second.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.buffers_clean
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.bgwriter["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: bgwriter
        - uuid: 23fcb5ee8c19436b827001114961eb16
          name: 'Checkpoint: Requested per second'
          type: DEPENDENT
          key: pgsql.bgwriter.checkpoints_req.rate
          value_type: FLOAT
          description: 'Number of requested checkpoints that have been performed per second.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.checkpoints_req
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.bgwriter["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: bgwriter
        - uuid: 9c578a8e072940728cc00d94f52cec8d
          name: 'Checkpoint: Scheduled per second'
          type: DEPENDENT
          key: pgsql.bgwriter.checkpoints_timed.rate
          value_type: FLOAT
          description: 'Number of scheduled checkpoints that have been performed per second.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.checkpoints_timed
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.bgwriter["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: bgwriter
        - uuid: b94507037a584b9391f610e59dd34e6c
          name: 'Checkpoint: Checkpoint sync time per second'
          type: DEPENDENT
          key: pgsql.bgwriter.checkpoint_sync_time.rate
          value_type: FLOAT
          units: s
          description: 'Total amount of time per second that has been spent in the portion of checkpoint processing where files are synchronized to disk.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.checkpoint_sync_time
            - type: MULTIPLIER
              parameters:
                - '0.001'
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.bgwriter["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: bgwriter
        - uuid: 26839587c46043caa2991e973962b954
          name: 'Checkpoint: Checkpoint write time per second'
          type: DEPENDENT
          key: pgsql.bgwriter.checkpoint_write_time.rate
          value_type: FLOAT
          units: s
          description: 'Total amount of time per second that has been spent in the portion of checkpoint processing where files are written to disk.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.checkpoint_write_time
            - type: MULTIPLIER
              parameters:
                - '0.001'
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.bgwriter["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: bgwriter
        - uuid: b83939ecfb094a7e9eb42cd9a7e2695c
          name: 'Bgwriter: Number of bgwriter cleaning scan stopped per second'
          type: DEPENDENT
          key: pgsql.bgwriter.maxwritten_clean.rate
          value_type: FLOAT
          description: 'Number of times the background writer stopped a cleaning scan because it had written too many buffers per second.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.maxwritten_clean
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.bgwriter["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: bgwriter
        - uuid: 6020e17c25104cbfba182e9cddfe6336
          name: 'Get bgwriter'
          key: 'pgsql.bgwriter["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          history: '0'
          value_type: TEXT
          description: |
            Collect all metrics from pg_stat_bgwriter:
            https://www.postgresql.org/docs/current/monitoring-stats.html#PG-STAT-BGWRITER-VIEW
          tags:
            - tag: component
              value: raw
        - uuid: b98d2328694f44598f2177b3f93d4b90
          name: 'Cache hit ratio, %'
          type: CALCULATED
          key: pgsql.cache.hit
          value_type: FLOAT
          units: '%'
          params: 'last(//pgsql.dbstat.sum.blks_hit.rate) * 100 / (last(//pgsql.dbstat.sum.blks_hit.rate) + last(//pgsql.dbstat.sum.blks_read.rate))'
          description: 'Cache hit ratio.'
          tags:
            - tag: component
              value: cache
        - uuid: 2ea55460f0d34063ae4ab65b74ec852c
          name: 'Connections sum: Active'
          type: DEPENDENT
          key: pgsql.connections.sum.active
          description: 'Total number of connections executing a query.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.active
          master_item:
            key: 'pgsql.connections["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: connections
        - uuid: 69f14028e98b48d489fbd7345c2213dd
          name: 'Connections sum: Disabled'
          type: DEPENDENT
          key: pgsql.connections.sum.disabled
          description: 'Total number of disabled connections.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.disabled
          master_item:
            key: 'pgsql.connections["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: connections
        - uuid: 62a2401041724b4888bf058035dc6a0c
          name: 'Connections sum: Fastpath function call'
          type: DEPENDENT
          key: pgsql.connections.sum.fastpath_function_call
          description: 'Total number of connections executing a fast-path function.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.fastpath_function_call
          master_item:
            key: 'pgsql.connections["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: connections
        - uuid: fc3b357cc8a24c4aad60784d1bfb7e18
          name: 'Connections sum: Idle'
          type: DEPENDENT
          key: pgsql.connections.sum.idle
          description: 'Total number of connections waiting for a new client command.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.idle
          master_item:
            key: 'pgsql.connections["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: connections
        - uuid: b900a8123dfa48e0ac8fd4b92ae8678d
          name: 'Connections sum: Idle in transaction'
          type: DEPENDENT
          key: pgsql.connections.sum.idle_in_transaction
          description: 'Total number of connections in a transaction state but not executing a query.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.idle_in_transaction
          master_item:
            key: 'pgsql.connections["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: connections
        - uuid: 99b0a3e14af44924b0319a0a9f6c16c7
          name: 'Connections sum: Idle in transaction (aborted)'
          type: DEPENDENT
          key: pgsql.connections.sum.idle_in_transaction_aborted
          description: 'Total number of connections in a transaction state but not executing a query, and where one of the statements in the transaction caused an error.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.idle_in_transaction_aborted
          master_item:
            key: 'pgsql.connections["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: connections
        - uuid: 194c41f88e9e44879a70033913dd41d3
          name: 'Connections sum: Prepared'
          type: DEPENDENT
          key: pgsql.connections.sum.prepared
          description: |
            Total number of prepared transactions:
            https://www.postgresql.org/docs/current/sql-prepare-transaction.html
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.prepared
          master_item:
            key: 'pgsql.connections["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: connections
        - uuid: 1ec042e5853b430d9d7982c53c3fcf14
          name: 'Connections sum: Total'
          type: DEPENDENT
          key: pgsql.connections.sum.total
          description: 'Total number of connections.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.total
          master_item:
            key: 'pgsql.connections["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: connections
        - uuid: 101149dd68994084a1cdab82c9d064f0
          name: 'Connections sum: Total, %'
          type: DEPENDENT
          key: pgsql.connections.sum.total_pct
          units: '%'
          description: 'Total number of connections, in percentage.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.total_pct
          master_item:
            key: 'pgsql.connections["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: connections
          triggers:
            - uuid: 1d0903401af64d93ac16761808d672ca
              expression: 'min(/PostgreSQL by Zabbix agent 2/pgsql.connections.sum.total_pct,5m) > {$PG.CONN_TOTAL_PCT.MAX.WARN}'
              name: 'PostgreSQL: Total number of connections is too high'
              event_name: 'PostgreSQL: Total number of connections is too high (over {$PG.CONN_TOTAL_PCT.MAX.WARN} in 5m)'
              priority: AVERAGE
              description: 'Total number of current connections exceeds the limit of {$PG.CONN_TOTAL_PCT.MAX.WARN}% out of the maximum number of concurrent connections to the database server (the "max_connections" setting).'
              tags:
                - tag: scope
                  value: performance
        - uuid: f2c298008b914434b96da85a985e4a54
          name: 'Connections sum: Waiting'
          type: DEPENDENT
          key: pgsql.connections.sum.waiting
          description: |
            Total number of waiting connections:
            https://www.postgresql.org/docs/current/monitoring-stats.html#WAIT-EVENT-TABLE
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.waiting
          master_item:
            key: 'pgsql.connections["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: connections
        - uuid: e926ecd967f342bf90e9923825147d64
          name: 'Get connections sum'
          key: 'pgsql.connections["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          history: '0'
          value_type: TEXT
          description: |
            Collect all metrics from pg_stat_activity:
            https://www.postgresql.org/docs/current/monitoring-stats.html#PG-STAT-ACTIVITY-VIEW
          tags:
            - tag: component
              value: raw
        - uuid: 1cab825fac8a49ba96dfbf7a696be729
          name: 'Custom queries'
          key: 'pgsql.custom.query["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}",""]'
          history: 1h
          value_type: TEXT
          status: DISABLED
          description: 'Execute custom queries from file *.sql (check for option Plugins.Postgres.CustomQueriesPath at agent configuration).'
          tags:
            - tag: component
              value: application
        - uuid: 5c6de0fe332043bfb35c999b10893e4c
          name: 'Dbstat: Hit blocks read per second'
          type: DEPENDENT
          key: pgsql.dbstat.sum.blks_hit.rate
          value_type: FLOAT
          description: 'Number of times per second disk blocks were found already in the buffer cache'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.blks_hit
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.dbstat.sum["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: cache
        - uuid: 4dc3f2c23dfd4dfebe024a5c2d4409ae
          name: 'Dbstat: Disk blocks read per second'
          type: DEPENDENT
          key: pgsql.dbstat.sum.blks_read.rate
          value_type: FLOAT
          description: 'Number of disk blocks read per second.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.blks_read
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.dbstat.sum["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: storage
        - uuid: 619211cc2afa4a159f36abf1a17d5476
          name: 'Dbstat: Blocks read time'
          type: DEPENDENT
          key: pgsql.dbstat.sum.blk_read_time
          value_type: FLOAT
          units: s
          description: 'Time spent reading data file blocks by backends.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.blk_read_time
            - type: MULTIPLIER
              parameters:
                - '0.001'
          master_item:
            key: 'pgsql.dbstat.sum["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: storage
        - uuid: fba3b51d644c4c16ac71b3eda1be1701
          name: 'Dbstat: Blocks write time'
          type: DEPENDENT
          key: pgsql.dbstat.sum.blk_write_time
          value_type: FLOAT
          units: s
          description: 'Time spent writing data file blocks by backends.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.blk_write_time
            - type: MULTIPLIER
              parameters:
                - '0.001'
          master_item:
            key: 'pgsql.dbstat.sum["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: storage
        - uuid: 1b98b9c95b32424baa68c354496ed2de
          name: 'Dbstat: Checksum failures per second'
          type: DEPENDENT
          key: pgsql.dbstat.sum.checksum_failures.rate
          value_type: FLOAT
          description: 'Number of data page checksum failures per second detected (or on a shared object), or NULL if data checksums are not enabled. This metric is available since PostgreSQL 12.'
          valuemap:
            name: 'PostgreSQL checksum failure status'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.checksum_failures
            - type: MATCHES_REGEX
              parameters:
                - '^\d*$'
              error_handler: CUSTOM_VALUE
              error_handler_params: '-2'
            - type: CHANGE_PER_SECOND
              error_handler: CUSTOM_VALUE
              error_handler_params: '-1'
          master_item:
            key: 'pgsql.dbstat.sum["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: system
          triggers:
            - uuid: 1d67b13f47134a538708c2a14dcfa6b1
              expression: 'last(/PostgreSQL by Zabbix agent 2/pgsql.dbstat.sum.checksum_failures.rate)>0'
              name: 'PostgreSQL: Dbstat: Checksum failures detected'
              priority: AVERAGE
              description: |
                Data page checksum failures were detected on that DB instance:
                https://www.postgresql.org/docs/current/checksums.html
              tags:
                - tag: scope
                  value: availability
        - uuid: 0106dfc55ace4dacaff00ce2c98de2ea
          name: 'Dbstat: Conflicts per second'
          type: DEPENDENT
          key: pgsql.dbstat.sum.conflicts.rate
          value_type: FLOAT
          description: 'Number of queries canceled per second due to conflicts with recovery (conflicts occur only on standby servers; see pg_stat_database_conflicts for details).'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.conflicts
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.dbstat.sum["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: queries
        - uuid: e5d3838e5cf84be9ae83cacf22dc99af
          name: 'Dbstat: Deadlocks per second'
          type: DEPENDENT
          key: pgsql.dbstat.sum.deadlocks.rate
          value_type: FLOAT
          description: 'Number of deadlocks detected per second.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.deadlocks
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.dbstat.sum["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: deadlocks
        - uuid: c61f60e6f7d24ffe99db480f6bbd9613
          name: 'Dbstat: Backends connected'
          type: DEPENDENT
          key: pgsql.dbstat.sum.numbackends
          description: 'Number of connected backends.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.numbackends
          master_item:
            key: 'pgsql.dbstat.sum["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: backends
        - uuid: 96cb6b388b2c480ead1568293dd81e70
          name: 'Dbstat: Number temp bytes per second'
          type: DEPENDENT
          key: pgsql.dbstat.sum.temp_bytes.rate
          value_type: FLOAT
          units: b
          description: 'Total amount of data written per second to temporary files by queries.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.temp_bytes
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.dbstat.sum["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: storage
        - uuid: bea47c8a95074ad3997aff64fcfcf49b
          name: 'Dbstat: Number temp files per second'
          type: DEPENDENT
          key: pgsql.dbstat.sum.temp_files.rate
          value_type: FLOAT
          description: 'Number of temporary files created by queries per second.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.temp_files
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.dbstat.sum["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: storage
        - uuid: 731f4adac9d34eaaaa1f8d5080fdf6ce
          name: 'Dbstat: Rows deleted per second'
          type: DEPENDENT
          key: pgsql.dbstat.sum.tup_deleted.rate
          value_type: FLOAT
          description: 'Number of rows deleted by queries per second.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.tup_deleted
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.dbstat.sum["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: queries
        - uuid: 4eb6cc273484453bab1233de085363f5
          name: 'Dbstat: Rows fetched per second'
          type: DEPENDENT
          key: pgsql.dbstat.sum.tup_fetched.rate
          value_type: FLOAT
          description: 'Number of rows fetched by queries per second.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.tup_fetched
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.dbstat.sum["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: queries
        - uuid: ae250ffa30c94df187c2010011e794aa
          name: 'Dbstat: Rows inserted per second'
          type: DEPENDENT
          key: pgsql.dbstat.sum.tup_inserted.rate
          value_type: FLOAT
          description: 'Number of rows inserted by queries per second.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.tup_inserted
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.dbstat.sum["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: queries
        - uuid: 3253ed1c96db4a84974e62b85d80bc0f
          name: 'Dbstat: Rows returned per second'
          type: DEPENDENT
          key: pgsql.dbstat.sum.tup_returned.rate
          value_type: FLOAT
          description: 'Number of rows returned by queries per second.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.tup_returned
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.dbstat.sum["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: queries
        - uuid: 13feadafa00a4bd293fcf1a98ddf1f39
          name: 'Dbstat: Rows updated per second'
          type: DEPENDENT
          key: pgsql.dbstat.sum.tup_updated.rate
          value_type: FLOAT
          description: 'Number of rows updated by queries per second.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.tup_updated
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.dbstat.sum["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: queries
        - uuid: bc8a3b29a6684b7f8a70a54b962f0e7e
          name: 'Dbstat: Committed transactions per second'
          type: DEPENDENT
          key: pgsql.dbstat.sum.xact_commit.rate
          value_type: FLOAT
          description: 'Number of transactions that have been committed per second.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.xact_commit
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.dbstat.sum["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: transactions
        - uuid: 8aedfe3e385b447eb75b85f92301665a
          name: 'Dbstat: Roll backed transactions per second'
          type: DEPENDENT
          key: pgsql.dbstat.sum.xact_rollback.rate
          value_type: FLOAT
          description: 'Number of transactions that have been rolled back per second.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.xact_rollback
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.dbstat.sum["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: transactions
        - uuid: ddddde3084d54f55838b970f44290523
          name: 'Get dbstat sum'
          key: 'pgsql.dbstat.sum["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          history: '0'
          value_type: TEXT
          description: |
            Collect all metrics from pg_stat_database as sums for all databases:
            https://www.postgresql.org/docs/current/monitoring-stats.html#PG-STAT-DATABASE-VIEW
          tags:
            - tag: component
              value: raw
        - uuid: 3be06ec14cba44d0892f3271a599c473
          name: 'Get dbstat'
          key: 'pgsql.dbstat["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          history: '0'
          value_type: TEXT
          description: |
            Collect all metrics from pg_stat_database per database:
            https://www.postgresql.org/docs/current/monitoring-stats.html#PG-STAT-DATABASE-VIEW
          tags:
            - tag: component
              value: raw
        - uuid: 7112eeb300c14d959c79715462bf9563
          name: 'Get locks'
          key: 'pgsql.locks["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          history: '0'
          value_type: TEXT
          description: |
            Collect all metrics from pg_locks per database:
            https://www.postgresql.org/docs/current/explicit-locking.html#LOCKING-TABLES
          tags:
            - tag: component
              value: raw
        - uuid: 0377fe6f2f8d4539b649c636ab012415
          name: 'Age of oldest xid'
          key: 'pgsql.oldest.xid["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          value_type: FLOAT
          description: 'Age of oldest xid.'
          tags:
            - tag: component
              value: transactions
          triggers:
            - uuid: 2a5c11571d9d46f093ed9081f9d51504
              expression: 'last(/PostgreSQL by Zabbix agent 2/pgsql.oldest.xid["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]) > 18000000'
              name: 'PostgreSQL: Oldest xid is too big'
              priority: AVERAGE
              tags:
                - tag: scope
                  value: availability
        - uuid: 56323e572fa443228987c62039153825
          name: Ping
          key: 'pgsql.ping["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          description: 'Used to test a connection to see if it is alive. It is set to 0 if the query is unsuccessful.'
          valuemap:
            name: 'Service state'
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          tags:
            - tag: component
              value: application
            - tag: component
              value: health
          triggers:
            - uuid: 48a24a78519d47349200f0b41ceec56a
              expression: 'last(/PostgreSQL by Zabbix agent 2/pgsql.ping["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"])=0'
              name: 'PostgreSQL: Service is down'
              priority: HIGH
              description: 'Last test of a connection was unsuccessful.'
              tags:
                - tag: scope
                  value: availability
        - uuid: 01123126fcd54adc84c3bbfa227d9c0c
          name: 'Get queries'
          key: 'pgsql.queries["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}","{$PG.QUERY_ETIME.MAX.WARN}"]'
          history: '0'
          value_type: TEXT
          description: 'Collect all metrics by query execution time.'
          tags:
            - tag: component
              value: raw
        - uuid: a171db459d6144e4ad294579fb8dc56d
          name: 'Replication: Standby count'
          key: 'pgsql.replication.count["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          description: 'Number of standby servers.'
          tags:
            - tag: component
              value: replication
        - uuid: da9ce769f9444a3f9600ce64c4ab2857
          name: 'Replication: Lag in bytes'
          key: 'pgsql.replication.lag.b["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          units: B
          description: 'Replication lag with master, in bytes.'
          tags:
            - tag: component
              value: replication
        - uuid: 5a9eb8ee4a484911903688e620eb618b
          name: 'Replication: Lag in seconds'
          key: 'pgsql.replication.lag.sec["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          units: s
          description: 'Replication lag with master, in seconds.'
          tags:
            - tag: component
              value: replication
        - uuid: 4120befb754d47e9a931f868c28badb9
          name: 'Get replication'
          key: 'pgsql.replication.process["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          history: '0'
          value_type: TEXT
          description: 'Collect metrics from the pg_stat_replication, which contains information about the WAL sender process, showing statistics about replication to that sender''s connected standby server.'
          tags:
            - tag: component
              value: raw
        - uuid: 4085b836bf614f3d910818074c386845
          name: 'Replication: Recovery role'
          key: 'pgsql.replication.recovery_role["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          description: 'Replication role: 1 — recovery is still in progress (standby mode), 0 — master mode.'
          valuemap:
            name: 'PostgreSQL recovery role'
          tags:
            - tag: component
              value: replication
        - uuid: 3c83904cbad74ff7a0d10136a233e6c6
          name: 'Replication: Status'
          key: 'pgsql.replication.status["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          description: 'Replication status: 0 — streaming is down, 1 — streaming is up, 2 — master mode.'
          valuemap:
            name: 'PostgreSQL replication status'
          tags:
            - tag: component
              value: replication
        - uuid: efa946a67e5844ecb905c68a2a6b85bb
          name: Uptime
          key: 'pgsql.uptime["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          value_type: FLOAT
          units: uptime
          description: 'Time since the server started.'
          tags:
            - tag: component
              value: application
          triggers:
            - uuid: 5fbabc5f60b74a369a13a260d25cce3c
              expression: 'last(/PostgreSQL by Zabbix agent 2/pgsql.uptime["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]) < 10m'
              name: 'PostgreSQL: Service has been restarted'
              event_name: 'PostgreSQL: Service has been restarted (uptime < 10m)'
              priority: AVERAGE
              description: 'PostgreSQL uptime is less than 10 minutes.'
              tags:
                - tag: scope
                  value: notice
        - uuid: 523528aad175455fbd1daba161365651
          name: Version
          key: 'pgsql.version["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          delay: 15m
          value_type: CHAR
          description: 'PostgreSQL version.'
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1d
          tags:
            - tag: component
              value: application
          triggers:
            - uuid: 6b3ac2a19e114e1390e6e0793728f576
              expression: 'last(/PostgreSQL by Zabbix agent 2/pgsql.version["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"],#1)<>last(/PostgreSQL by Zabbix agent 2/pgsql.version["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"],#2) and length(last(/PostgreSQL by Zabbix agent 2/pgsql.version["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]))>0'
              name: 'PostgreSQL: Version has changed'
              event_name: 'PostgreSQL: Version has changed (new version value received: {ITEM.VALUE})'
              priority: INFO
              tags:
                - tag: scope
                  value: notice
        - uuid: 6d5aa6213cf248749cbffdea9aff694f
          name: 'WAL: Segments count'
          type: DEPENDENT
          key: pgsql.wal.count
          description: 'Number of WAL segments.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.count
          master_item:
            key: 'pgsql.wal.stat["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: wal
        - uuid: 0e58a74b8a2d47d28f596196405b22b5
          name: 'WAL: Bytes received'
          type: DEPENDENT
          key: pgsql.wal.receive
          units: B
          description: 'WAL receive, in bytes.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.receive
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.wal.stat["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: wal
        - uuid: c3d96741af454f6b9a3a49b6117c31be
          name: 'Get WAL'
          key: 'pgsql.wal.stat["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          delay: 5m
          history: '0'
          value_type: TEXT
          description: 'Collect write-ahead log (WAL) metrics.'
          tags:
            - tag: component
              value: raw
        - uuid: 95f67516be544daf9ad8a1cad2e46114
          name: 'WAL: Bytes written'
          type: DEPENDENT
          key: pgsql.wal.write
          units: B
          description: 'WAL write, in bytes.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.write
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.wal.stat["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: wal
      discovery_rules:
        - uuid: b1a4bfe1031a40529a7c38ac6bed3c6d
          name: 'Database discovery'
          key: 'pgsql.db.discovery["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          delay: 1h
          filter:
            evaltype: AND
            conditions:
              - macro: '{#DBNAME}'
                value: '{$PG.LLD.FILTER.DBNAME}'
          description: |
            Discovers databases (DB) in the database management system (DBMS), except:
            - templates;
            - DBs that do not allow connections.
          item_prototypes:
            - uuid: 1419ff1331734a4088349332e118ca94
              name: 'DB [{#DBNAME}]: Database age'
              key: 'pgsql.db.age["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{#DBNAME}"]'
              delay: 10m
              description: 'Database age.'
              tags:
                - tag: component
                  value: application
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 4367ba7fdffd459ea2b18e1877bc74ca
              name: 'DB [{#DBNAME}]: Bloating tables'
              key: 'pgsql.db.bloating_tables["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{#DBNAME}"]'
              description: 'Number of bloating tables.'
              tags:
                - tag: component
                  value: tables
                - tag: database
                  value: '{#DBNAME}'
            - uuid: b614a0909eec40bc841bf7446e842544
              name: 'DB [{#DBNAME}]: Database size'
              key: 'pgsql.db.size["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{#DBNAME}"]'
              delay: 5m
              units: B
              description: 'Database size.'
              tags:
                - tag: component
                  value: storage
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 4b1b1a4374c0429cb1790e774f181512
              name: 'DB [{#DBNAME}]: Blocks hit per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.blks_hit.rate["{#DBNAME}"]'
              value_type: FLOAT
              description: 'Total number of times per second disk blocks were found already in the buffer cache, so that a read was not necessary.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.blks_hit
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: cache
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 841496e662cc43cf8db7728e96fcba76
              name: 'DB [{#DBNAME}]: Disk blocks read per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.blks_read.rate["{#DBNAME}"]'
              value_type: FLOAT
              description: 'Total number of disk blocks read per second in this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.blks_read
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: storage
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 0313d02ce8274bc9bcaee54d062300c8
              name: 'DB [{#DBNAME}]: Disk blocks read time per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.blk_read_time.rate["{#DBNAME}"]'
              value_type: FLOAT
              units: s
              description: 'Time spent reading data file blocks by backends per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.blk_read_time
                - type: MULTIPLIER
                  parameters:
                    - '0.001'
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: storage
                - tag: database
                  value: '{#DBNAME}'
            - uuid: e746a7760d554a0e9d41ba01c3be9db5
              name: 'DB [{#DBNAME}]: Disk blocks write time'
              type: DEPENDENT
              key: 'pgsql.dbstat.blk_write_time.rate["{#DBNAME}"]'
              value_type: FLOAT
              units: s
              description: 'Time spent writing data file blocks by backends per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.blk_write_time
                - type: MULTIPLIER
                  parameters:
                    - '0.001'
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: storage
                - tag: database
                  value: '{#DBNAME}'
            - uuid: d44335162082498bbc42e29e938a4de7
              name: 'DB [{#DBNAME}]: Checksum failures'
              type: DEPENDENT
              key: 'pgsql.dbstat.checksum_failures.rate["{#DBNAME}"]'
              value_type: FLOAT
              description: 'Number of data page checksum failures detected in this database.'
              valuemap:
                name: 'PostgreSQL checksum failure status'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.checksum_failures
                - type: MATCHES_REGEX
                  parameters:
                    - '^\d*$'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '-2'
                - type: CHANGE_PER_SECOND
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '-1'
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: system
                - tag: database
                  value: '{#DBNAME}'
              trigger_prototypes:
                - uuid: 5995403b904349d296227647ca318f5b
                  expression: 'last(/PostgreSQL by Zabbix agent 2/pgsql.dbstat.checksum_failures.rate["{#DBNAME}"])>0'
                  name: 'PostgreSQL: DB [{#DBNAME}]: Checksum failures detected'
                  priority: AVERAGE
                  description: |
                    Data page checksum failures were detected on that database:
                    https://www.postgresql.org/docs/current/checksums.html
                  tags:
                    - tag: scope
                      value: availability
            - uuid: 4eb67f16bc2948a7927ed58c9d037466
              name: 'DB [{#DBNAME}]: Detected conflicts per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.conflicts.rate["{#DBNAME}"]'
              value_type: FLOAT
              description: 'Total number of queries canceled due to conflicts with recovery in this database per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.conflicts
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
              trigger_prototypes:
                - uuid: 05ac4216e1a941df8880224ffd38b806
                  expression: 'min(/PostgreSQL by Zabbix agent 2/pgsql.dbstat.conflicts.rate["{#DBNAME}"],5m) > {$PG.CONFLICTS.MAX.WARN:"{#DBNAME}"}'
                  name: 'PostgreSQL: DB [{#DBNAME}]: Too many recovery conflicts'
                  event_name: 'PostgreSQL: DB [{#DBNAME}]: Too many recovery conflicts (over {$PG.CONFLICTS.MAX.WARN:"{#DBNAME}"} in 5m)'
                  priority: AVERAGE
                  description: |
                    The primary and standby servers are in many ways loosely connected. Actions on the primary will have an effect on the standby. As a result, there is potential for negative interactions or conflicts between them.
                    https://www.postgresql.org/docs/current/hot-standby.html#HOT-STANDBY-CONFLICT
                  tags:
                    - tag: scope
                      value: performance
            - uuid: d53da0cc702f4fe381e4d13d454ec229
              name: 'DB [{#DBNAME}]: Detected deadlocks per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.deadlocks.rate["{#DBNAME}"]'
              value_type: FLOAT
              description: 'Total number of detected deadlocks in this database per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.deadlocks
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: deadlocks
                - tag: database
                  value: '{#DBNAME}'
              trigger_prototypes:
                - uuid: dd948e3ec19c419e8c9a62ace8d1695f
                  expression: 'min(/PostgreSQL by Zabbix agent 2/pgsql.dbstat.deadlocks.rate["{#DBNAME}"],5m) > {$PG.DEADLOCKS.MAX.WARN:"{#DBNAME}"}'
                  name: 'PostgreSQL: DB [{#DBNAME}]: Deadlock occurred'
                  event_name: 'PostgreSQL: DB [{#DBNAME}]: Deadlock occurred (over {$PG.DEADLOCKS.MAX.WARN:"{#DBNAME}"} in 5m)'
                  priority: HIGH
                  description: 'Number of deadlocks detected per second exceeds {$PG.DEADLOCKS.MAX.WARN:"{#DBNAME}"} for 5m.'
                  tags:
                    - tag: scope
                      value: availability
            - uuid: 7ebf1570bebe4b9cb82474fe5aea0562
              name: 'DB [{#DBNAME}]: Get dbstat'
              type: DEPENDENT
              key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              history: '0'
              value_type: TEXT
              description: 'Get dbstat metrics for database "{#DBNAME}".'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$[''{#DBNAME}'']'
                  error_handler: DISCARD_VALUE
              master_item:
                key: 'pgsql.dbstat["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
              tags:
                - tag: component
                  value: raw
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 2e31986867d24bca930d141cc5d9cc0f
              name: 'DB [{#DBNAME}]: Backends connected'
              type: DEPENDENT
              key: 'pgsql.dbstat.numbackends["{#DBNAME}"]'
              description: 'Number of backends currently connected to this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.numbackends
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: backends
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 82a2f4b2dc4f4dfe9a0a42144f603a8a
              name: 'DB [{#DBNAME}]: Temp_bytes written per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.temp_bytes.rate["{#DBNAME}"]'
              units: B
              description: 'Total amount of data written to temporary files by queries in this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.temp_bytes
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: storage
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 480ffc23ca8d41e3ac86bb162007065f
              name: 'DB [{#DBNAME}]: Temp_files created per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.temp_files.rate["{#DBNAME}"]'
              description: 'Total number of temporary files created by queries in this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.temp_files
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: storage
                - tag: database
                  value: '{#DBNAME}'
            - uuid: cf288751fb894e5291b2d539b4c1a6a1
              name: 'DB [{#DBNAME}]: Tuples deleted per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.tup_deleted.rate["{#DBNAME}"]'
              value_type: FLOAT
              description: 'Total number of rows deleted by queries in this database per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.tup_deleted
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
            - uuid: a512a7a075244ccb90ab6824125a405e
              name: 'DB [{#DBNAME}]: Tuples fetched per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.tup_fetched.rate["{#DBNAME}"]'
              value_type: FLOAT
              description: 'Total number of rows fetched by queries in this database per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.tup_fetched
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 2f24c195df5842f1bdf65a11dea3a315
              name: 'DB [{#DBNAME}]: Tuples inserted per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.tup_inserted.rate["{#DBNAME}"]'
              value_type: FLOAT
              description: 'Total number of rows inserted by queries in this database per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.tup_inserted
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 175c5051ef0c4a31b76270cacbdd7ed5
              name: 'DB [{#DBNAME}]: Tuples returned per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.tup_returned.rate["{#DBNAME}"]'
              value_type: FLOAT
              description: 'Number of rows returned by queries in this database per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.tup_returned
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 9888b495d3f04cceb373c341bd4f1941
              name: 'DB [{#DBNAME}]: Tuples updated per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.tup_updated.rate["{#DBNAME}"]'
              value_type: FLOAT
              description: 'Total number of rows updated by queries in this database per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.tup_updated
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 5b0ecb9c928c49a6a01b5df6aec931dd
              name: 'DB [{#DBNAME}]: Commits per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.xact_commit.rate["{#DBNAME}"]'
              value_type: FLOAT
              description: 'Number of transactions in this database that have been committed per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.xact_commit
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: transactions
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 1d280198e31649fcb053d4c87a0e869d
              name: 'DB [{#DBNAME}]: Rollbacks per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.xact_rollback.rate["{#DBNAME}"]'
              value_type: FLOAT
              description: 'Total number of transactions in this database that have been rolled back.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.xact_rollback
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: transactions
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 8eb2bd907a0e4385bcac9e0f467f9748
              name: 'DB [{#DBNAME}]: Num of accessexclusive locks'
              type: DEPENDENT
              key: 'pgsql.locks.accessexclusive["{#DBNAME}"]'
              description: 'Number of accessexclusive locks for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.accessexclusive
              master_item:
                key: 'pgsql.locks.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: locks
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 5f783de0d6124fc0ae14522a4ad89189
              name: 'DB [{#DBNAME}]: Num of accessshare locks'
              type: DEPENDENT
              key: 'pgsql.locks.accessshare["{#DBNAME}"]'
              description: 'Number of accessshare locks for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.accessshare
              master_item:
                key: 'pgsql.locks.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: locks
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 3c754430815f411e9aa8dde593f6333a
              name: 'DB [{#DBNAME}]: Num of exclusive locks'
              type: DEPENDENT
              key: 'pgsql.locks.exclusive["{#DBNAME}"]'
              description: 'Number of exclusive locks for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.exclusive
              master_item:
                key: 'pgsql.locks.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: locks
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 2c7759f4c9e442cb80bd54ea3323501b
              name: 'DB [{#DBNAME}]: Get locks'
              type: DEPENDENT
              key: 'pgsql.locks.get_metrics["{#DBNAME}"]'
              history: '0'
              value_type: TEXT
              description: 'Get locks metrics for database "{#DBNAME}".'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$[''{#DBNAME}'']'
                  error_handler: DISCARD_VALUE
              master_item:
                key: 'pgsql.locks["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
              tags:
                - tag: component
                  value: raw
                - tag: database
                  value: '{#DBNAME}'
            - uuid: b1ccea7698264d768da1299ec9d13738
              name: 'DB [{#DBNAME}]: Num of rowexclusive locks'
              type: DEPENDENT
              key: 'pgsql.locks.rowexclusive["{#DBNAME}"]'
              description: 'Number of rowexclusive locks for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.rowexclusive
              master_item:
                key: 'pgsql.locks.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: locks
                - tag: database
                  value: '{#DBNAME}'
            - uuid: b4b1402b99284f3bbf0ac0dff493449f
              name: 'DB [{#DBNAME}]: Num of rowshare locks'
              type: DEPENDENT
              key: 'pgsql.locks.rowshare["{#DBNAME}"]'
              description: 'Number of rowshare locks for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.rowshare
                  error_handler: DISCARD_VALUE
              master_item:
                key: 'pgsql.locks.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: locks
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 15eb93e90c1241a99aaff834d69cc5be
              name: 'DB [{#DBNAME}]: Num of sharerowexclusive locks'
              type: DEPENDENT
              key: 'pgsql.locks.sharerowexclusive["{#DBNAME}"]'
              description: 'Number of total sharerowexclusive for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.sharerowexclusive
              master_item:
                key: 'pgsql.locks.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: locks
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 04e6cec0423f4dddb09e6643561bdf77
              name: 'DB [{#DBNAME}]: Num of shareupdateexclusive locks'
              type: DEPENDENT
              key: 'pgsql.locks.shareupdateexclusive["{#DBNAME}"]'
              description: 'Number of shareupdateexclusive locks for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.shareupdateexclusive
              master_item:
                key: 'pgsql.locks.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: locks
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 8a410cf1f0be41fbb5a976f368f07430
              name: 'DB [{#DBNAME}]: Num of share locks'
              type: DEPENDENT
              key: 'pgsql.locks.share["{#DBNAME}"]'
              description: 'Number of share locks for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.share
              master_item:
                key: 'pgsql.locks.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: locks
                - tag: database
                  value: '{#DBNAME}'
            - uuid: a982064d710644db85ebc1cde67bfe4d
              name: 'DB [{#DBNAME}]: Num of locks total'
              type: DEPENDENT
              key: 'pgsql.locks.total["{#DBNAME}"]'
              description: 'Total number of locks in this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.total
              master_item:
                key: 'pgsql.locks.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: locks
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 75e704af5cb545fd9f83bec3f147dd04
              name: 'DB [{#DBNAME}]: Get queries'
              type: DEPENDENT
              key: 'pgsql.queries.get_metrics["{#DBNAME}"]'
              history: '0'
              value_type: TEXT
              description: 'Get queries metrics for database "{#DBNAME}".'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$[''{#DBNAME}'']'
                  error_handler: DISCARD_VALUE
              master_item:
                key: 'pgsql.queries["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}","{$PG.QUERY_ETIME.MAX.WARN}"]'
              tags:
                - tag: component
                  value: raw
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 4c8934820b7f46a195115c7214d4379c
              name: 'DB [{#DBNAME}]: Queries slow maintenance count'
              type: DEPENDENT
              key: 'pgsql.queries.mro.slow_count["{#DBNAME}"]'
              description: 'Slow maintenance query count for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.mro_slow_count
              master_item:
                key: 'pgsql.queries.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 612c8f83e228406f86e70e8486a51f9b
              name: 'DB [{#DBNAME}]: Queries max maintenance time'
              type: DEPENDENT
              key: 'pgsql.queries.mro.time_max["{#DBNAME}"]'
              units: s
              description: 'Max maintenance query time for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.mro_time_max
              master_item:
                key: 'pgsql.queries.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 9cde2701b5814142b064696dc974f45d
              name: 'DB [{#DBNAME}]: Queries sum maintenance time'
              type: DEPENDENT
              key: 'pgsql.queries.mro.time_sum["{#DBNAME}"]'
              units: s
              description: 'Sum maintenance query time for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.mro_time_sum
              master_item:
                key: 'pgsql.queries.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 9e1191f80c3a4e9aa0d3aba2b2740fef
              name: 'DB [{#DBNAME}]: Queries slow query count'
              type: DEPENDENT
              key: 'pgsql.queries.query.slow_count["{#DBNAME}"]'
              description: 'Slow query count for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.query_slow_count
              master_item:
                key: 'pgsql.queries.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
              trigger_prototypes:
                - uuid: 2bb34a2a7dee451cb5419a146d883601
                  expression: 'min(/PostgreSQL by Zabbix agent 2/pgsql.queries.query.slow_count["{#DBNAME}"],5m)>{$PG.SLOW_QUERIES.MAX.WARN:"{#DBNAME}"}'
                  name: 'PostgreSQL: DB [{#DBNAME}]: Too many slow queries'
                  event_name: 'PostgreSQL: DB [{#DBNAME}]: Too many slow queries (over {$PG.SLOW_QUERIES.MAX.WARN:"{#DBNAME}"} in 5m)'
                  priority: WARNING
                  description: 'The number of detected slow queries exceeds the limit of {$PG.SLOW_QUERIES.MAX.WARN:"{#DBNAME}"}.'
                  tags:
                    - tag: scope
                      value: performance
            - uuid: 73712df30d66494998bf11566eba409f
              name: 'DB [{#DBNAME}]: Queries max query time'
              type: DEPENDENT
              key: 'pgsql.queries.query.time_max["{#DBNAME}"]'
              units: s
              description: 'Max query time for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.query_time_max
              master_item:
                key: 'pgsql.queries.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
            - uuid: ba95d84bc11b4df4aece8ddb51042339
              name: 'DB [{#DBNAME}]: Queries sum query time'
              type: DEPENDENT
              key: 'pgsql.queries.query.time_sum["{#DBNAME}"]'
              units: s
              description: 'Sum query time for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.query_time_sum
              master_item:
                key: 'pgsql.queries.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
            - uuid: d31701d52f5941d5a24241c95db52373
              name: 'DB [{#DBNAME}]: Queries slow transaction count'
              type: DEPENDENT
              key: 'pgsql.queries.tx.slow_count["{#DBNAME}"]'
              description: 'Slow transaction query count for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.tx_slow_count
              master_item:
                key: 'pgsql.queries.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
            - uuid: ecc24b3143254dd4b2fc01c12cefb345
              name: 'DB [{#DBNAME}]: Queries max transaction time'
              type: DEPENDENT
              key: 'pgsql.queries.tx.time_max["{#DBNAME}"]'
              units: s
              description: 'Max transaction query time for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.tx_time_max
              master_item:
                key: 'pgsql.queries.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 178926a753614bb58206d82f68280097
              name: 'DB [{#DBNAME}]: Queries sum transaction time'
              type: DEPENDENT
              key: 'pgsql.queries.tx.time_sum["{#DBNAME}"]'
              units: s
              description: 'Sum transaction query time for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.tx_time_sum
              master_item:
                key: 'pgsql.queries.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
          graph_prototypes:
            - uuid: af6eac83efc94d2a9f4a3501207fb5ce
              name: 'DB [{#DBNAME}]: Locks'
              graph_items:
                - drawtype: GRADIENT_LINE
                  color: 199C0D
                  item:
                    host: 'PostgreSQL by Zabbix agent 2'
                    key: 'pgsql.locks.total["{#DBNAME}"]'
                - sortorder: '1'
                  color: F63100
                  item:
                    host: 'PostgreSQL by Zabbix agent 2'
                    key: 'pgsql.locks.accessexclusive["{#DBNAME}"]'
                - sortorder: '2'
                  color: 00611C
                  item:
                    host: 'PostgreSQL by Zabbix agent 2'
                    key: 'pgsql.locks.accessshare["{#DBNAME}"]'
                - sortorder: '3'
                  color: F7941D
                  item:
                    host: 'PostgreSQL by Zabbix agent 2'
                    key: 'pgsql.locks.exclusive["{#DBNAME}"]'
                - sortorder: '4'
                  color: FC6EA3
                  item:
                    host: 'PostgreSQL by Zabbix agent 2'
                    key: 'pgsql.locks.rowexclusive["{#DBNAME}"]'
                - sortorder: '5'
                  color: 6C59DC
                  item:
                    host: 'PostgreSQL by Zabbix agent 2'
                    key: 'pgsql.locks.rowshare["{#DBNAME}"]'
                - sortorder: '6'
                  color: C7A72D
                  item:
                    host: 'PostgreSQL by Zabbix agent 2'
                    key: 'pgsql.locks.sharerowexclusive["{#DBNAME}"]'
                - sortorder: '7'
                  color: BA2A5D
                  item:
                    host: 'PostgreSQL by Zabbix agent 2'
                    key: 'pgsql.locks.shareupdateexclusive["{#DBNAME}"]'
                - sortorder: '8'
                  color: F230E0
                  item:
                    host: 'PostgreSQL by Zabbix agent 2'
                    key: 'pgsql.locks.share["{#DBNAME}"]'
            - uuid: 9a518b4bf0f04609863bf9dc4c7f1ea2
              name: 'DB [{#DBNAME}]: Number of bloating tables'
              graph_items:
                - drawtype: GRADIENT_LINE
                  color: 199C0D
                  item:
                    host: 'PostgreSQL by Zabbix agent 2'
                    key: 'pgsql.db.bloating_tables["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{#DBNAME}"]'
            - uuid: 4d46d39a1d1146c19a57b2b5b8086708
              name: 'DB [{#DBNAME}]: pg_stat_database metrics'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'PostgreSQL by Zabbix agent 2'
                    key: 'pgsql.dbstat.blks_hit.rate["{#DBNAME}"]'
                - sortorder: '1'
                  color: F63100
                  item:
                    host: 'PostgreSQL by Zabbix agent 2'
                    key: 'pgsql.dbstat.blks_read.rate["{#DBNAME}"]'
                - sortorder: '2'
                  color: 00611C
                  item:
                    host: 'PostgreSQL by Zabbix agent 2'
                    key: 'pgsql.dbstat.conflicts.rate["{#DBNAME}"]'
                - sortorder: '3'
                  color: F7941D
                  item:
                    host: 'PostgreSQL by Zabbix agent 2'
                    key: 'pgsql.dbstat.deadlocks.rate["{#DBNAME}"]'
                - sortorder: '4'
                  color: FC6EA3
                  item:
                    host: 'PostgreSQL by Zabbix agent 2'
                    key: 'pgsql.dbstat.temp_bytes.rate["{#DBNAME}"]'
                - sortorder: '5'
                  color: 6C59DC
                  item:
                    host: 'PostgreSQL by Zabbix agent 2'
                    key: 'pgsql.dbstat.temp_files.rate["{#DBNAME}"]'
                - sortorder: '6'
                  color: C7A72D
                  item:
                    host: 'PostgreSQL by Zabbix agent 2'
                    key: 'pgsql.dbstat.tup_deleted.rate["{#DBNAME}"]'
                - sortorder: '7'
                  color: BA2A5D
                  item:
                    host: 'PostgreSQL by Zabbix agent 2'
                    key: 'pgsql.dbstat.tup_fetched.rate["{#DBNAME}"]'
                - sortorder: '8'
                  color: F230E0
                  item:
                    host: 'PostgreSQL by Zabbix agent 2'
                    key: 'pgsql.dbstat.tup_inserted.rate["{#DBNAME}"]'
                - sortorder: '9'
                  color: 5CCD18
                  item:
                    host: 'PostgreSQL by Zabbix agent 2'
                    key: 'pgsql.dbstat.tup_returned.rate["{#DBNAME}"]'
                - sortorder: '10'
                  color: BB2A02
                  item:
                    host: 'PostgreSQL by Zabbix agent 2'
                    key: 'pgsql.dbstat.tup_updated.rate["{#DBNAME}"]'
                - sortorder: '11'
                  color: AC41A5
                  item:
                    host: 'PostgreSQL by Zabbix agent 2'
                    key: 'pgsql.dbstat.xact_commit.rate["{#DBNAME}"]'
                - sortorder: '12'
                  color: 89ABF8
                  item:
                    host: 'PostgreSQL by Zabbix agent 2'
                    key: 'pgsql.dbstat.xact_rollback.rate["{#DBNAME}"]'
            - uuid: 98f4c88e15b742fb80e1ecd8aeab970d
              name: 'DB [{#DBNAME}]: Queries'
              ymin_type_1: FIXED
              graph_items:
                - color: 199C0D
                  yaxisside: RIGHT
                  item:
                    host: 'PostgreSQL by Zabbix agent 2'
                    key: 'pgsql.queries.mro.time_max["{#DBNAME}"]'
                - sortorder: '1'
                  color: F63100
                  yaxisside: RIGHT
                  item:
                    host: 'PostgreSQL by Zabbix agent 2'
                    key: 'pgsql.queries.query.time_max["{#DBNAME}"]'
                - sortorder: '2'
                  color: 00611C
                  yaxisside: RIGHT
                  item:
                    host: 'PostgreSQL by Zabbix agent 2'
                    key: 'pgsql.queries.tx.time_max["{#DBNAME}"]'
                - sortorder: '3'
                  drawtype: GRADIENT_LINE
                  color: F7941D
                  item:
                    host: 'PostgreSQL by Zabbix agent 2'
                    key: 'pgsql.queries.mro.time_sum["{#DBNAME}"]'
                - sortorder: '4'
                  drawtype: GRADIENT_LINE
                  color: FC6EA3
                  item:
                    host: 'PostgreSQL by Zabbix agent 2'
                    key: 'pgsql.queries.query.time_sum["{#DBNAME}"]'
                - sortorder: '5'
                  drawtype: GRADIENT_LINE
                  color: 6C59DC
                  item:
                    host: 'PostgreSQL by Zabbix agent 2'
                    key: 'pgsql.queries.tx.time_sum["{#DBNAME}"]'
            - uuid: 86853d8590344bad84aab1deb3d1cffc
              name: 'DB [{#DBNAME}]: Size'
              graph_items:
                - drawtype: GRADIENT_LINE
                  color: 199C0D
                  item:
                    host: 'PostgreSQL by Zabbix agent 2'
                    key: 'pgsql.db.size["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{#DBNAME}"]'
            - uuid: 918a6fd8bd0e49c98f759778f44ab606
              name: 'DB [{#DBNAME}]: Slow queries'
              ymin_type_1: FIXED
              graph_items:
                - color: 199C0D
                  item:
                    host: 'PostgreSQL by Zabbix agent 2'
                    key: 'pgsql.queries.mro.slow_count["{#DBNAME}"]'
                - sortorder: '1'
                  color: F63100
                  item:
                    host: 'PostgreSQL by Zabbix agent 2'
                    key: 'pgsql.queries.query.slow_count["{#DBNAME}"]'
                - sortorder: '2'
                  color: 00611C
                  item:
                    host: 'PostgreSQL by Zabbix agent 2'
                    key: 'pgsql.queries.tx.slow_count["{#DBNAME}"]'
        - uuid: e94f9017c06644a2bbcb48697381556d
          name: 'Replication discovery'
          key: 'pgsql.replication.process.discovery["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          delay: 15m
          filter:
            evaltype: AND
            conditions:
              - macro: '{#APPLICATION_NAME}'
                value: '{$PG.LLD.FILTER.APPLICATION}'
          description: 'Discovers replication lag metrics.'
          item_prototypes:
            - uuid: a77e5e6702ff41af9defe102cbeeea74
              name: 'Application [{#APPLICATION_NAME}]: Get replication'
              type: DEPENDENT
              key: 'pgsql.replication.get_metrics["{#APPLICATION_NAME}"]'
              history: '0'
              value_type: TEXT
              description: 'Collect metrics from the "pg_stat_replication" about the application "{#APPLICATION_NAME}" that is connected to this WAL sender, which contains information about the WAL sender process, showing statistics about replication to that sender''s connected standby server.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$[''{#APPLICATION_NAME}'']'
                  error_handler: DISCARD_VALUE
              master_item:
                key: 'pgsql.replication.process["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
              tags:
                - tag: application
                  value: '{#APPLICATION_NAME}'
                - tag: component
                  value: raw
            - uuid: 15b83330044042668e618501160c37e4
              name: 'Application [{#APPLICATION_NAME}]: Replication flush lag'
              type: DEPENDENT
              key: 'pgsql.replication.process.flush_lag["{#APPLICATION_NAME}"]'
              value_type: FLOAT
              units: s
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.flush_lag
              master_item:
                key: 'pgsql.replication.get_metrics["{#APPLICATION_NAME}"]'
              tags:
                - tag: application
                  value: '{#APPLICATION_NAME}'
                - tag: component
                  value: replication
            - uuid: 0daf6e3c7843488cb3160a2bd6b09fbf
              name: 'Application [{#APPLICATION_NAME}]: Replication replay lag'
              type: DEPENDENT
              key: 'pgsql.replication.process.replay_lag["{#APPLICATION_NAME}"]'
              value_type: FLOAT
              units: s
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.replay_lag
              master_item:
                key: 'pgsql.replication.get_metrics["{#APPLICATION_NAME}"]'
              tags:
                - tag: application
                  value: '{#APPLICATION_NAME}'
                - tag: component
                  value: replication
            - uuid: 2d96bc517d3a4c3fbcae8a7f1436bf72
              name: 'Application [{#APPLICATION_NAME}]: Replication write lag'
              type: DEPENDENT
              key: 'pgsql.replication.process.write_lag["{#APPLICATION_NAME}"]'
              value_type: FLOAT
              units: s
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.write_lag
              master_item:
                key: 'pgsql.replication.get_metrics["{#APPLICATION_NAME}"]'
              tags:
                - tag: application
                  value: '{#APPLICATION_NAME}'
                - tag: component
                  value: replication
          graph_prototypes:
            - uuid: e79dfe2d436d49da898772a9e7345825
              name: 'Application [{#APPLICATION_NAME}]: Replication lag'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'PostgreSQL by Zabbix agent 2'
                    key: 'pgsql.replication.process.flush_lag["{#APPLICATION_NAME}"]'
                - sortorder: '1'
                  color: F63100
                  item:
                    host: 'PostgreSQL by Zabbix agent 2'
                    key: 'pgsql.replication.process.replay_lag["{#APPLICATION_NAME}"]'
                - sortorder: '2'
                  color: 00611C
                  item:
                    host: 'PostgreSQL by Zabbix agent 2'
                    key: 'pgsql.replication.process.write_lag["{#APPLICATION_NAME}"]'
      tags:
        - tag: class
          value: database
        - tag: subclass
          value: sql
        - tag: target
          value: postgresql
      macros:
        - macro: '{$PG.CONFLICTS.MAX.WARN}'
          value: '0'
          description: 'Maximum number of recovery conflicts for trigger expression.'
          config:
            type: TEXT
            priority: '9'
            section_name: Thresholds
            label: 'Maximum number of recovery conflicts'
            description: 'Maximum number of recovery conflicts for trigger expression. No less than 0.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$PG.CONNSTRING.AGENT2}'
          value: 'tcp://localhost:5432'
          description: 'URI or named session of the PostgreSQL instance.'
          config:
            type: TEXT
            priority: '1'
            label: 'PostgreSQL connection string'
            description: 'URI or named session of the PostgreSQL instance.'
            required: 'YES'
        - macro: '{$PG.CONN_TOTAL_PCT.MAX.WARN}'
          value: '90'
          description: 'Maximum percentage of current connections for trigger expression.'
          config:
            type: TEXT
            priority: '8'
            section_name: Thresholds
            label: 'Maximum percentage of current connections'
            description: 'Maximum percentage of current connections for trigger expression. In the range from 0 to 100 inclusive.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$PG.DATABASE}'
          value: postgres
          description: 'Default PostgreSQL database for the connection.'
          config:
            type: TEXT
            priority: '4'
            label: 'Default PostgreSQL database for the connection'
            required: 'YES'
        - macro: '{$PG.DEADLOCKS.MAX.WARN}'
          value: '0'
          description: 'Maximum number of detected deadlocks for trigger expression.'
          config:
            type: TEXT
            priority: '7'
            section_name: Thresholds
            label: 'Maximum number of detected deadlocks'
            description: 'Maximum number of detected deadlocks for trigger expression. No less than 0.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$PG.LLD.FILTER.APPLICATION}'
          value: .+
          description: 'Filter of discoverable applications.'
          config:
            type: TEXT
            priority: '6'
            section_name: Filters
            label: 'Applications LLD filter'
            description: 'Filter of discoverable applications.'
        - macro: '{$PG.LLD.FILTER.DBNAME}'
          value: .+
          description: 'Filter of discoverable databases.'
          config:
            type: TEXT
            priority: '5'
            section_name: Filters
            label: 'Database name LLD filter'
            description: 'Filter of discoverable databases.'
        - macro: '{$PG.PASSWORD}'
          type: SECRET_TEXT
          description: 'PostgreSQL user password.'
          config:
            type: TEXT
            priority: '3'
            label: 'PostgreSQL user password'
            required: 'YES'
        - macro: '{$PG.QUERY_ETIME.MAX.WARN}'
          value: '30'
          description: 'Execution time limit for count of slow queries.'
          config:
            type: TEXT
            priority: '10'
            section_name: Thresholds
            label: 'Slow queries execution time threshold'
            description: 'Execution time threshold for queries to be considered slow. No less than 0.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$PG.SLOW_QUERIES.MAX.WARN}'
          value: '5'
          description: 'Slow queries count threshold for a trigger.'
          config:
            type: TEXT
            priority: '11'
            section_name: Thresholds
            label: 'Slow queries count threshold'
            description: 'Slow queries count threshold for a trigger. No less than 0.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$PG.USER}'
          value: zbx_monitor
          description: 'PostgreSQL username.'
          config:
            type: TEXT
            priority: '2'
            label: 'PostgreSQL username'
            required: 'YES'
      dashboards:
        - uuid: e3ae726b06cc4663a3eef5a73909f796
          name: 'PostgreSQL databases'
          pages:
            - widgets:
                - type: graphprototype
                  width: '36'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'PostgreSQL by Zabbix agent 2'
                        name: 'DB [{#DBNAME}]: pg_stat_database metrics'
                    - type: STRING
                      name: reference
                      value: AAAAA
                - type: graphprototype
                  'y': '5'
                  width: '36'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'PostgreSQL by Zabbix agent 2'
                        name: 'DB [{#DBNAME}]: Size'
                    - type: STRING
                      name: reference
                      value: AAAAC
                - type: graphprototype
                  'y': '10'
                  width: '36'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'PostgreSQL by Zabbix agent 2'
                        name: 'DB [{#DBNAME}]: Queries'
                    - type: STRING
                      name: reference
                      value: AAAAE
                - type: graphprototype
                  x: '36'
                  width: '36'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'PostgreSQL by Zabbix agent 2'
                        name: 'DB [{#DBNAME}]: Locks'
                    - type: STRING
                      name: reference
                      value: AAAAB
                - type: graphprototype
                  x: '36'
                  'y': '5'
                  width: '36'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'PostgreSQL by Zabbix agent 2'
                        name: 'DB [{#DBNAME}]: Number of bloating tables'
                    - type: STRING
                      name: reference
                      value: AAAAD
                - type: graphprototype
                  x: '36'
                  'y': '10'
                  width: '36'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'PostgreSQL by Zabbix agent 2'
                        name: 'DB [{#DBNAME}]: Slow queries'
                    - type: STRING
                      name: reference
                      value: AAAAF
      valuemaps:
        - uuid: cd2d975b0d7e4f8e89afb1033fce4ce2
          name: 'PostgreSQL checksum failure status'
          mappings:
            - value: '-2'
              newvalue: 'null'
        - uuid: 9f38c01c325248d4b538c0582432b541
          name: 'PostgreSQL recovery role'
          mappings:
            - value: '0'
              newvalue: Master
            - value: '1'
              newvalue: Standby
        - uuid: 0fba38eefa4c4073b46d3f8579fda314
          name: 'PostgreSQL replication status'
          mappings:
            - value: '0'
              newvalue: Down
            - value: '1'
              newvalue: Up
            - value: '2'
              newvalue: Master
        - uuid: 6619a58602a44e83950d3d4b5180c0e9
          name: 'Service state'
          mappings:
            - value: '0'
              newvalue: Down
            - value: '1'
              newvalue: Up
    - uuid: 21cca24cec1d40cdb0c2999aa6ac3037
      template: 'PostgreSQL by Zabbix agent 2 active'
      name: 'PostgreSQL by Zabbix agent 2 active'
      description: |
        This template is designed for the deployment of PostgreSQL monitoring by Zabbix via Zabbix agent 2 and uses a loadable plugin to run SQL queries.
        
        Setup:
        
        1. Deploy Zabbix agent 2 with the PostgreSQL plugin. Starting with Zabbix versions 6.0.10 / 6.2.4 / 6.4 PostgreSQL metrics are moved to a loadable plugin and require installation of a separate package or compilation of the plugin from sources (https://www.zabbix.com/documentation/8.0/manual/extensions/plugins/build).
        
        2. Create the PostgreSQL user for monitoring (`<password>` at your discretion) and inherit permissions from the default role `pg_monitor`:
        CREATE USER zbx_monitor WITH PASSWORD '<PASSWORD>' INHERIT;
        GRANT pg_monitor TO zbx_monitor;
        
        3. Edit the `pg_hba.conf` configuration file to allow connections for the user `zbx_monitor`. You can check the PostgreSQL documentation for examples (https://www.postgresql.org/docs/current/auth-pg-hba-conf.html).
        
        4. Set the connection string for the PostgreSQL instance in the `{$PG.CONNSTRING.AGENT2}` macro as URI, such as `<protocol(host:port)>`, or specify the named session - `<sessionname>`.
        
        Note: if you want to use SSL/TLS encryption to protect communications with the remote PostgreSQL instance, a named session must be used. In that case, the instance URI should be specified in the `Plugins.PostgreSQL.Sessions.*.Uri` parameter in the PostgreSQL plugin configuration files alongside all the encryption parameters (type, certificate/key filepaths if needed etc.).
        
        You can check the PostgreSQL plugin documentation (https://git.zabbix.com/projects/AP/repos/postgresql/browse?at=refs%2Fheads%2Frelease%2F8.0) for details about agent plugin parameters and named sessions.
        
        Also, it is assumed that you set up the PostgreSQL instance to work in the desired encryption mode. Check the PostgreSQL documentation (https://www.postgresql.org/docs/current/ssl-tcp.html) for details.
        
        Note that plugin TLS certificate validation relies on checking the Subject Alternative Names (SAN) instead of the Common Name (CN), check the cryptography package documentation (https://pkg.go.dev/crypto/x509) for details.
        
        For example, to enable required encryption in transport mode without identity checks you could create the file `/etc/zabbix/zabbix_agent2.d/postgresql_myconn.conf` with the following configuration for the named session `myconn` (replace `<instanceip>` with the address of the PostgreSQL instance):
        Plugins.PostgreSQL.Sessions.myconn.Uri=tcp://<instanceip>:5432
        Plugins.PostgreSQL.Sessions.myconn.TLSConnect=required
        
        Then set the `{$PG.CONNSTRING.AGENT2}` macro to `myconn` to use this named session.
        
        5. Set the password that you specified in step 2 in the macro `{$PG.PASSWORD}`.
        
        You can discuss this template or leave feedback on our forum https://www.zabbix.com/forum/zabbix-suggestions-and-feedback/384190-%C2%A0discussion-thread-for-official-zabbix-template-db-postgresql
        
        Generated by official Zabbix template tool "Templator"
      wizard_ready: 'YES'
      readme: |
        ## Overview
        
        This template is designed for the deployment of PostgreSQL monitoring by Zabbix via Zabbix agent 2 and uses a loadable plugin to run SQL queries.
        
        ## Setup
        
        1. Create the PostgreSQL user for monitoring (`<password>` at your discretion) and inherit permissions from the default role `pg_monitor`:
        
        ```sql
        CREATE USER zbx_monitor WITH PASSWORD '<PASSWORD>' INHERIT;
        GRANT pg_monitor TO zbx_monitor;
        ```
        
        2. Edit the `pg_hba.conf` configuration file to allow connections for the user `zbx_monitor`. For example, you could add one of the following rows to allow local TCP connections from the same host:
        
        ```bash
        # TYPE  DATABASE        USER            ADDRESS                 METHOD
          host       all        zbx_monitor     localhost               trust
          host       all        zbx_monitor     127.0.0.1/32            md5
          host       all        zbx_monitor     ::1/128                 scram-sha-256
        ```
        
        For more information please read the PostgreSQL documentation `https://www.postgresql.org/docs/current/auth-pg-hba-conf.html`.
        
        3. Set the connection string for the PostgreSQL instance in the `PostgreSQL connection string` host wizard configuration field as URI, such as `<protocol(host:port)>`, or specify the named session - `<sessionname>`.
        
        **Note:** if you want to use SSL/TLS encryption to protect communications with the remote PostgreSQL instance, a named session must be used. In that case, the instance URI should be specified in the `Plugins.PostgreSQL.Sessions.*.Uri` parameter in the PostgreSQL plugin configuration files alongside all the encryption parameters (type, certificate/key filepaths if needed etc.).
        
        You can check the [`PostgreSQL plugin documentation`](https://git.zabbix.com/projects/AP/repos/postgresql/browse?at=refs%2Fheads%2Frelease%2F8.0) for details about agent plugin parameters and named sessions.
        
        Also, it is assumed that you set up the PostgreSQL instance to work in the desired encryption mode. Check the [`PostgreSQL documentation`](https://www.postgresql.org/docs/current/ssl-tcp.html) for details.
        
        **Note:** plugin TLS certificate validation relies on checking the Subject Alternative Names (SAN) instead of the Common Name (CN), check the cryptography package [`documentation`](https://pkg.go.dev/crypto/x509) for details.
        
        For example, to enable required encryption in transport mode without identity checks you could create the file `/etc/zabbix/zabbix_agent2.d/postgresql_myconn.conf` with the following configuration for the named session `myconn` (replace `<instanceip>` with the address of the PostgreSQL instance):
        
        ```bash
        Plugins.PostgreSQL.Sessions.myconn.Uri=tcp://<instanceip>:5432
        Plugins.PostgreSQL.Sessions.myconn.TLSConnect=required
        ```
        
        Then set the `PostgreSQL connection string` field to `myconn` to use this named session.
        
        4. Set the password that you specified in step 2 in the `PostgreSQL user password` field.
      vendor:
        name: Zabbix
        version: 8.0-0
      groups:
        - name: Templates/Databases
      items:
        - uuid: b760f7ff059e40d7ab9d26fe5cc3fa2d
          name: 'Archive: Count of archived files'
          type: DEPENDENT
          key: pgsql.archive.count_archived_files
          value_type: FLOAT
          description: 'Count of archived files.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.archived_count
          master_item:
            key: 'pgsql.archive["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: archive
        - uuid: 8d7aee551783484d9a321a5e7d57c417
          name: 'Archive: Count of files in archive_status need to archive'
          type: DEPENDENT
          key: pgsql.archive.count_files_to_archive
          value_type: FLOAT
          description: 'Count of files to archive.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.count_files
          master_item:
            key: 'pgsql.archive["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: archive
        - uuid: 99ada32d0c2f4241bc81a09b0226b661
          name: 'Archive: Count of failed attempts to archive files'
          type: DEPENDENT
          key: pgsql.archive.failed_trying_to_archive
          value_type: FLOAT
          description: 'Count of failed attempts to archive files.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.failed_count
          master_item:
            key: 'pgsql.archive["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: archive
        - uuid: 842a4e56976a4dcbb41b388bfb3798ea
          name: 'Archive: Size of files need to archive'
          type: DEPENDENT
          key: pgsql.archive.size_files_to_archive
          value_type: FLOAT
          description: 'Size of files to archive.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.size_files
          master_item:
            key: 'pgsql.archive["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: archive
        - uuid: 218b03c8bfb84b07ae0ec9ba0932fff3
          name: 'Get archive'
          type: ZABBIX_ACTIVE
          key: 'pgsql.archive["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          history: '0'
          value_type: TEXT
          description: 'Collect archive status metrics.'
          tags:
            - tag: component
              value: raw
        - uuid: bc14c8544eed47ce9510a803be5708d7
          name: 'Count of autovacuum workers'
          type: ZABBIX_ACTIVE
          key: 'pgsql.autovacuum.count["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          value_type: FLOAT
          description: 'Number of autovacuum workers.'
          tags:
            - tag: component
              value: system
        - uuid: eadfb41d59a84315a8b3540005fc9138
          name: 'Bgwriter: Buffers allocated per second'
          type: DEPENDENT
          key: pgsql.bgwriter.buffers_alloc.rate
          value_type: FLOAT
          description: 'Number of buffers allocated per second.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.buffers_alloc
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.bgwriter["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: bgwriter
        - uuid: 6c1df723638b435a813e144b730bab0a
          name: 'Bgwriter: Buffers written directly by a backend per second'
          type: DEPENDENT
          key: pgsql.bgwriter.buffers_backend.rate
          value_type: FLOAT
          description: 'Number of buffers written directly by a backend per second. Available in PostgreSQL versions prior to 17.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.buffers_backend
              error_handler: DISCARD_VALUE
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.bgwriter["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: bgwriter
        - uuid: 2e0f72740975437d94807cc1ea3a52cd
          name: 'Bgwriter: Times a backend executed its own fsync per second'
          type: DEPENDENT
          key: pgsql.bgwriter.buffers_backend_fsync.rate
          value_type: FLOAT
          description: 'Number of times a backend had to execute its own fsync call per second (normally the background writer handles those even when the backend does its own write). Available in PostgreSQL versions prior to 17.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.buffers_backend_fsync
              error_handler: DISCARD_VALUE
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.bgwriter["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: bgwriter
        - uuid: 84bffdbacf8449e48a58a15f3363d3b2
          name: 'Checkpoint: Buffers written during checkpoints per second'
          type: DEPENDENT
          key: pgsql.bgwriter.buffers_checkpoint.rate
          value_type: FLOAT
          description: 'Number of buffers written during checkpoints per second.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.buffers_checkpoint
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.bgwriter["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: bgwriter
        - uuid: 98cace696df64de8a5f5106a8c2c52ba
          name: 'Checkpoint: Buffers written by the background writer per second'
          type: DEPENDENT
          key: pgsql.bgwriter.buffers_clean.rate
          value_type: FLOAT
          description: 'Number of buffers written by the background writer per second.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.buffers_clean
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.bgwriter["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: bgwriter
        - uuid: 35b2f1af4e1f45d9b729eb09757ce6e4
          name: 'Checkpoint: Requested per second'
          type: DEPENDENT
          key: pgsql.bgwriter.checkpoints_req.rate
          value_type: FLOAT
          description: 'Number of requested checkpoints that have been performed per second.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.checkpoints_req
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.bgwriter["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: bgwriter
        - uuid: a3d03d5bba4d4bb0a1ed52f684143ca5
          name: 'Checkpoint: Scheduled per second'
          type: DEPENDENT
          key: pgsql.bgwriter.checkpoints_timed.rate
          value_type: FLOAT
          description: 'Number of scheduled checkpoints that have been performed per second.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.checkpoints_timed
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.bgwriter["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: bgwriter
        - uuid: 7ff2d5d51057451fb2089e92444feb84
          name: 'Checkpoint: Checkpoint sync time per second'
          type: DEPENDENT
          key: pgsql.bgwriter.checkpoint_sync_time.rate
          value_type: FLOAT
          units: s
          description: 'Total amount of time per second that has been spent in the portion of checkpoint processing where files are synchronized to disk.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.checkpoint_sync_time
            - type: MULTIPLIER
              parameters:
                - '0.001'
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.bgwriter["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: bgwriter
        - uuid: 7217bdae3d72478aae2c2cc1c151f203
          name: 'Checkpoint: Checkpoint write time per second'
          type: DEPENDENT
          key: pgsql.bgwriter.checkpoint_write_time.rate
          value_type: FLOAT
          units: s
          description: 'Total amount of time per second that has been spent in the portion of checkpoint processing where files are written to disk.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.checkpoint_write_time
            - type: MULTIPLIER
              parameters:
                - '0.001'
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.bgwriter["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: bgwriter
        - uuid: d0cb711ca251430ab0c1beb5f2617c6d
          name: 'Bgwriter: Number of bgwriter cleaning scan stopped per second'
          type: DEPENDENT
          key: pgsql.bgwriter.maxwritten_clean.rate
          value_type: FLOAT
          description: 'Number of times the background writer stopped a cleaning scan because it had written too many buffers per second.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.maxwritten_clean
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.bgwriter["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: bgwriter
        - uuid: 8d0dd45f06974d6b8be9cc11404ac1c3
          name: 'Get bgwriter'
          type: ZABBIX_ACTIVE
          key: 'pgsql.bgwriter["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          history: '0'
          value_type: TEXT
          description: |
            Collect all metrics from pg_stat_bgwriter:
            https://www.postgresql.org/docs/current/monitoring-stats.html#PG-STAT-BGWRITER-VIEW
          tags:
            - tag: component
              value: raw
        - uuid: 7b701ad8f20a44958956a6cbfd4e5da2
          name: 'Cache hit ratio, %'
          type: CALCULATED
          key: pgsql.cache.hit
          value_type: FLOAT
          units: '%'
          params: 'last(//pgsql.dbstat.sum.blks_hit.rate) * 100 / (last(//pgsql.dbstat.sum.blks_hit.rate) + last(//pgsql.dbstat.sum.blks_read.rate))'
          description: 'Cache hit ratio.'
          tags:
            - tag: component
              value: cache
        - uuid: 20eca5056709454189394db755132cb5
          name: 'Connections sum: Active'
          type: DEPENDENT
          key: pgsql.connections.sum.active
          description: 'Total number of connections executing a query.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.active
          master_item:
            key: 'pgsql.connections["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: connections
        - uuid: 8ff6487a87d049ae95a4465b5c3cf438
          name: 'Connections sum: Disabled'
          type: DEPENDENT
          key: pgsql.connections.sum.disabled
          description: 'Total number of disabled connections.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.disabled
          master_item:
            key: 'pgsql.connections["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: connections
        - uuid: dde39d43bd8e45e29e6ca2ab28d34499
          name: 'Connections sum: Fastpath function call'
          type: DEPENDENT
          key: pgsql.connections.sum.fastpath_function_call
          description: 'Total number of connections executing a fast-path function.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.fastpath_function_call
          master_item:
            key: 'pgsql.connections["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: connections
        - uuid: 4717491488f642f5ad40d93da59793f5
          name: 'Connections sum: Idle'
          type: DEPENDENT
          key: pgsql.connections.sum.idle
          description: 'Total number of connections waiting for a new client command.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.idle
          master_item:
            key: 'pgsql.connections["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: connections
        - uuid: cda45db6de6d4deeb988235f0c7d9376
          name: 'Connections sum: Idle in transaction'
          type: DEPENDENT
          key: pgsql.connections.sum.idle_in_transaction
          description: 'Total number of connections in a transaction state but not executing a query.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.idle_in_transaction
          master_item:
            key: 'pgsql.connections["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: connections
        - uuid: 503826ace4f848ada43abc60ff7c1ee2
          name: 'Connections sum: Idle in transaction (aborted)'
          type: DEPENDENT
          key: pgsql.connections.sum.idle_in_transaction_aborted
          description: 'Total number of connections in a transaction state but not executing a query, and where one of the statements in the transaction caused an error.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.idle_in_transaction_aborted
          master_item:
            key: 'pgsql.connections["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: connections
        - uuid: 604c4b1fd04249be896c7588bf2c6b23
          name: 'Connections sum: Prepared'
          type: DEPENDENT
          key: pgsql.connections.sum.prepared
          description: |
            Total number of prepared transactions:
            https://www.postgresql.org/docs/current/sql-prepare-transaction.html
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.prepared
          master_item:
            key: 'pgsql.connections["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: connections
        - uuid: d7faa8068a8f4877b77fb5120bbe6d8d
          name: 'Connections sum: Total'
          type: DEPENDENT
          key: pgsql.connections.sum.total
          description: 'Total number of connections.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.total
          master_item:
            key: 'pgsql.connections["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: connections
        - uuid: 85b9cf0643fc4cf289f8b0ac364e8879
          name: 'Connections sum: Total, %'
          type: DEPENDENT
          key: pgsql.connections.sum.total_pct
          units: '%'
          description: 'Total number of connections, in percentage.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.total_pct
          master_item:
            key: 'pgsql.connections["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: connections
          triggers:
            - uuid: f07fbe410afa48e6a08da06f4af504c5
              expression: 'min(/PostgreSQL by Zabbix agent 2 active/pgsql.connections.sum.total_pct,5m) > {$PG.CONN_TOTAL_PCT.MAX.WARN}'
              name: 'PostgreSQL: Total number of connections is too high'
              event_name: 'PostgreSQL: Total number of connections is too high (over {$PG.CONN_TOTAL_PCT.MAX.WARN} in 5m)'
              priority: AVERAGE
              description: 'Total number of current connections exceeds the limit of {$PG.CONN_TOTAL_PCT.MAX.WARN}% out of the maximum number of concurrent connections to the database server (the "max_connections" setting).'
              tags:
                - tag: scope
                  value: performance
        - uuid: 2a05cc636fc0432386a5c6c00ac2777b
          name: 'Connections sum: Waiting'
          type: DEPENDENT
          key: pgsql.connections.sum.waiting
          description: |
            Total number of waiting connections:
            https://www.postgresql.org/docs/current/monitoring-stats.html#WAIT-EVENT-TABLE
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.waiting
          master_item:
            key: 'pgsql.connections["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: connections
        - uuid: 52d9d2342b9c40a2b279dcbe4bcff023
          name: 'Get connections sum'
          type: ZABBIX_ACTIVE
          key: 'pgsql.connections["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          history: '0'
          value_type: TEXT
          description: |
            Collect all metrics from pg_stat_activity:
            https://www.postgresql.org/docs/current/monitoring-stats.html#PG-STAT-ACTIVITY-VIEW
          tags:
            - tag: component
              value: raw
        - uuid: defcba230619484db1a7d6faace8b33d
          name: 'Custom queries'
          type: ZABBIX_ACTIVE
          key: 'pgsql.custom.query["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}",""]'
          history: 1h
          value_type: TEXT
          status: DISABLED
          description: 'Execute custom queries from file *.sql (check for option Plugins.Postgres.CustomQueriesPath at agent configuration).'
          tags:
            - tag: component
              value: application
        - uuid: dbdeb7a7fc9f4187b29fb0dae2f2af62
          name: 'Dbstat: Hit blocks read per second'
          type: DEPENDENT
          key: pgsql.dbstat.sum.blks_hit.rate
          value_type: FLOAT
          description: 'Number of times per second disk blocks were found already in the buffer cache'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.blks_hit
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.dbstat.sum["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: cache
        - uuid: 136db4803969403ebf2fdb97e1e3b1ec
          name: 'Dbstat: Disk blocks read per second'
          type: DEPENDENT
          key: pgsql.dbstat.sum.blks_read.rate
          value_type: FLOAT
          description: 'Number of disk blocks read per second.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.blks_read
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.dbstat.sum["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: storage
        - uuid: badd110db2c64debb5619819299d7d47
          name: 'Dbstat: Blocks read time'
          type: DEPENDENT
          key: pgsql.dbstat.sum.blk_read_time
          value_type: FLOAT
          units: s
          description: 'Time spent reading data file blocks by backends.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.blk_read_time
            - type: MULTIPLIER
              parameters:
                - '0.001'
          master_item:
            key: 'pgsql.dbstat.sum["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: storage
        - uuid: 310219edd25c45b19ca7ee9e3621331a
          name: 'Dbstat: Blocks write time'
          type: DEPENDENT
          key: pgsql.dbstat.sum.blk_write_time
          value_type: FLOAT
          units: s
          description: 'Time spent writing data file blocks by backends.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.blk_write_time
            - type: MULTIPLIER
              parameters:
                - '0.001'
          master_item:
            key: 'pgsql.dbstat.sum["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: storage
        - uuid: f59fe2b665c94405b82bbc523aff1988
          name: 'Dbstat: Checksum failures per second'
          type: DEPENDENT
          key: pgsql.dbstat.sum.checksum_failures.rate
          value_type: FLOAT
          description: 'Number of data page checksum failures per second detected (or on a shared object), or NULL if data checksums are not enabled. This metric is available since PostgreSQL 12.'
          valuemap:
            name: 'PostgreSQL checksum failure status'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.checksum_failures
            - type: MATCHES_REGEX
              parameters:
                - '^\d*$'
              error_handler: CUSTOM_VALUE
              error_handler_params: '-2'
            - type: CHANGE_PER_SECOND
              error_handler: CUSTOM_VALUE
              error_handler_params: '-1'
          master_item:
            key: 'pgsql.dbstat.sum["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: system
          triggers:
            - uuid: 15357041a8774ae19a6cfa64154a4395
              expression: 'last(/PostgreSQL by Zabbix agent 2 active/pgsql.dbstat.sum.checksum_failures.rate)>0'
              name: 'PostgreSQL: Dbstat: Checksum failures detected'
              priority: AVERAGE
              description: |
                Data page checksum failures were detected on that DB instance:
                https://www.postgresql.org/docs/current/checksums.html
              tags:
                - tag: scope
                  value: availability
        - uuid: e53fc92d8d4b4f8690901f4eb736ca8a
          name: 'Dbstat: Conflicts per second'
          type: DEPENDENT
          key: pgsql.dbstat.sum.conflicts.rate
          value_type: FLOAT
          description: 'Number of queries canceled per second due to conflicts with recovery (conflicts occur only on standby servers; see pg_stat_database_conflicts for details).'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.conflicts
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.dbstat.sum["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: queries
        - uuid: 5ffee9612e844f15bfb1869f9f139171
          name: 'Dbstat: Deadlocks per second'
          type: DEPENDENT
          key: pgsql.dbstat.sum.deadlocks.rate
          value_type: FLOAT
          description: 'Number of deadlocks detected per second.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.deadlocks
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.dbstat.sum["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: deadlocks
        - uuid: b7fecc03343045478e54f21a4406e793
          name: 'Dbstat: Backends connected'
          type: DEPENDENT
          key: pgsql.dbstat.sum.numbackends
          description: 'Number of connected backends.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.numbackends
          master_item:
            key: 'pgsql.dbstat.sum["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: backends
        - uuid: 1e95365a6e9c461aa7f09c407ecc7844
          name: 'Dbstat: Number temp bytes per second'
          type: DEPENDENT
          key: pgsql.dbstat.sum.temp_bytes.rate
          value_type: FLOAT
          units: b
          description: 'Total amount of data written per second to temporary files by queries.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.temp_bytes
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.dbstat.sum["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: storage
        - uuid: 848bf15ec1c840959c83eba95645a810
          name: 'Dbstat: Number temp files per second'
          type: DEPENDENT
          key: pgsql.dbstat.sum.temp_files.rate
          value_type: FLOAT
          description: 'Number of temporary files created by queries per second.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.temp_files
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.dbstat.sum["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: storage
        - uuid: db78e1e34e154bfca1e3fbc1fd1f0f20
          name: 'Dbstat: Rows deleted per second'
          type: DEPENDENT
          key: pgsql.dbstat.sum.tup_deleted.rate
          value_type: FLOAT
          description: 'Number of rows deleted by queries per second.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.tup_deleted
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.dbstat.sum["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: queries
        - uuid: 3a1d49dd854d442aa0cafbc8025a942c
          name: 'Dbstat: Rows fetched per second'
          type: DEPENDENT
          key: pgsql.dbstat.sum.tup_fetched.rate
          value_type: FLOAT
          description: 'Number of rows fetched by queries per second.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.tup_fetched
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.dbstat.sum["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: queries
        - uuid: fc3e55d1a7d147049715b064bdf234b0
          name: 'Dbstat: Rows inserted per second'
          type: DEPENDENT
          key: pgsql.dbstat.sum.tup_inserted.rate
          value_type: FLOAT
          description: 'Number of rows inserted by queries per second.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.tup_inserted
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.dbstat.sum["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: queries
        - uuid: a92bc6f9bbbb4bf5b8289568b89642c8
          name: 'Dbstat: Rows returned per second'
          type: DEPENDENT
          key: pgsql.dbstat.sum.tup_returned.rate
          value_type: FLOAT
          description: 'Number of rows returned by queries per second.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.tup_returned
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.dbstat.sum["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: queries
        - uuid: 9f8498a20db04822b0d03df4d8cb184e
          name: 'Dbstat: Rows updated per second'
          type: DEPENDENT
          key: pgsql.dbstat.sum.tup_updated.rate
          value_type: FLOAT
          description: 'Number of rows updated by queries per second.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.tup_updated
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.dbstat.sum["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: queries
        - uuid: fed4fd91cbf846929795b960266301b7
          name: 'Dbstat: Committed transactions per second'
          type: DEPENDENT
          key: pgsql.dbstat.sum.xact_commit.rate
          value_type: FLOAT
          description: 'Number of transactions that have been committed per second.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.xact_commit
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.dbstat.sum["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: transactions
        - uuid: e3337867025d4cd7bc4d26d663a4fc61
          name: 'Dbstat: Roll backed transactions per second'
          type: DEPENDENT
          key: pgsql.dbstat.sum.xact_rollback.rate
          value_type: FLOAT
          description: 'Number of transactions that have been rolled back per second.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.xact_rollback
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.dbstat.sum["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: transactions
        - uuid: 8d84c4ec8d05427f9da4b9a1904a0af4
          name: 'Get dbstat sum'
          type: ZABBIX_ACTIVE
          key: 'pgsql.dbstat.sum["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          history: '0'
          value_type: TEXT
          description: |
            Collect all metrics from pg_stat_database as sums for all databases:
            https://www.postgresql.org/docs/current/monitoring-stats.html#PG-STAT-DATABASE-VIEW
          tags:
            - tag: component
              value: raw
        - uuid: e36f2b3e33e2435d9b95472a7844a1a4
          name: 'Get dbstat'
          type: ZABBIX_ACTIVE
          key: 'pgsql.dbstat["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          history: '0'
          value_type: TEXT
          description: |
            Collect all metrics from pg_stat_database per database:
            https://www.postgresql.org/docs/current/monitoring-stats.html#PG-STAT-DATABASE-VIEW
          tags:
            - tag: component
              value: raw
        - uuid: df19db910015411996e25ea5b48f0742
          name: 'Get locks'
          type: ZABBIX_ACTIVE
          key: 'pgsql.locks["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          history: '0'
          value_type: TEXT
          description: |
            Collect all metrics from pg_locks per database:
            https://www.postgresql.org/docs/current/explicit-locking.html#LOCKING-TABLES
          tags:
            - tag: component
              value: raw
        - uuid: 1a32b0308496460b83ad2698edb21420
          name: 'Age of oldest xid'
          type: ZABBIX_ACTIVE
          key: 'pgsql.oldest.xid["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          value_type: FLOAT
          description: 'Age of oldest xid.'
          tags:
            - tag: component
              value: transactions
          triggers:
            - uuid: 233757fda5784d9fb264bd0d4a7765ac
              expression: 'last(/PostgreSQL by Zabbix agent 2 active/pgsql.oldest.xid["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]) > 18000000'
              name: 'PostgreSQL: Oldest xid is too big'
              priority: AVERAGE
              tags:
                - tag: scope
                  value: availability
        - uuid: 52edd592df6f49df9bf46b5e93689a1a
          name: Ping
          type: ZABBIX_ACTIVE
          key: 'pgsql.ping["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          description: 'Used to test a connection to see if it is alive. It is set to 0 if the query is unsuccessful.'
          valuemap:
            name: 'Service state'
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          tags:
            - tag: component
              value: application
            - tag: component
              value: health
          triggers:
            - uuid: ab52bca5bae940cdad5b7eead56f2ff9
              expression: 'last(/PostgreSQL by Zabbix agent 2 active/pgsql.ping["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"])=0'
              name: 'PostgreSQL: Service is down'
              priority: HIGH
              description: 'Last test of a connection was unsuccessful.'
              tags:
                - tag: scope
                  value: availability
        - uuid: 060c0efaf60944538bf5fb6ca2828dc6
          name: 'Get queries'
          type: ZABBIX_ACTIVE
          key: 'pgsql.queries["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}","{$PG.QUERY_ETIME.MAX.WARN}"]'
          history: '0'
          value_type: TEXT
          description: 'Collect all metrics by query execution time.'
          tags:
            - tag: component
              value: raw
        - uuid: f15d0758764c4bd6b607335d9d57b76b
          name: 'Replication: Standby count'
          type: ZABBIX_ACTIVE
          key: 'pgsql.replication.count["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          description: 'Number of standby servers.'
          tags:
            - tag: component
              value: replication
        - uuid: a3297ef8198145848d4e3b16b7b8eb8b
          name: 'Replication: Lag in bytes'
          type: ZABBIX_ACTIVE
          key: 'pgsql.replication.lag.b["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          units: B
          description: 'Replication lag with master, in bytes.'
          tags:
            - tag: component
              value: replication
        - uuid: 142e93b332e24ecfbd50465bb4af91e7
          name: 'Replication: Lag in seconds'
          type: ZABBIX_ACTIVE
          key: 'pgsql.replication.lag.sec["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          units: s
          description: 'Replication lag with master, in seconds.'
          tags:
            - tag: component
              value: replication
        - uuid: aa03fb9cabd8459ea5f5efb90c9e1051
          name: 'Get replication'
          type: ZABBIX_ACTIVE
          key: 'pgsql.replication.process["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          history: '0'
          value_type: TEXT
          description: 'Collect metrics from the pg_stat_replication, which contains information about the WAL sender process, showing statistics about replication to that sender''s connected standby server.'
          tags:
            - tag: component
              value: raw
        - uuid: 226bcc226ffc487ba90d998a03692404
          name: 'Replication: Recovery role'
          type: ZABBIX_ACTIVE
          key: 'pgsql.replication.recovery_role["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          description: 'Replication role: 1 — recovery is still in progress (standby mode), 0 — master mode.'
          valuemap:
            name: 'PostgreSQL recovery role'
          tags:
            - tag: component
              value: replication
        - uuid: ef2ac5eaf73c40e09af41bba03b4fac8
          name: 'Replication: Status'
          type: ZABBIX_ACTIVE
          key: 'pgsql.replication.status["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          description: 'Replication status: 0 — streaming is down, 1 — streaming is up, 2 — master mode.'
          valuemap:
            name: 'PostgreSQL replication status'
          tags:
            - tag: component
              value: replication
        - uuid: 46b53fcf97a74619a03c2490fe9b71ea
          name: Uptime
          type: ZABBIX_ACTIVE
          key: 'pgsql.uptime["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          value_type: FLOAT
          units: uptime
          description: 'Time since the server started.'
          tags:
            - tag: component
              value: application
          triggers:
            - uuid: ec3d8fb289234e84b300b83ce169137f
              expression: 'last(/PostgreSQL by Zabbix agent 2 active/pgsql.uptime["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]) < 10m'
              name: 'PostgreSQL: Service has been restarted'
              event_name: 'PostgreSQL: Service has been restarted (uptime < 10m)'
              priority: AVERAGE
              description: 'PostgreSQL uptime is less than 10 minutes.'
              tags:
                - tag: scope
                  value: notice
        - uuid: 7a96feee8118450e83e994be87bc5eea
          name: Version
          type: ZABBIX_ACTIVE
          key: 'pgsql.version["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          delay: 15m
          value_type: CHAR
          description: 'PostgreSQL version.'
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1d
          tags:
            - tag: component
              value: application
          triggers:
            - uuid: 0d8c3bf10b4e42f796f72136768ce6ab
              expression: 'last(/PostgreSQL by Zabbix agent 2 active/pgsql.version["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"],#1)<>last(/PostgreSQL by Zabbix agent 2 active/pgsql.version["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"],#2) and length(last(/PostgreSQL by Zabbix agent 2 active/pgsql.version["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]))>0'
              name: 'PostgreSQL: Version has changed'
              event_name: 'PostgreSQL: Version has changed (new version value received: {ITEM.VALUE})'
              priority: INFO
              tags:
                - tag: scope
                  value: notice
        - uuid: 5fc77f9d1d1d46ed84d71dedaf30de75
          name: 'WAL: Segments count'
          type: DEPENDENT
          key: pgsql.wal.count
          description: 'Number of WAL segments.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.count
          master_item:
            key: 'pgsql.wal.stat["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: wal
        - uuid: 78f6cd549ecc417880df1851d8427722
          name: 'WAL: Bytes received'
          type: DEPENDENT
          key: pgsql.wal.receive
          units: B
          description: 'WAL receive, in bytes.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.receive
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.wal.stat["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: wal
        - uuid: cb2a0f990a39411e9d3c7d95cc7504ee
          name: 'Get WAL'
          type: ZABBIX_ACTIVE
          key: 'pgsql.wal.stat["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          delay: 5m
          history: '0'
          value_type: TEXT
          description: 'Collect write-ahead log (WAL) metrics.'
          tags:
            - tag: component
              value: raw
        - uuid: 492f311473f645f19b79f46d07c9950a
          name: 'WAL: Bytes written'
          type: DEPENDENT
          key: pgsql.wal.write
          units: B
          description: 'WAL write, in bytes.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.write
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.wal.stat["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: wal
      discovery_rules:
        - uuid: c5a95125be304bbeba407ce926ad7816
          name: 'Database discovery'
          type: ZABBIX_ACTIVE
          key: 'pgsql.db.discovery["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          delay: 1h
          filter:
            evaltype: AND
            conditions:
              - macro: '{#DBNAME}'
                value: '{$PG.LLD.FILTER.DBNAME}'
          description: |
            Discovers databases (DB) in the database management system (DBMS), except:
            - templates;
            - DBs that do not allow connections.
          item_prototypes:
            - uuid: 7df48c3384b14356903c38b3b0e1c435
              name: 'DB [{#DBNAME}]: Database age'
              type: ZABBIX_ACTIVE
              key: 'pgsql.db.age["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{#DBNAME}"]'
              delay: 10m
              description: 'Database age.'
              tags:
                - tag: component
                  value: application
                - tag: database
                  value: '{#DBNAME}'
            - uuid: cd5516d8ea994a9e86aff2081d611176
              name: 'DB [{#DBNAME}]: Bloating tables'
              type: ZABBIX_ACTIVE
              key: 'pgsql.db.bloating_tables["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{#DBNAME}"]'
              description: 'Number of bloating tables.'
              tags:
                - tag: component
                  value: tables
                - tag: database
                  value: '{#DBNAME}'
            - uuid: f2d58306483d4bb4a215e245f133b4ad
              name: 'DB [{#DBNAME}]: Database size'
              type: ZABBIX_ACTIVE
              key: 'pgsql.db.size["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{#DBNAME}"]'
              delay: 5m
              units: B
              description: 'Database size.'
              tags:
                - tag: component
                  value: storage
                - tag: database
                  value: '{#DBNAME}'
            - uuid: ce43087066804e828d8a64eb0cc13ac6
              name: 'DB [{#DBNAME}]: Blocks hit per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.blks_hit.rate["{#DBNAME}"]'
              value_type: FLOAT
              description: 'Total number of times per second disk blocks were found already in the buffer cache, so that a read was not necessary.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.blks_hit
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: cache
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 01d227b759d7404481e12e0daa90b3bb
              name: 'DB [{#DBNAME}]: Disk blocks read per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.blks_read.rate["{#DBNAME}"]'
              value_type: FLOAT
              description: 'Total number of disk blocks read per second in this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.blks_read
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: storage
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 1592dc3a802944cf8946bfee38652d44
              name: 'DB [{#DBNAME}]: Disk blocks read time per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.blk_read_time.rate["{#DBNAME}"]'
              value_type: FLOAT
              units: s
              description: 'Time spent reading data file blocks by backends per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.blk_read_time
                - type: MULTIPLIER
                  parameters:
                    - '0.001'
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: storage
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 491b9e40b3a243d6b22fb24124d98293
              name: 'DB [{#DBNAME}]: Disk blocks write time'
              type: DEPENDENT
              key: 'pgsql.dbstat.blk_write_time.rate["{#DBNAME}"]'
              value_type: FLOAT
              units: s
              description: 'Time spent writing data file blocks by backends per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.blk_write_time
                - type: MULTIPLIER
                  parameters:
                    - '0.001'
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: storage
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 9540fc8baf2c4b0b81e4d8eafe1f57cf
              name: 'DB [{#DBNAME}]: Checksum failures'
              type: DEPENDENT
              key: 'pgsql.dbstat.checksum_failures.rate["{#DBNAME}"]'
              value_type: FLOAT
              description: 'Number of data page checksum failures detected in this database.'
              valuemap:
                name: 'PostgreSQL checksum failure status'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.checksum_failures
                - type: MATCHES_REGEX
                  parameters:
                    - '^\d*$'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '-2'
                - type: CHANGE_PER_SECOND
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '-1'
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: system
                - tag: database
                  value: '{#DBNAME}'
              trigger_prototypes:
                - uuid: b0a2935d0a984233a530cf47d8fc606b
                  expression: 'last(/PostgreSQL by Zabbix agent 2 active/pgsql.dbstat.checksum_failures.rate["{#DBNAME}"])>0'
                  name: 'PostgreSQL: DB [{#DBNAME}]: Checksum failures detected'
                  priority: AVERAGE
                  description: |
                    Data page checksum failures were detected on that database:
                    https://www.postgresql.org/docs/current/checksums.html
                  tags:
                    - tag: scope
                      value: availability
            - uuid: 3e48cd0cf7214f77b8b6d9e76c1def00
              name: 'DB [{#DBNAME}]: Detected conflicts per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.conflicts.rate["{#DBNAME}"]'
              value_type: FLOAT
              description: 'Total number of queries canceled due to conflicts with recovery in this database per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.conflicts
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
              trigger_prototypes:
                - uuid: d156ed02bcad4123a827a3d7900bed1e
                  expression: 'min(/PostgreSQL by Zabbix agent 2 active/pgsql.dbstat.conflicts.rate["{#DBNAME}"],5m) > {$PG.CONFLICTS.MAX.WARN:"{#DBNAME}"}'
                  name: 'PostgreSQL: DB [{#DBNAME}]: Too many recovery conflicts'
                  event_name: 'PostgreSQL: DB [{#DBNAME}]: Too many recovery conflicts (over {$PG.CONFLICTS.MAX.WARN:"{#DBNAME}"} in 5m)'
                  priority: AVERAGE
                  description: |
                    The primary and standby servers are in many ways loosely connected. Actions on the primary will have an effect on the standby. As a result, there is potential for negative interactions or conflicts between them.
                    https://www.postgresql.org/docs/current/hot-standby.html#HOT-STANDBY-CONFLICT
                  tags:
                    - tag: scope
                      value: performance
            - uuid: 43aab996a12a49c582d46f96f999ab89
              name: 'DB [{#DBNAME}]: Detected deadlocks per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.deadlocks.rate["{#DBNAME}"]'
              value_type: FLOAT
              description: 'Total number of detected deadlocks in this database per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.deadlocks
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: deadlocks
                - tag: database
                  value: '{#DBNAME}'
              trigger_prototypes:
                - uuid: d188109b522b4ff896ed08fb04cf5f9d
                  expression: 'min(/PostgreSQL by Zabbix agent 2 active/pgsql.dbstat.deadlocks.rate["{#DBNAME}"],5m) > {$PG.DEADLOCKS.MAX.WARN:"{#DBNAME}"}'
                  name: 'PostgreSQL: DB [{#DBNAME}]: Deadlock occurred'
                  event_name: 'PostgreSQL: DB [{#DBNAME}]: Deadlock occurred (over {$PG.DEADLOCKS.MAX.WARN:"{#DBNAME}"} in 5m)'
                  priority: HIGH
                  description: 'Number of deadlocks detected per second exceeds {$PG.DEADLOCKS.MAX.WARN:"{#DBNAME}"} for 5m.'
                  tags:
                    - tag: scope
                      value: availability
            - uuid: 02c15c6f80e644269e14e5047f07efb1
              name: 'DB [{#DBNAME}]: Get dbstat'
              type: DEPENDENT
              key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              history: '0'
              value_type: TEXT
              description: 'Get dbstat metrics for database "{#DBNAME}".'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$[''{#DBNAME}'']'
                  error_handler: DISCARD_VALUE
              master_item:
                key: 'pgsql.dbstat["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
              tags:
                - tag: component
                  value: raw
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 2e8648e519524533b430bdf863561ba4
              name: 'DB [{#DBNAME}]: Backends connected'
              type: DEPENDENT
              key: 'pgsql.dbstat.numbackends["{#DBNAME}"]'
              description: 'Number of backends currently connected to this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.numbackends
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: backends
                - tag: database
                  value: '{#DBNAME}'
            - uuid: d2a01165e7c24969b26cdebe42f53c39
              name: 'DB [{#DBNAME}]: Temp_bytes written per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.temp_bytes.rate["{#DBNAME}"]'
              units: B
              description: 'Total amount of data written to temporary files by queries in this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.temp_bytes
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: storage
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 74dc57aaeba74b599cda10817961d5da
              name: 'DB [{#DBNAME}]: Temp_files created per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.temp_files.rate["{#DBNAME}"]'
              description: 'Total number of temporary files created by queries in this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.temp_files
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: storage
                - tag: database
                  value: '{#DBNAME}'
            - uuid: ec42f02be51b49789d1ad1fc3d636be4
              name: 'DB [{#DBNAME}]: Tuples deleted per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.tup_deleted.rate["{#DBNAME}"]'
              value_type: FLOAT
              description: 'Total number of rows deleted by queries in this database per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.tup_deleted
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
            - uuid: ffa697ab71734806aac1102c7d133521
              name: 'DB [{#DBNAME}]: Tuples fetched per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.tup_fetched.rate["{#DBNAME}"]'
              value_type: FLOAT
              description: 'Total number of rows fetched by queries in this database per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.tup_fetched
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 8fe771d00b5648758c0d568cb1d7b207
              name: 'DB [{#DBNAME}]: Tuples inserted per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.tup_inserted.rate["{#DBNAME}"]'
              value_type: FLOAT
              description: 'Total number of rows inserted by queries in this database per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.tup_inserted
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
            - uuid: aeb15898d242406393108df7bfd52881
              name: 'DB [{#DBNAME}]: Tuples returned per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.tup_returned.rate["{#DBNAME}"]'
              value_type: FLOAT
              description: 'Number of rows returned by queries in this database per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.tup_returned
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 22dee9fb2db8478caf1fd83f415414ef
              name: 'DB [{#DBNAME}]: Tuples updated per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.tup_updated.rate["{#DBNAME}"]'
              value_type: FLOAT
              description: 'Total number of rows updated by queries in this database per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.tup_updated
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 2bfdd988bca74df5a31dbf3727aa10a0
              name: 'DB [{#DBNAME}]: Commits per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.xact_commit.rate["{#DBNAME}"]'
              value_type: FLOAT
              description: 'Number of transactions in this database that have been committed per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.xact_commit
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: transactions
                - tag: database
                  value: '{#DBNAME}'
            - uuid: b7edf603e83a48bca580e932fc87c5cf
              name: 'DB [{#DBNAME}]: Rollbacks per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.xact_rollback.rate["{#DBNAME}"]'
              value_type: FLOAT
              description: 'Total number of transactions in this database that have been rolled back.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.xact_rollback
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: transactions
                - tag: database
                  value: '{#DBNAME}'
            - uuid: af381c8bd21c4189b6b8230325c97358
              name: 'DB [{#DBNAME}]: Num of accessexclusive locks'
              type: DEPENDENT
              key: 'pgsql.locks.accessexclusive["{#DBNAME}"]'
              description: 'Number of accessexclusive locks for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.accessexclusive
              master_item:
                key: 'pgsql.locks.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: locks
                - tag: database
                  value: '{#DBNAME}'
            - uuid: fe133b91b9a3474ab5ed12055c277969
              name: 'DB [{#DBNAME}]: Num of accessshare locks'
              type: DEPENDENT
              key: 'pgsql.locks.accessshare["{#DBNAME}"]'
              description: 'Number of accessshare locks for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.accessshare
              master_item:
                key: 'pgsql.locks.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: locks
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 3a28968abd5945cebb1157ae74e2de7d
              name: 'DB [{#DBNAME}]: Num of exclusive locks'
              type: DEPENDENT
              key: 'pgsql.locks.exclusive["{#DBNAME}"]'
              description: 'Number of exclusive locks for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.exclusive
              master_item:
                key: 'pgsql.locks.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: locks
                - tag: database
                  value: '{#DBNAME}'
            - uuid: ce03b994ad894100a11816b043d84c23
              name: 'DB [{#DBNAME}]: Get locks'
              type: DEPENDENT
              key: 'pgsql.locks.get_metrics["{#DBNAME}"]'
              history: '0'
              value_type: TEXT
              description: 'Get locks metrics for database "{#DBNAME}".'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$[''{#DBNAME}'']'
                  error_handler: DISCARD_VALUE
              master_item:
                key: 'pgsql.locks["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
              tags:
                - tag: component
                  value: raw
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 8bb0fe1e02ef4ad19f4367dbc67e9bc0
              name: 'DB [{#DBNAME}]: Num of rowexclusive locks'
              type: DEPENDENT
              key: 'pgsql.locks.rowexclusive["{#DBNAME}"]'
              description: 'Number of rowexclusive locks for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.rowexclusive
              master_item:
                key: 'pgsql.locks.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: locks
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 9821b111e1e741a592c962c503129eae
              name: 'DB [{#DBNAME}]: Num of rowshare locks'
              type: DEPENDENT
              key: 'pgsql.locks.rowshare["{#DBNAME}"]'
              description: 'Number of rowshare locks for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.rowshare
                  error_handler: DISCARD_VALUE
              master_item:
                key: 'pgsql.locks.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: locks
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 94b2491b18d74345b5bd33a523049cbf
              name: 'DB [{#DBNAME}]: Num of sharerowexclusive locks'
              type: DEPENDENT
              key: 'pgsql.locks.sharerowexclusive["{#DBNAME}"]'
              description: 'Number of total sharerowexclusive for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.sharerowexclusive
              master_item:
                key: 'pgsql.locks.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: locks
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 888f4f0f47b54d708d87b22efa25f0e5
              name: 'DB [{#DBNAME}]: Num of shareupdateexclusive locks'
              type: DEPENDENT
              key: 'pgsql.locks.shareupdateexclusive["{#DBNAME}"]'
              description: 'Number of shareupdateexclusive locks for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.shareupdateexclusive
              master_item:
                key: 'pgsql.locks.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: locks
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 70abd9b269f94310875c1777c089741b
              name: 'DB [{#DBNAME}]: Num of share locks'
              type: DEPENDENT
              key: 'pgsql.locks.share["{#DBNAME}"]'
              description: 'Number of share locks for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.share
              master_item:
                key: 'pgsql.locks.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: locks
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 19d118b8a99845ef8d2eaaa5ec38f50d
              name: 'DB [{#DBNAME}]: Num of locks total'
              type: DEPENDENT
              key: 'pgsql.locks.total["{#DBNAME}"]'
              description: 'Total number of locks in this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.total
              master_item:
                key: 'pgsql.locks.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: locks
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 15cf79b8fafa442a80a10368f5b5962d
              name: 'DB [{#DBNAME}]: Get queries'
              type: DEPENDENT
              key: 'pgsql.queries.get_metrics["{#DBNAME}"]'
              history: '0'
              value_type: TEXT
              description: 'Get queries metrics for database "{#DBNAME}".'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$[''{#DBNAME}'']'
                  error_handler: DISCARD_VALUE
              master_item:
                key: 'pgsql.queries["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}","{$PG.QUERY_ETIME.MAX.WARN}"]'
              tags:
                - tag: component
                  value: raw
                - tag: database
                  value: '{#DBNAME}'
            - uuid: f8c0e60c70d14103b39b1a6218093c0a
              name: 'DB [{#DBNAME}]: Queries slow maintenance count'
              type: DEPENDENT
              key: 'pgsql.queries.mro.slow_count["{#DBNAME}"]'
              description: 'Slow maintenance query count for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.mro_slow_count
              master_item:
                key: 'pgsql.queries.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 8d16b715b12648f5b5dca0f80857e46e
              name: 'DB [{#DBNAME}]: Queries max maintenance time'
              type: DEPENDENT
              key: 'pgsql.queries.mro.time_max["{#DBNAME}"]'
              units: s
              description: 'Max maintenance query time for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.mro_time_max
              master_item:
                key: 'pgsql.queries.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
            - uuid: af2c1c09b2a04911b2e6e892d1051e94
              name: 'DB [{#DBNAME}]: Queries sum maintenance time'
              type: DEPENDENT
              key: 'pgsql.queries.mro.time_sum["{#DBNAME}"]'
              units: s
              description: 'Sum maintenance query time for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.mro_time_sum
              master_item:
                key: 'pgsql.queries.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
            - uuid: bd070ec5cbcf42a7a2dfa56dd3eca7a3
              name: 'DB [{#DBNAME}]: Queries slow query count'
              type: DEPENDENT
              key: 'pgsql.queries.query.slow_count["{#DBNAME}"]'
              description: 'Slow query count for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.query_slow_count
              master_item:
                key: 'pgsql.queries.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
              trigger_prototypes:
                - uuid: be059c5eb7b6442b8312ef58b2bc55cc
                  expression: 'min(/PostgreSQL by Zabbix agent 2 active/pgsql.queries.query.slow_count["{#DBNAME}"],5m)>{$PG.SLOW_QUERIES.MAX.WARN:"{#DBNAME}"}'
                  name: 'PostgreSQL: DB [{#DBNAME}]: Too many slow queries'
                  event_name: 'PostgreSQL: DB [{#DBNAME}]: Too many slow queries (over {$PG.SLOW_QUERIES.MAX.WARN:"{#DBNAME}"} in 5m)'
                  priority: WARNING
                  description: 'The number of detected slow queries exceeds the limit of {$PG.SLOW_QUERIES.MAX.WARN:"{#DBNAME}"}.'
                  tags:
                    - tag: scope
                      value: performance
            - uuid: 827abbb549b640f28a7984ba157de73e
              name: 'DB [{#DBNAME}]: Queries max query time'
              type: DEPENDENT
              key: 'pgsql.queries.query.time_max["{#DBNAME}"]'
              units: s
              description: 'Max query time for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.query_time_max
              master_item:
                key: 'pgsql.queries.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 93a773701de54ce3a3af3d651167c0a9
              name: 'DB [{#DBNAME}]: Queries sum query time'
              type: DEPENDENT
              key: 'pgsql.queries.query.time_sum["{#DBNAME}"]'
              units: s
              description: 'Sum query time for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.query_time_sum
              master_item:
                key: 'pgsql.queries.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
            - uuid: ee6fb28b33424ffab8e336280cfe5d7e
              name: 'DB [{#DBNAME}]: Queries slow transaction count'
              type: DEPENDENT
              key: 'pgsql.queries.tx.slow_count["{#DBNAME}"]'
              description: 'Slow transaction query count for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.tx_slow_count
              master_item:
                key: 'pgsql.queries.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 73c67fc53f944fb6a15c0e0776ba4cf3
              name: 'DB [{#DBNAME}]: Queries max transaction time'
              type: DEPENDENT
              key: 'pgsql.queries.tx.time_max["{#DBNAME}"]'
              units: s
              description: 'Max transaction query time for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.tx_time_max
              master_item:
                key: 'pgsql.queries.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 62771b2b28f94f93b54ea5e31f336938
              name: 'DB [{#DBNAME}]: Queries sum transaction time'
              type: DEPENDENT
              key: 'pgsql.queries.tx.time_sum["{#DBNAME}"]'
              units: s
              description: 'Sum transaction query time for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.tx_time_sum
              master_item:
                key: 'pgsql.queries.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
          graph_prototypes:
            - uuid: 2c0fea3adf254d41b123fb69202c51fe
              name: 'DB [{#DBNAME}]: Locks'
              graph_items:
                - drawtype: GRADIENT_LINE
                  color: 199C0D
                  item:
                    host: 'PostgreSQL by Zabbix agent 2 active'
                    key: 'pgsql.locks.total["{#DBNAME}"]'
                - sortorder: '1'
                  color: F63100
                  item:
                    host: 'PostgreSQL by Zabbix agent 2 active'
                    key: 'pgsql.locks.accessexclusive["{#DBNAME}"]'
                - sortorder: '2'
                  color: 00611C
                  item:
                    host: 'PostgreSQL by Zabbix agent 2 active'
                    key: 'pgsql.locks.accessshare["{#DBNAME}"]'
                - sortorder: '3'
                  color: F7941D
                  item:
                    host: 'PostgreSQL by Zabbix agent 2 active'
                    key: 'pgsql.locks.exclusive["{#DBNAME}"]'
                - sortorder: '4'
                  color: FC6EA3
                  item:
                    host: 'PostgreSQL by Zabbix agent 2 active'
                    key: 'pgsql.locks.rowexclusive["{#DBNAME}"]'
                - sortorder: '5'
                  color: 6C59DC
                  item:
                    host: 'PostgreSQL by Zabbix agent 2 active'
                    key: 'pgsql.locks.rowshare["{#DBNAME}"]'
                - sortorder: '6'
                  color: C7A72D
                  item:
                    host: 'PostgreSQL by Zabbix agent 2 active'
                    key: 'pgsql.locks.sharerowexclusive["{#DBNAME}"]'
                - sortorder: '7'
                  color: BA2A5D
                  item:
                    host: 'PostgreSQL by Zabbix agent 2 active'
                    key: 'pgsql.locks.shareupdateexclusive["{#DBNAME}"]'
                - sortorder: '8'
                  color: F230E0
                  item:
                    host: 'PostgreSQL by Zabbix agent 2 active'
                    key: 'pgsql.locks.share["{#DBNAME}"]'
            - uuid: 96144801ca8a4c02ac88c49f0fb4eb7c
              name: 'DB [{#DBNAME}]: Number of bloating tables'
              graph_items:
                - drawtype: GRADIENT_LINE
                  color: 199C0D
                  item:
                    host: 'PostgreSQL by Zabbix agent 2 active'
                    key: 'pgsql.db.bloating_tables["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{#DBNAME}"]'
            - uuid: 55268d2bc7224902836b8ec683b82865
              name: 'DB [{#DBNAME}]: pg_stat_database metrics'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'PostgreSQL by Zabbix agent 2 active'
                    key: 'pgsql.dbstat.blks_hit.rate["{#DBNAME}"]'
                - sortorder: '1'
                  color: F63100
                  item:
                    host: 'PostgreSQL by Zabbix agent 2 active'
                    key: 'pgsql.dbstat.blks_read.rate["{#DBNAME}"]'
                - sortorder: '2'
                  color: 00611C
                  item:
                    host: 'PostgreSQL by Zabbix agent 2 active'
                    key: 'pgsql.dbstat.conflicts.rate["{#DBNAME}"]'
                - sortorder: '3'
                  color: F7941D
                  item:
                    host: 'PostgreSQL by Zabbix agent 2 active'
                    key: 'pgsql.dbstat.deadlocks.rate["{#DBNAME}"]'
                - sortorder: '4'
                  color: FC6EA3
                  item:
                    host: 'PostgreSQL by Zabbix agent 2 active'
                    key: 'pgsql.dbstat.temp_bytes.rate["{#DBNAME}"]'
                - sortorder: '5'
                  color: 6C59DC
                  item:
                    host: 'PostgreSQL by Zabbix agent 2 active'
                    key: 'pgsql.dbstat.temp_files.rate["{#DBNAME}"]'
                - sortorder: '6'
                  color: C7A72D
                  item:
                    host: 'PostgreSQL by Zabbix agent 2 active'
                    key: 'pgsql.dbstat.tup_deleted.rate["{#DBNAME}"]'
                - sortorder: '7'
                  color: BA2A5D
                  item:
                    host: 'PostgreSQL by Zabbix agent 2 active'
                    key: 'pgsql.dbstat.tup_fetched.rate["{#DBNAME}"]'
                - sortorder: '8'
                  color: F230E0
                  item:
                    host: 'PostgreSQL by Zabbix agent 2 active'
                    key: 'pgsql.dbstat.tup_inserted.rate["{#DBNAME}"]'
                - sortorder: '9'
                  color: 5CCD18
                  item:
                    host: 'PostgreSQL by Zabbix agent 2 active'
                    key: 'pgsql.dbstat.tup_returned.rate["{#DBNAME}"]'
                - sortorder: '10'
                  color: BB2A02
                  item:
                    host: 'PostgreSQL by Zabbix agent 2 active'
                    key: 'pgsql.dbstat.tup_updated.rate["{#DBNAME}"]'
                - sortorder: '11'
                  color: AC41A5
                  item:
                    host: 'PostgreSQL by Zabbix agent 2 active'
                    key: 'pgsql.dbstat.xact_commit.rate["{#DBNAME}"]'
                - sortorder: '12'
                  color: 89ABF8
                  item:
                    host: 'PostgreSQL by Zabbix agent 2 active'
                    key: 'pgsql.dbstat.xact_rollback.rate["{#DBNAME}"]'
            - uuid: 7d0246026bae4e6680f19626fba2bc02
              name: 'DB [{#DBNAME}]: Queries'
              ymin_type_1: FIXED
              graph_items:
                - color: 199C0D
                  yaxisside: RIGHT
                  item:
                    host: 'PostgreSQL by Zabbix agent 2 active'
                    key: 'pgsql.queries.mro.time_max["{#DBNAME}"]'
                - sortorder: '1'
                  color: F63100
                  yaxisside: RIGHT
                  item:
                    host: 'PostgreSQL by Zabbix agent 2 active'
                    key: 'pgsql.queries.query.time_max["{#DBNAME}"]'
                - sortorder: '2'
                  color: 00611C
                  yaxisside: RIGHT
                  item:
                    host: 'PostgreSQL by Zabbix agent 2 active'
                    key: 'pgsql.queries.tx.time_max["{#DBNAME}"]'
                - sortorder: '3'
                  drawtype: GRADIENT_LINE
                  color: F7941D
                  item:
                    host: 'PostgreSQL by Zabbix agent 2 active'
                    key: 'pgsql.queries.mro.time_sum["{#DBNAME}"]'
                - sortorder: '4'
                  drawtype: GRADIENT_LINE
                  color: FC6EA3
                  item:
                    host: 'PostgreSQL by Zabbix agent 2 active'
                    key: 'pgsql.queries.query.time_sum["{#DBNAME}"]'
                - sortorder: '5'
                  drawtype: GRADIENT_LINE
                  color: 6C59DC
                  item:
                    host: 'PostgreSQL by Zabbix agent 2 active'
                    key: 'pgsql.queries.tx.time_sum["{#DBNAME}"]'
            - uuid: 9a4b7b68ae0f4291a970e3e1838368c6
              name: 'DB [{#DBNAME}]: Size'
              graph_items:
                - drawtype: GRADIENT_LINE
                  color: 199C0D
                  item:
                    host: 'PostgreSQL by Zabbix agent 2 active'
                    key: 'pgsql.db.size["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{#DBNAME}"]'
            - uuid: 31c3e16c49ba486db9f6f92714d927b6
              name: 'DB [{#DBNAME}]: Slow queries'
              ymin_type_1: FIXED
              graph_items:
                - color: 199C0D
                  item:
                    host: 'PostgreSQL by Zabbix agent 2 active'
                    key: 'pgsql.queries.mro.slow_count["{#DBNAME}"]'
                - sortorder: '1'
                  color: F63100
                  item:
                    host: 'PostgreSQL by Zabbix agent 2 active'
                    key: 'pgsql.queries.query.slow_count["{#DBNAME}"]'
                - sortorder: '2'
                  color: 00611C
                  item:
                    host: 'PostgreSQL by Zabbix agent 2 active'
                    key: 'pgsql.queries.tx.slow_count["{#DBNAME}"]'
        - uuid: 92ba6c1b038a454d8d8d40399d0967d8
          name: 'Replication discovery'
          type: ZABBIX_ACTIVE
          key: 'pgsql.replication.process.discovery["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          delay: 15m
          filter:
            evaltype: AND
            conditions:
              - macro: '{#APPLICATION_NAME}'
                value: '{$PG.LLD.FILTER.APPLICATION}'
          description: 'Discovers replication lag metrics.'
          item_prototypes:
            - uuid: 7d994bb6b0de4f76810e4beaf9c6318c
              name: 'Application [{#APPLICATION_NAME}]: Get replication'
              type: DEPENDENT
              key: 'pgsql.replication.get_metrics["{#APPLICATION_NAME}"]'
              history: '0'
              value_type: TEXT
              description: 'Collect metrics from the "pg_stat_replication" about the application "{#APPLICATION_NAME}" that is connected to this WAL sender, which contains information about the WAL sender process, showing statistics about replication to that sender''s connected standby server.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$[''{#APPLICATION_NAME}'']'
                  error_handler: DISCARD_VALUE
              master_item:
                key: 'pgsql.replication.process["{$PG.CONNSTRING.AGENT2}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
              tags:
                - tag: application
                  value: '{#APPLICATION_NAME}'
                - tag: component
                  value: raw
            - uuid: 33541a2ce9894c71aef710d1e227dab2
              name: 'Application [{#APPLICATION_NAME}]: Replication flush lag'
              type: DEPENDENT
              key: 'pgsql.replication.process.flush_lag["{#APPLICATION_NAME}"]'
              value_type: FLOAT
              units: s
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.flush_lag
              master_item:
                key: 'pgsql.replication.get_metrics["{#APPLICATION_NAME}"]'
              tags:
                - tag: application
                  value: '{#APPLICATION_NAME}'
                - tag: component
                  value: replication
            - uuid: 4ef7353e3b904f33ac2b592d5cbfba62
              name: 'Application [{#APPLICATION_NAME}]: Replication replay lag'
              type: DEPENDENT
              key: 'pgsql.replication.process.replay_lag["{#APPLICATION_NAME}"]'
              value_type: FLOAT
              units: s
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.replay_lag
              master_item:
                key: 'pgsql.replication.get_metrics["{#APPLICATION_NAME}"]'
              tags:
                - tag: application
                  value: '{#APPLICATION_NAME}'
                - tag: component
                  value: replication
            - uuid: 3beb600f296c4263b92434a46bd946cd
              name: 'Application [{#APPLICATION_NAME}]: Replication write lag'
              type: DEPENDENT
              key: 'pgsql.replication.process.write_lag["{#APPLICATION_NAME}"]'
              value_type: FLOAT
              units: s
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.write_lag
              master_item:
                key: 'pgsql.replication.get_metrics["{#APPLICATION_NAME}"]'
              tags:
                - tag: application
                  value: '{#APPLICATION_NAME}'
                - tag: component
                  value: replication
          graph_prototypes:
            - uuid: 3942169cc1eb4715a5f2ca0ee58c33df
              name: 'Application [{#APPLICATION_NAME}]: Replication lag'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'PostgreSQL by Zabbix agent 2 active'
                    key: 'pgsql.replication.process.flush_lag["{#APPLICATION_NAME}"]'
                - sortorder: '1'
                  color: F63100
                  item:
                    host: 'PostgreSQL by Zabbix agent 2 active'
                    key: 'pgsql.replication.process.replay_lag["{#APPLICATION_NAME}"]'
                - sortorder: '2'
                  color: 00611C
                  item:
                    host: 'PostgreSQL by Zabbix agent 2 active'
                    key: 'pgsql.replication.process.write_lag["{#APPLICATION_NAME}"]'
      tags:
        - tag: class
          value: database
        - tag: subclass
          value: sql
        - tag: target
          value: postgresql
      macros:
        - macro: '{$PG.CONFLICTS.MAX.WARN}'
          value: '0'
          description: 'Maximum number of recovery conflicts for trigger expression.'
          config:
            type: TEXT
            priority: '9'
            section_name: Thresholds
            label: 'Maximum number of recovery conflicts'
            description: 'Maximum number of recovery conflicts for trigger expression. No less than 0.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$PG.CONNSTRING.AGENT2}'
          value: 'tcp://localhost:5432'
          description: 'URI or named session of the PostgreSQL instance.'
          config:
            type: TEXT
            priority: '1'
            label: 'PostgreSQL connection string'
            description: 'URI or named session of the PostgreSQL instance.'
            required: 'YES'
        - macro: '{$PG.CONN_TOTAL_PCT.MAX.WARN}'
          value: '90'
          description: 'Maximum percentage of current connections for trigger expression.'
          config:
            type: TEXT
            priority: '8'
            section_name: Thresholds
            label: 'Maximum percentage of current connections'
            description: 'Maximum percentage of current connections for trigger expression. In the range from 0 to 100 inclusive.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$PG.DATABASE}'
          value: postgres
          description: 'Default PostgreSQL database for the connection.'
          config:
            type: TEXT
            priority: '4'
            label: 'Default PostgreSQL database for the connection'
            required: 'YES'
        - macro: '{$PG.DEADLOCKS.MAX.WARN}'
          value: '0'
          description: 'Maximum number of detected deadlocks for trigger expression.'
          config:
            type: TEXT
            priority: '7'
            section_name: Thresholds
            label: 'Maximum number of detected deadlocks'
            description: 'Maximum number of detected deadlocks for trigger expression. No less than 0.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$PG.LLD.FILTER.APPLICATION}'
          value: .+
          description: 'Filter of discoverable applications.'
          config:
            type: TEXT
            priority: '6'
            section_name: Filters
            label: 'Applications LLD filter'
            description: 'Filter of discoverable applications.'
        - macro: '{$PG.LLD.FILTER.DBNAME}'
          value: .+
          description: 'Filter of discoverable databases.'
          config:
            type: TEXT
            priority: '5'
            section_name: Filters
            label: 'Database name LLD filter'
            description: 'Filter of discoverable databases.'
        - macro: '{$PG.PASSWORD}'
          type: SECRET_TEXT
          description: 'PostgreSQL user password.'
          config:
            type: TEXT
            priority: '3'
            label: 'PostgreSQL user password'
            required: 'YES'
        - macro: '{$PG.QUERY_ETIME.MAX.WARN}'
          value: '30'
          description: 'Execution time limit for count of slow queries.'
          config:
            type: TEXT
            priority: '10'
            section_name: Thresholds
            label: 'Slow queries execution time threshold'
            description: 'Execution time threshold for queries to be considered slow. No less than 0.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$PG.SLOW_QUERIES.MAX.WARN}'
          value: '5'
          description: 'Slow queries count threshold for a trigger.'
          config:
            type: TEXT
            priority: '11'
            section_name: Thresholds
            label: 'Slow queries count threshold'
            description: 'Slow queries count threshold for a trigger. No less than 0.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$PG.USER}'
          value: zbx_monitor
          description: 'PostgreSQL username.'
          config:
            type: TEXT
            priority: '2'
            label: 'PostgreSQL username'
            required: 'YES'
      dashboards:
        - uuid: ee3e7ee2f7de495997f4749a23f00f48
          name: 'PostgreSQL databases'
          pages:
            - widgets:
                - type: graphprototype
                  width: '36'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'PostgreSQL by Zabbix agent 2 active'
                        name: 'DB [{#DBNAME}]: pg_stat_database metrics'
                    - type: STRING
                      name: reference
                      value: AAAAA
                - type: graphprototype
                  'y': '5'
                  width: '36'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'PostgreSQL by Zabbix agent 2 active'
                        name: 'DB [{#DBNAME}]: Size'
                    - type: STRING
                      name: reference
                      value: AAAAC
                - type: graphprototype
                  'y': '10'
                  width: '36'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'PostgreSQL by Zabbix agent 2 active'
                        name: 'DB [{#DBNAME}]: Queries'
                    - type: STRING
                      name: reference
                      value: AAAAE
                - type: graphprototype
                  x: '36'
                  width: '36'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'PostgreSQL by Zabbix agent 2 active'
                        name: 'DB [{#DBNAME}]: Locks'
                    - type: STRING
                      name: reference
                      value: AAAAB
                - type: graphprototype
                  x: '36'
                  'y': '5'
                  width: '36'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'PostgreSQL by Zabbix agent 2 active'
                        name: 'DB [{#DBNAME}]: Number of bloating tables'
                    - type: STRING
                      name: reference
                      value: AAAAD
                - type: graphprototype
                  x: '36'
                  'y': '10'
                  width: '36'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'PostgreSQL by Zabbix agent 2 active'
                        name: 'DB [{#DBNAME}]: Slow queries'
                    - type: STRING
                      name: reference
                      value: AAAAF
      valuemaps:
        - uuid: 9b9961c136c4426bb6d11c749cbb4cfa
          name: 'PostgreSQL checksum failure status'
          mappings:
            - value: '-2'
              newvalue: 'null'
        - uuid: bf1b2c09ce844d9c8b2735901fe77a03
          name: 'PostgreSQL recovery role'
          mappings:
            - value: '0'
              newvalue: Master
            - value: '1'
              newvalue: Standby
        - uuid: ee126cb6f7e14a93ae1e21106ee8732f
          name: 'PostgreSQL replication status'
          mappings:
            - value: '0'
              newvalue: Down
            - value: '1'
              newvalue: Up
            - value: '2'
              newvalue: Master
        - uuid: e11dca50f6e4481fa1fda75aeb71cf8c
          name: 'Service state'
          mappings:
            - value: '0'
              newvalue: Down
            - value: '1'
              newvalue: Up
    - uuid: 7005acc9123e4bc290805a3a16dab9cf
      template: 'PostgreSQL by Zabbix agent active'
      name: 'PostgreSQL by Zabbix agent active'
      description: |
        This template is designed for the deployment of PostgreSQL monitoring by Zabbix via Zabbix agent and uses user parameters to run SQL queries with the `psql` command-line tool.
        
        Note:
        - The template requires `pg_isready` and `psql` utilities to be installed on the same host with Zabbix agent.
        - The template requires files with SQL queries and user parameters that can be found in the Zabbix official repository:
        https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/db/postgresql?at=refs%2Fheads%2Frelease%2F6.0
        
        Setup:
        
        1. Deploy Zabbix agent and create the PostgreSQL user for monitoring (`<password>` at your discretion) with proper access rights to your PostgreSQL instance.
        
        For PostgreSQL version 10 and above:
        CREATE USER zbx_monitor WITH PASSWORD '<PASSWORD>' INHERIT;
        GRANT pg_monitor TO zbx_monitor;
        
        For PostgreSQL version 9.6 and below:
        CREATE USER zbx_monitor WITH PASSWORD '<PASSWORD>';
        GRANT SELECT ON pg_stat_database TO zbx_monitor;
        ALTER USER zbx_monitor WITH SUPERUSER;
        
        2. Copy the `postgresql/` directory to the `zabbix` user home directory - `/var/lib/zabbix/`. The `postgresql/` directory contains the files with SQL queries needed to obtain metrics from PostgreSQL instance.
        
        If the home directory of the `zabbix` user doesn't exist, create it first:
        mkdir -m u=rwx,g=rwx,o= -p /var/lib/zabbix
        chown zabbix:zabbix /var/lib/zabbix
        
        3. Copy the `template_db_postgresql.conf` file, containing user parameters, to the Zabbix agent configuration directory `/etc/zabbix/zabbix_agentd.d/` and restart Zabbix agent service.
        
        If you want to use SSL/TLS encryption to protect communications with the remote PostgreSQL instance, you can modify the connection string in user parameters. For example, to enable required encryption in transport mode without identity checks you could append `?sslmode=required` to the end of the connection string for all keys that use `psql`:
        UserParameter=pgsql.bgwriter[*], psql -qtAX postgresql://"$3":"$4"@"$1":"$2"/"$5"?sslmode=required -f "/var/lib/zabbix/postgresql/pgsql.bgwriter.sql"
        
        Consult the PostgreSQL documentation about protection modes (https://www.postgresql.org/docs/current/libpq-ssl.html#LIBPQ-SSL-PROTECTION) and client connection parameters (https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNECT-SSLMODE).
        
        Also, it is assumed that you set up the PostgreSQL instance to work in the desired encryption mode. Check the PostgreSQL documentation (https://www.postgresql.org/docs/current/ssl-tcp.html) for details.
        
        4. Edit the `pg_hba.conf` configuration file to allow connections for the user `zbx_monitor`. You can check the PostgreSQL documentation for examples (https://www.postgresql.org/docs/current/auth-pg-hba-conf.html).
        
        5. Specify the host name or IP address in the `{$PG.HOST}` macro. Adjust the port number with `{$PG.PORT}` macro if needed.
        
        6. Set the password that you specified in step 1 in the macro `{$PG.PASSWORD}`.
        
        You can discuss this template or leave feedback on our forum https://www.zabbix.com/forum/zabbix-suggestions-and-feedback/384190-%C2%A0discussion-thread-for-official-zabbix-template-db-postgresql
        
        Generated by official Zabbix template tool "Templator"
      wizard_ready: 'YES'
      readme: |
        ## Overview
        
        This template is designed for the deployment of PostgreSQL monitoring by Zabbix via Zabbix agent and uses user parameters to run SQL queries with the `psql` command-line tool.
        
        ## Setup
        
        **Note:**
        - The template requires `pg_isready` and `psql` utilities to be installed on the same host with Zabbix agent.
        
        1. Create the PostgreSQL user for monitoring (`<password>` at your discretion) with proper access rights to your PostgreSQL instance.
        
        For PostgreSQL version 10 and above:
        
        ```sql
        CREATE USER zbx_monitor WITH PASSWORD '<PASSWORD>' INHERIT;
        GRANT pg_monitor TO zbx_monitor;
        ```
        
        For PostgreSQL version 9.6 and below:
        
        ```sql
        CREATE USER zbx_monitor WITH PASSWORD '<PASSWORD>';
        GRANT SELECT ON pg_stat_database TO zbx_monitor;
        
        -- To collect WAL metrics, the user must have a `superuser` role.
        ALTER USER zbx_monitor WITH SUPERUSER;
        ```
        
        2. Copy the `postgresql/` directory to the `zabbix` user home directory - `/var/lib/zabbix/`. The `postgresql/` directory contains the files with SQL queries needed to obtain metrics from PostgreSQL instance.
        
        If the home directory of the `zabbix` user doesn't exist, create it first:
        
        ```bash
        mkdir -m u=rwx,g=rwx,o= -p /var/lib/zabbix
        chown zabbix:zabbix /var/lib/zabbix
        ```
        
        3. Copy the `template_db_postgresql.conf` file, containing user parameters, to the Zabbix agent configuration directory `/etc/zabbix/zabbix_agentd.d/` and restart Zabbix agent service.
        
        **Note:** if you want to use SSL/TLS encryption to protect communications with the remote PostgreSQL instance, you can modify the connection string in user parameters. For example, to enable required encryption in transport mode without identity checks you could append `?sslmode=required` to the end of the connection string for all keys that use `psql`:
        
        ```bash
        UserParameter=pgsql.bgwriter[*], psql -qtAX postgresql://"$3":"$4"@"$1":"$2"/"$5"?sslmode=required -f "/var/lib/zabbix/postgresql/pgsql.bgwriter.sql"
        ```
        
        Consult the PostgreSQL documentation about [`protection modes`](https://www.postgresql.org/docs/current/libpq-ssl.html#LIBPQ-SSL-PROTECTION) and [`client connection parameters`](https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNECT-SSLMODE).
        
        Also, it is assumed that you set up the PostgreSQL instance to work in the desired encryption mode. Check the [`PostgreSQL documentation`](https://www.postgresql.org/docs/current/ssl-tcp.html) for details.
        
        4. Edit the `pg_hba.conf` configuration file to allow connections for the user `zbx_monitor`. For example, you could add one of the following rows to allow local TCP connections from the same host:
        
        ```bash
        # TYPE  DATABASE        USER            ADDRESS                 METHOD
          host       all        zbx_monitor     localhost               trust
          host       all        zbx_monitor     127.0.0.1/32            md5
          host       all        zbx_monitor     ::1/128                 scram-sha-256
        ```
        
        For more information please read the PostgreSQL documentation `https://www.postgresql.org/docs/current/auth-pg-hba-conf.html`.
        
        5. Specify the host name or IP address in the `PostgreSQL host` host wizard configuration field. Adjust the port number in the `PostgreSQL port` field if needed.
        
        6. Set the password that you specified in step 1 in the `PostgreSQL user password` field.
      vendor:
        name: Zabbix
        version: 8.0-0
      groups:
        - name: Templates/Databases
      items:
        - uuid: d469ec16aa434e3e82695d143abe479a
          name: 'Bgwriter: Buffers allocated per second'
          type: DEPENDENT
          key: pgsql.bgwriter.buffers_alloc.rate
          value_type: FLOAT
          description: 'Number of buffers allocated per second.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.buffers_alloc
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.bgwriter["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: bgwriter
        - uuid: 511c3b3b363f43dd93746b3e0dad0f07
          name: 'Bgwriter: Buffers written directly by a backend per second'
          type: DEPENDENT
          key: pgsql.bgwriter.buffers_backend.rate
          value_type: FLOAT
          description: 'Number of buffers written directly by a backend per second. Available in PostgreSQL versions prior to 17.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.buffers_backend
              error_handler: DISCARD_VALUE
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.bgwriter["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: bgwriter
        - uuid: 19795654aab941db8a95b092dda58737
          name: 'Bgwriter: Times a backend executed its own fsync per second'
          type: DEPENDENT
          key: pgsql.bgwriter.buffers_backend_fsync.rate
          value_type: FLOAT
          description: 'Number of times a backend had to execute its own fsync call per second (normally the background writer handles those even when the backend does its own write). Available in PostgreSQL versions prior to 17.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.buffers_backend_fsync
              error_handler: DISCARD_VALUE
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.bgwriter["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: bgwriter
        - uuid: a366775a3079422184cfac96f34173d6
          name: 'Checkpoint: Buffers written during checkpoints per second'
          type: DEPENDENT
          key: pgsql.bgwriter.buffers_checkpoint.rate
          value_type: FLOAT
          description: 'Number of buffers written during checkpoints per second.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.buffers_checkpoint
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.bgwriter["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: bgwriter
        - uuid: 62598e17214f44888fa57db4214a3b5f
          name: 'Checkpoint: Buffers written by the background writer per second'
          type: DEPENDENT
          key: pgsql.bgwriter.buffers_clean.rate
          value_type: FLOAT
          description: 'Number of buffers written by the background writer per second.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.buffers_clean
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.bgwriter["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: bgwriter
        - uuid: 6c05e2cb877142fe8b1c03ab6566a134
          name: 'Checkpoint: Requested per second'
          type: DEPENDENT
          key: pgsql.bgwriter.checkpoints_req.rate
          value_type: FLOAT
          description: 'Number of requested checkpoints that have been performed per second.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.checkpoints_req
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.bgwriter["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: bgwriter
          triggers:
            - uuid: 62699d1627fe4141ac59291b138b4f7e
              expression: 'last(/PostgreSQL by Zabbix agent active/pgsql.bgwriter.checkpoints_req.rate) > {$PG.CHECKPOINTS_REQ.MAX.WARN}'
              name: 'PostgreSQL: Required checkpoints occur too frequently'
              event_name: 'PostgreSQL: Required checkpoints occur too frequently (over {$PG.CHECKPOINTS_REQ.MAX.WARN})'
              priority: AVERAGE
              description: |
                Checkpoints are points in the sequence of transactions at which it is guaranteed that the heap and index data files have been updated with all information written before that checkpoint. At checkpoint time, all dirty data pages are flushed to disk and a special checkpoint record is written to the log file.
                https://www.postgresql.org/docs/current/wal-configuration.html
              tags:
                - tag: scope
                  value: performance
        - uuid: 9f4020e7f0294ffb9e15b75982be5a68
          name: 'Checkpoint: Scheduled per second'
          type: DEPENDENT
          key: pgsql.bgwriter.checkpoints_timed.rate
          value_type: FLOAT
          description: 'Number of scheduled checkpoints that have been performed per second.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.checkpoints_timed
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.bgwriter["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: bgwriter
        - uuid: bf59309e2fba4601920c64ab96f4d07e
          name: 'Checkpoint: Checkpoint sync time per second'
          type: DEPENDENT
          key: pgsql.bgwriter.checkpoint_sync_time.rate
          value_type: FLOAT
          units: s
          description: 'Total amount of time per second that has been spent in the portion of checkpoint processing where files are synchronized to disk.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.checkpoint_sync_time
            - type: MULTIPLIER
              parameters:
                - '0.001'
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.bgwriter["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: bgwriter
        - uuid: 5bd159a9c2794486b0548f701605ccbc
          name: 'Checkpoint: Checkpoint write time per second'
          type: DEPENDENT
          key: pgsql.bgwriter.checkpoint_write_time.rate
          value_type: FLOAT
          units: s
          description: 'Total amount of time per second that has been spent in the portion of checkpoint processing where files are written to disk.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.checkpoint_write_time
            - type: MULTIPLIER
              parameters:
                - '0.001'
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.bgwriter["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: bgwriter
        - uuid: 716b6c5c1f304d17ad9784ebee2062e1
          name: 'Bgwriter: Number of bgwriter cleaning scan stopped per second'
          type: DEPENDENT
          key: pgsql.bgwriter.maxwritten_clean.rate
          value_type: FLOAT
          description: 'Number of times the background writer stopped a cleaning scan because it had written too many buffers per second.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.maxwritten_clean
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.bgwriter["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: bgwriter
        - uuid: 08043026cea14053a0addd4bdb7b7b8d
          name: 'Get bgwriter'
          type: ZABBIX_ACTIVE
          key: 'pgsql.bgwriter["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          history: 1h
          value_type: TEXT
          description: |
            Collect all metrics from pg_stat_bgwriter:
            https://www.postgresql.org/docs/current/monitoring-stats.html#PG-STAT-BGWRITER-VIEW
          tags:
            - tag: component
              value: raw
          triggers:
            - uuid: 33ad0c74e4a34656bd911ebc2920e70a
              expression: 'nodata(/PostgreSQL by Zabbix agent active/pgsql.bgwriter["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"],30m) = 1'
              name: 'PostgreSQL: Failed to get items'
              event_name: 'PostgreSQL: Failed to get items (no data for 30m)'
              priority: WARNING
              description: 'Zabbix has not received any data for items for the last 30 minutes.'
              dependencies:
                - name: 'PostgreSQL: Service is down'
                  expression: 'last(/PostgreSQL by Zabbix agent active/pgsql.ping["{$PG.HOST}","{$PG.PORT}"]) = 0'
              tags:
                - tag: scope
                  value: availability
        - uuid: 934e6647557f41cba46532a5a5c5d2ea
          name: 'Cache hit ratio, %'
          type: ZABBIX_ACTIVE
          key: 'pgsql.cache.hit["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          value_type: FLOAT
          units: '%'
          description: 'Cache hit ratio.'
          tags:
            - tag: component
              value: cache
          triggers:
            - uuid: bd2fd99b03b54916963dd661c959dd2f
              expression: 'max(/PostgreSQL by Zabbix agent active/pgsql.cache.hit["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"],5m) < {$PG.CACHE_HITRATIO.MIN.WARN}'
              name: 'PostgreSQL: Cache hit ratio too low'
              event_name: 'PostgreSQL: Cache hit ratio too low (under {$PG.CACHE_HITRATIO.MIN.WARN} in 5m)'
              priority: WARNING
              description: 'Cache hit ratio is lower than {$PG.CACHE_HITRATIO.MIN.WARN} for 5m.'
              tags:
                - tag: scope
                  value: performance
        - uuid: 2d028578428949da8fa05d1f62f9f615
          name: 'Config hash'
          type: ZABBIX_ACTIVE
          key: 'pgsql.config.hash["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          delay: 15m
          value_type: TEXT
          description: 'PostgreSQL configuration hash.'
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          tags:
            - tag: component
              value: application
          triggers:
            - uuid: 483c370fa82f4c18ac9dbe7b07a4d7ff
              expression: 'last(/PostgreSQL by Zabbix agent active/pgsql.config.hash["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"],#1)<>last(/PostgreSQL by Zabbix agent active/pgsql.config.hash["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"],#2) and length(last(/PostgreSQL by Zabbix agent active/pgsql.config.hash["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]))>0'
              name: 'PostgreSQL: Configuration has changed'
              priority: INFO
              description: 'PostgreSQL configuration has changed.'
              tags:
                - tag: scope
                  value: notice
        - uuid: 7866090bfc5d4e1db50b50957b372685
          name: 'Connections sum: Active'
          type: DEPENDENT
          key: pgsql.connections.sum.active
          description: 'Total number of connections executing a query.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.active
          master_item:
            key: 'pgsql.connections.sum["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: connections
        - uuid: 7853f5db0cc54865ba0fc3323b4b9810
          name: 'Connections sum: Idle'
          type: DEPENDENT
          key: pgsql.connections.sum.idle
          description: 'Total number of connections waiting for a new client command.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.idle
          master_item:
            key: 'pgsql.connections.sum["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: connections
        - uuid: b609844ba35149e2a92e43ce5aa4c6f1
          name: 'Connections sum: Idle in transaction'
          type: DEPENDENT
          key: pgsql.connections.sum.idle_in_transaction
          description: 'Total number of connections in a transaction state but not executing a query.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.idle_in_transaction
          master_item:
            key: 'pgsql.connections.sum["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: connections
        - uuid: dc8be28daed141c789beab5e7c64c660
          name: 'Connections sum: Prepared'
          type: DEPENDENT
          key: pgsql.connections.sum.prepared
          description: |
            Total number of prepared transactions:
            https://www.postgresql.org/docs/current/sql-prepare-transaction.html
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.prepared
          master_item:
            key: 'pgsql.connections.sum["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: connections
        - uuid: c04d920d78e54039bca114e94c655a17
          name: 'Connections sum: Total'
          type: DEPENDENT
          key: pgsql.connections.sum.total
          description: 'Total number of connections.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.total
          master_item:
            key: 'pgsql.connections.sum["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: connections
        - uuid: ea0eaf2f784f476e9ce72fa119f8badb
          name: 'Connections sum: Total, %'
          type: DEPENDENT
          key: pgsql.connections.sum.total_pct
          units: '%'
          description: 'Total number of connections, in percentage.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.total_pct
          master_item:
            key: 'pgsql.connections.sum["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: connections
          triggers:
            - uuid: b4673d7606514a6cb5b3ef61b5b05ce1
              expression: 'min(/PostgreSQL by Zabbix agent active/pgsql.connections.sum.total_pct,5m) > {$PG.CONN_TOTAL_PCT.MAX.WARN}'
              name: 'PostgreSQL: Total number of connections is too high'
              event_name: 'PostgreSQL: Total number of connections is too high (over {$PG.CONN_TOTAL_PCT.MAX.WARN} in 5m)'
              priority: AVERAGE
              description: 'Total number of current connections exceeds the limit of {$PG.CONN_TOTAL_PCT.MAX.WARN}% out of the maximum number of concurrent connections to the database server (the "max_connections" setting).'
              tags:
                - tag: scope
                  value: performance
        - uuid: e19ab5dbf64348158c6033073c1a1058
          name: 'Connections sum: Waiting'
          type: DEPENDENT
          key: pgsql.connections.sum.waiting
          description: |
            Total number of waiting connections:
            https://www.postgresql.org/docs/current/monitoring-stats.html#WAIT-EVENT-TABLE
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.waiting
          master_item:
            key: 'pgsql.connections.sum["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: connections
        - uuid: 13cce1cb170f4c9db977cb49fc603f79
          name: 'Get connections sum'
          type: ZABBIX_ACTIVE
          key: 'pgsql.connections.sum["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          history: '0'
          value_type: TEXT
          description: |
            Collect all metrics from pg_stat_activity:
            https://www.postgresql.org/docs/current/monitoring-stats.html#PG-STAT-ACTIVITY-VIEW
          tags:
            - tag: component
              value: raw
        - uuid: bea2e947b16b4a3dac660e664a505904
          name: 'Get dbstat'
          type: ZABBIX_ACTIVE
          key: 'pgsql.dbstat["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          history: '0'
          value_type: TEXT
          description: |
            Collect all metrics from pg_stat_database per database:
            https://www.postgresql.org/docs/current/monitoring-stats.html#PG-STAT-DATABASE-VIEW
          tags:
            - tag: component
              value: raw
        - uuid: e5adbe1c2fc74943926cf45ff5efbff3
          name: 'Get locks'
          type: ZABBIX_ACTIVE
          key: 'pgsql.locks["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          history: '0'
          value_type: TEXT
          description: |
            Collect all metrics from pg_locks per database:
            https://www.postgresql.org/docs/current/explicit-locking.html#LOCKING-TABLES
          tags:
            - tag: component
              value: raw
        - uuid: 2ab77e9548014233b0945bdeb9c134bd
          name: 'Ping time'
          type: ZABBIX_ACTIVE
          key: 'pgsql.ping.time["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          value_type: FLOAT
          units: s
          description: 'Used to get the `SELECT 1` query execution time.'
          preprocessing:
            - type: REGEX
              parameters:
                - 'Time:\s+(\d+\.\d+)\s+ms'
                - \1
            - type: MULTIPLIER
              parameters:
                - '0.001'
          tags:
            - tag: component
              value: application
            - tag: component
              value: health
          triggers:
            - uuid: 0b54c409159f494c969c040d295b5cfb
              expression: 'min(/PostgreSQL by Zabbix agent active/pgsql.ping.time["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"],5m) > {$PG.PING_TIME.MAX.WARN}'
              name: 'PostgreSQL: Response too long'
              event_name: 'PostgreSQL: Response too long (over {$PG.PING_TIME.MAX.WARN})'
              priority: AVERAGE
              description: 'Response is taking too long (over {$PG.PING_TIME.MAX.WARN} for 5m).'
              dependencies:
                - name: 'PostgreSQL: Service is down'
                  expression: 'last(/PostgreSQL by Zabbix agent active/pgsql.ping["{$PG.HOST}","{$PG.PORT}"]) = 0'
              tags:
                - tag: scope
                  value: availability
                - tag: scope
                  value: performance
        - uuid: 058b3cd8308b4692a5cb3e89a47886bd
          name: Ping
          type: ZABBIX_ACTIVE
          key: 'pgsql.ping["{$PG.HOST}","{$PG.PORT}"]'
          description: 'Used to test a connection to see if it is alive. It is set to 0 if the instance doesn''t accept the connections.'
          valuemap:
            name: 'Service state'
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - 'return value.search(/accepting connections/)>0 ? 1 : 0'
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          tags:
            - tag: component
              value: application
            - tag: component
              value: health
          triggers:
            - uuid: 32a43d55902d46b09f602dc89e3a2586
              expression: 'last(/PostgreSQL by Zabbix agent active/pgsql.ping["{$PG.HOST}","{$PG.PORT}"]) = 0'
              name: 'PostgreSQL: Service is down'
              priority: HIGH
              description: 'Last test of a connection was unsuccessful.'
              tags:
                - tag: scope
                  value: availability
        - uuid: 2a4de36d7b434260b264a63ab444a430
          name: 'Get queries'
          type: ZABBIX_ACTIVE
          key: 'pgsql.queries["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}","{$PG.QUERY_ETIME.MAX.WARN}"]'
          history: '0'
          value_type: TEXT
          description: 'Collect all metrics by query execution time.'
          tags:
            - tag: component
              value: raw
        - uuid: 401331b4eab0439ca954551bce2f0c2e
          name: 'Replication: Standby count'
          type: ZABBIX_ACTIVE
          key: 'pgsql.replication.count["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          description: 'Number of standby servers.'
          tags:
            - tag: component
              value: replication
        - uuid: 2005dff88ab64458b3970a40e5bf0aff
          name: 'Replication: Lag in seconds'
          type: ZABBIX_ACTIVE
          key: 'pgsql.replication.lag.sec["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          units: s
          description: 'Replication lag with master, in seconds.'
          tags:
            - tag: component
              value: replication
          triggers:
            - uuid: 99adc9f76c0b42a08c22271b9206ce18
              expression: 'min(/PostgreSQL by Zabbix agent active/pgsql.replication.lag.sec["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"],5m) > {$PG.REPL_LAG.MAX.WARN}'
              name: 'PostgreSQL: Streaming lag with master is too high'
              event_name: 'PostgreSQL: Streaming lag with master is too high (over {$PG.REPL_LAG.MAX.WARN} in 5m)'
              priority: AVERAGE
              description: 'Replication lag with master is higher than {$PG.REPL_LAG.MAX.WARN} for 5m.'
              tags:
                - tag: scope
                  value: availability
                - tag: scope
                  value: performance
        - uuid: 808f71865b934ac68512a3d6fa8b4aab
          name: 'Replication: Recovery role'
          type: ZABBIX_ACTIVE
          key: 'pgsql.replication.recovery_role["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          description: 'Replication role: 1 — recovery is still in progress (standby mode), 0 — master mode.'
          valuemap:
            name: 'PostgreSQL recovery role'
          tags:
            - tag: component
              value: replication
        - uuid: 5c4061c4081d41fa86741a296378d031
          name: 'Replication: Status'
          type: ZABBIX_ACTIVE
          key: 'pgsql.replication.status["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          description: 'Replication status: 0 — streaming is down, 1 — streaming is up, 2 — master mode.'
          valuemap:
            name: 'PostgreSQL replication status'
          tags:
            - tag: component
              value: replication
          triggers:
            - uuid: 63b498ebd0484bc59f701e4179ed4fb2
              expression: 'max(/PostgreSQL by Zabbix agent active/pgsql.replication.status["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"],5m)=0'
              name: 'PostgreSQL: Replication is down'
              priority: AVERAGE
              description: 'Replication is enabled and data streaming was down for 5m.'
              tags:
                - tag: scope
                  value: availability
        - uuid: ecbeae6a23e74cc89c670daf60f81833
          name: 'Transactions: Max active transaction time'
          type: DEPENDENT
          key: pgsql.transactions.active
          value_type: FLOAT
          units: s
          description: 'Current max active transaction time.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.active
          master_item:
            key: 'pgsql.transactions["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: transactions
        - uuid: 406d76761c0b4e0dbe83a14f48874fed
          name: 'Transactions: Max idle transaction time'
          type: DEPENDENT
          key: pgsql.transactions.idle
          value_type: FLOAT
          units: s
          description: 'Current max idle transaction time.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.idle
          master_item:
            key: 'pgsql.transactions["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: transactions
        - uuid: 3e0f09be15284811a4f9864be8aaa1e7
          name: 'Transactions: Max prepared transaction time'
          type: DEPENDENT
          key: pgsql.transactions.prepared
          value_type: FLOAT
          units: s
          description: 'Current max prepared transaction time.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.prepared
          master_item:
            key: 'pgsql.transactions["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: transactions
        - uuid: 2c5f5402e73942ef9a51d7965b9e705b
          name: 'Transactions: Max waiting transaction time'
          type: DEPENDENT
          key: pgsql.transactions.waiting
          value_type: FLOAT
          units: s
          description: 'Current max waiting transaction time.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.waiting
          master_item:
            key: 'pgsql.transactions["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: transactions
        - uuid: b22ed1707bd84c4faa010803b2c594fa
          name: 'Get transactions'
          type: ZABBIX_ACTIVE
          key: 'pgsql.transactions["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          history: '0'
          value_type: TEXT
          description: 'Collect metrics by transaction execution time.'
          tags:
            - tag: component
              value: raw
        - uuid: d310b47d3e38466a980494fb0f9dfb01
          name: Uptime
          type: ZABBIX_ACTIVE
          key: 'pgsql.uptime["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          units: uptime
          description: 'Time since the server started.'
          tags:
            - tag: component
              value: application
          triggers:
            - uuid: a7c05ccff4c342018777471d1f3a17b7
              expression: 'last(/PostgreSQL by Zabbix agent active/pgsql.uptime["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]) < 10m'
              name: 'PostgreSQL: Service has been restarted'
              event_name: 'PostgreSQL: Service has been restarted (uptime < 10m)'
              priority: AVERAGE
              description: 'PostgreSQL uptime is less than 10 minutes.'
              tags:
                - tag: scope
                  value: notice
        - uuid: 9798496e21914a8cbdee1cd85decf3e8
          name: Version
          type: ZABBIX_ACTIVE
          key: 'pgsql.version["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          delay: 15m
          value_type: CHAR
          description: 'PostgreSQL version.'
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1d
          tags:
            - tag: component
              value: application
          triggers:
            - uuid: e06391b8cfe74fb5ad3b3bb2718b5e58
              expression: 'last(/PostgreSQL by Zabbix agent active/pgsql.version["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"],#1)<>last(/PostgreSQL by Zabbix agent active/pgsql.version["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"],#2) and length(last(/PostgreSQL by Zabbix agent active/pgsql.version["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]))>0'
              name: 'PostgreSQL: Version has changed'
              event_name: 'PostgreSQL: Version has changed (new version value received: {ITEM.VALUE})'
              priority: INFO
              tags:
                - tag: scope
                  value: notice
        - uuid: b1c6d3ff86f240df8f2c3a14a47e4df1
          name: 'WAL: Segments count'
          type: DEPENDENT
          key: pgsql.wal.count
          description: 'Number of WAL segments.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.count
          master_item:
            key: 'pgsql.wal.stat["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: wal
        - uuid: 9ca8653ea8304b5392d1c39111381751
          name: 'Get WAL'
          type: ZABBIX_ACTIVE
          key: 'pgsql.wal.stat["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          delay: 5m
          history: '0'
          value_type: TEXT
          description: 'Collect write-ahead log (WAL) metrics.'
          tags:
            - tag: component
              value: raw
        - uuid: 08580207e58142a393e310b0d592a7d5
          name: 'WAL: Bytes written'
          type: DEPENDENT
          key: pgsql.wal.write
          units: B
          description: 'WAL write, in bytes.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.write
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'pgsql.wal.stat["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          tags:
            - tag: component
              value: wal
      discovery_rules:
        - uuid: d9625ea888804a8b82d395e1e002c6cd
          name: 'Database discovery'
          type: ZABBIX_ACTIVE
          key: 'pgsql.discovery.db["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
          delay: 1h
          filter:
            conditions:
              - macro: '{#DBNAME}'
                value: '{$PG.LLD.FILTER.DBNAME}'
          description: |
            Discovers databases (DB) in the database management system (DBMS), except:
            - templates;
            - default "postgres" DB;
            - DBs that do not allow connections.
          item_prototypes:
            - uuid: f8d430b69f4f4f2aa04e2906cc4ab3cd
              name: 'DB [{#DBNAME}]: Database size'
              type: ZABBIX_ACTIVE
              key: 'pgsql.db.size["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}","{#DBNAME}"]'
              delay: 15m
              units: B
              description: 'Database size.'
              tags:
                - tag: component
                  value: storage
                - tag: database
                  value: '{#DBNAME}'
            - uuid: aa8e864297914f25bb6cc6b914871a46
              name: 'DB [{#DBNAME}]: Blocks hit per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.blks_hit.rate["{#DBNAME}"]'
              value_type: FLOAT
              description: 'Total number of times per second disk blocks were found already in the buffer cache, so that a read was not necessary.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.blks_hit
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: cache
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 69d6cc93dbff4669a18b6e12fb6e8b7a
              name: 'DB [{#DBNAME}]: Disk blocks read per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.blks_read.rate["{#DBNAME}"]'
              value_type: FLOAT
              description: 'Total number of disk blocks read per second in this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.blks_read
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: storage
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 8894ff8a7e4641559efd456a9024ef9a
              name: 'DB [{#DBNAME}]: Detected conflicts per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.conflicts.rate["{#DBNAME}"]'
              value_type: FLOAT
              description: 'Total number of queries canceled due to conflicts with recovery in this database per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.conflicts
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
              trigger_prototypes:
                - uuid: e35f79c06fba41dfb9d9c35e4a13a043
                  expression: 'min(/PostgreSQL by Zabbix agent active/pgsql.dbstat.conflicts.rate["{#DBNAME}"],5m) > {$PG.CONFLICTS.MAX.WARN:"{#DBNAME}"}'
                  name: 'PostgreSQL: DB [{#DBNAME}]: Too many recovery conflicts'
                  event_name: 'PostgreSQL: DB [{#DBNAME}]: Too many recovery conflicts (over {$PG.CONFLICTS.MAX.WARN:"{#DBNAME}"} in 5m)'
                  priority: AVERAGE
                  description: |
                    The primary and standby servers are in many ways loosely connected. Actions on the primary will have an effect on the standby. As a result, there is potential for negative interactions or conflicts between them.
                    https://www.postgresql.org/docs/current/hot-standby.html#HOT-STANDBY-CONFLICT
                  tags:
                    - tag: scope
                      value: performance
            - uuid: 8a3dfbedb1f54b93bc6ca90d9476677c
              name: 'DB [{#DBNAME}]: Detected deadlocks per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.deadlocks.rate["{#DBNAME}"]'
              value_type: FLOAT
              description: 'Total number of detected deadlocks in this database per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.deadlocks
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: deadlocks
                - tag: database
                  value: '{#DBNAME}'
              trigger_prototypes:
                - uuid: 5243a46334674a06b52efdef93bce0ec
                  expression: 'min(/PostgreSQL by Zabbix agent active/pgsql.dbstat.deadlocks.rate["{#DBNAME}"],5m) > {$PG.DEADLOCKS.MAX.WARN:"{#DBNAME}"}'
                  name: 'PostgreSQL: DB [{#DBNAME}]: Deadlock occurred'
                  event_name: 'PostgreSQL: DB [{#DBNAME}]: Deadlock occurred (over {$PG.DEADLOCKS.MAX.WARN:"{#DBNAME}"} in 5m)'
                  priority: HIGH
                  description: 'Number of deadlocks detected per second exceeds {$PG.DEADLOCKS.MAX.WARN:"{#DBNAME}"} for 5m.'
                  tags:
                    - tag: scope
                      value: availability
            - uuid: f7a0b95d306542ddb8b9730650f4fc27
              name: 'DB [{#DBNAME}]: Get dbstat'
              type: DEPENDENT
              key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              history: '0'
              value_type: TEXT
              description: 'Get dbstat metrics for database "{#DBNAME}".'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$[''{#DBNAME}'']'
                  error_handler: DISCARD_VALUE
              master_item:
                key: 'pgsql.dbstat["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
              tags:
                - tag: component
                  value: raw
                - tag: database
                  value: '{#DBNAME}'
            - uuid: eabd8d2f4a9d4a48be75d0d56eb48e17
              name: 'DB [{#DBNAME}]: Temp_bytes written per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.temp_bytes.rate["{#DBNAME}"]'
              units: B
              description: 'Total amount of data written to temporary files by queries in this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.temp_bytes
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: storage
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 51288ac46f5c49ae8cafe421bbb41d29
              name: 'DB [{#DBNAME}]: Temp_files created per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.temp_files.rate["{#DBNAME}"]'
              description: 'Total number of temporary files created by queries in this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.temp_files
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: storage
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 7ad48d3b888a4f24a091a597e3189fee
              name: 'DB [{#DBNAME}]: Tuples deleted per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.tup_deleted.rate["{#DBNAME}"]'
              value_type: FLOAT
              description: 'Total number of rows deleted by queries in this database per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.tup_deleted
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
            - uuid: c0688782315f49aba4a468d9d0bac3e6
              name: 'DB [{#DBNAME}]: Tuples fetched per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.tup_fetched.rate["{#DBNAME}"]'
              value_type: FLOAT
              description: 'Total number of rows fetched by queries in this database per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.tup_fetched
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 308fc84decc04b738d3e00cdf8427164
              name: 'DB [{#DBNAME}]: Tuples inserted per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.tup_inserted.rate["{#DBNAME}"]'
              value_type: FLOAT
              description: 'Total number of rows inserted by queries in this database per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.tup_inserted
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 42125b8816044bc09ec4904ea78402b0
              name: 'DB [{#DBNAME}]: Tuples returned per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.tup_returned.rate["{#DBNAME}"]'
              value_type: FLOAT
              description: 'Number of rows returned by queries in this database per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.tup_returned
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 495797c1a134404d88c4216aebff3f28
              name: 'DB [{#DBNAME}]: Tuples updated per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.tup_updated.rate["{#DBNAME}"]'
              value_type: FLOAT
              description: 'Total number of rows updated by queries in this database per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.tup_updated
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 88b787af729944e8b262ca99dcefe8a3
              name: 'DB [{#DBNAME}]: Commits per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.xact_commit.rate["{#DBNAME}"]'
              value_type: FLOAT
              description: 'Number of transactions in this database that have been committed per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.xact_commit
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: transactions
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 2f31f5f8b36c4742b9a74862b17b30c0
              name: 'DB [{#DBNAME}]: Rollbacks per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.xact_rollback.rate["{#DBNAME}"]'
              value_type: FLOAT
              description: 'Total number of transactions in this database that have been rolled back.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.xact_rollback
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: transactions
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 50147f7140144de2af4200b9be95535a
              name: 'DB [{#DBNAME}]: Frozen XID before autovacuum, %'
              type: DEPENDENT
              key: 'pgsql.frozenxid.prc_before_av["{#DBNAME}"]'
              value_type: FLOAT
              units: '%'
              description: |
                Preventing Transaction ID Wraparound Failures:
                https://www.postgresql.org/docs/current/routine-vacuuming.html#VACUUM-FOR-WRAPAROUND
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.prc_before_av
              master_item:
                key: 'pgsql.frozenxid["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{#DBNAME}"]'
              tags:
                - tag: component
                  value: transactions
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 2cf70e1bfa084b92b7155a1f41351069
              name: 'DB [{#DBNAME}]: Frozen XID before stop, %'
              type: DEPENDENT
              key: 'pgsql.frozenxid.prc_before_stop["{#DBNAME}"]'
              value_type: FLOAT
              units: '%'
              description: |
                Preventing Transaction ID Wraparound Failures:
                https://www.postgresql.org/docs/current/routine-vacuuming.html#VACUUM-FOR-WRAPAROUND
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.prc_before_stop
              master_item:
                key: 'pgsql.frozenxid["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{#DBNAME}"]'
              tags:
                - tag: component
                  value: transactions
                - tag: database
                  value: '{#DBNAME}'
              trigger_prototypes:
                - uuid: 0c207f7271ad4df19977722a976b8ccc
                  expression: 'last(/PostgreSQL by Zabbix agent active/pgsql.frozenxid.prc_before_stop["{#DBNAME}"])<{$PG.FROZENXID_PCT_STOP.MIN.HIGH:"{#DBNAME}"}'
                  name: 'PostgreSQL: DB [{#DBNAME}]: VACUUM FREEZE is required to prevent wraparound'
                  event_name: 'PostgreSQL: DB [{#DBNAME}]: VACUUM FREEZE is required to prevent wraparound (frozen XID less than {$PG.FROZENXID_PCT_STOP.MIN.HIGH:"{#DBNAME}"} %)'
                  priority: AVERAGE
                  description: |
                    Preventing Transaction ID Wraparound Failures:
                    https://www.postgresql.org/docs/current/routine-vacuuming.html#VACUUM-FOR-WRAPAROUND
                  tags:
                    - tag: scope
                      value: availability
            - uuid: 2e0e02f98b3c45d195f93e1ed8ec343d
              name: 'DB [{#DBNAME}]: Get frozen XID'
              type: ZABBIX_ACTIVE
              key: 'pgsql.frozenxid["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{#DBNAME}"]'
              history: '0'
              value_type: TEXT
              tags:
                - tag: component
                  value: raw
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 220503c9eeac46ea8656f7b5a149c29d
              name: 'DB [{#DBNAME}]: Num of locks total'
              type: DEPENDENT
              key: 'pgsql.locks.total["{#DBNAME}"]'
              description: 'Total number of locks in this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$[''{#DBNAME}''].total'
              master_item:
                key: 'pgsql.locks["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
              tags:
                - tag: component
                  value: locks
                - tag: database
                  value: '{#DBNAME}'
              trigger_prototypes:
                - uuid: 7a235edcda5d4482a9a3f3e5d741ee6e
                  expression: 'min(/PostgreSQL by Zabbix agent active/pgsql.locks.total["{#DBNAME}"],5m)>{$PG.LOCKS.MAX.WARN:"{#DBNAME}"}'
                  name: 'PostgreSQL: DB [{#DBNAME}]: Number of locks is too high'
                  event_name: 'PostgreSQL: DB [{#DBNAME}]: Number of locks is too high (over {$PG.LOCKS.MAX.WARN:"{#DBNAME}"} in 5m)'
                  priority: WARNING
                  tags:
                    - tag: scope
                      value: availability
            - uuid: 1e31cbe913ef44b1896fc44cf11cb18c
              name: 'DB [{#DBNAME}]: Get queries'
              type: DEPENDENT
              key: 'pgsql.queries.get_metrics["{#DBNAME}"]'
              history: '0'
              value_type: TEXT
              description: 'Get queries metrics for database "{#DBNAME}".'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$[''{#DBNAME}'']'
                  error_handler: DISCARD_VALUE
              master_item:
                key: 'pgsql.queries["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}","{$PG.QUERY_ETIME.MAX.WARN}"]'
              tags:
                - tag: component
                  value: raw
                - tag: database
                  value: '{#DBNAME}'
            - uuid: ed9c08ef16c845c08788de774405cbeb
              name: 'DB [{#DBNAME}]: Queries slow maintenance count'
              type: DEPENDENT
              key: 'pgsql.queries.mro.slow_count["{#DBNAME}"]'
              description: 'Slow maintenance query count for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.mro_slow_count
              master_item:
                key: 'pgsql.queries.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
            - uuid: a405b92ed32c4424a4e0136016370da4
              name: 'DB [{#DBNAME}]: Queries max maintenance time'
              type: DEPENDENT
              key: 'pgsql.queries.mro.time_max["{#DBNAME}"]'
              units: s
              description: 'Max maintenance query time for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.mro_time_max
              master_item:
                key: 'pgsql.queries.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 58406e650bf74db2ab216d35f4ef8f60
              name: 'DB [{#DBNAME}]: Queries sum maintenance time'
              type: DEPENDENT
              key: 'pgsql.queries.mro.time_sum["{#DBNAME}"]'
              units: s
              description: 'Sum maintenance query time for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.mro_time_sum
              master_item:
                key: 'pgsql.queries.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 04b8af083191408284aab798ed5c2ac4
              name: 'DB [{#DBNAME}]: Queries slow query count'
              type: DEPENDENT
              key: 'pgsql.queries.query.slow_count["{#DBNAME}"]'
              description: 'Slow query count for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.query_slow_count
              master_item:
                key: 'pgsql.queries.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
              trigger_prototypes:
                - uuid: fe5e595cd37c40c3b99aa28a12575b3d
                  expression: 'min(/PostgreSQL by Zabbix agent active/pgsql.queries.query.slow_count["{#DBNAME}"],5m)>{$PG.SLOW_QUERIES.MAX.WARN:"{#DBNAME}"}'
                  name: 'PostgreSQL: DB [{#DBNAME}]: Too many slow queries'
                  event_name: 'PostgreSQL: DB [{#DBNAME}]: Too many slow queries (over {$PG.SLOW_QUERIES.MAX.WARN:"{#DBNAME}"} in 5m)'
                  priority: WARNING
                  description: 'The number of detected slow queries exceeds the limit of {$PG.SLOW_QUERIES.MAX.WARN:"{#DBNAME}"}.'
                  tags:
                    - tag: scope
                      value: performance
            - uuid: d47d6e5857534981aeb5e92ef6423c7d
              name: 'DB [{#DBNAME}]: Queries max query time'
              type: DEPENDENT
              key: 'pgsql.queries.query.time_max["{#DBNAME}"]'
              units: s
              description: 'Max query time for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.query_time_max
              master_item:
                key: 'pgsql.queries.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
            - uuid: a5c184f0d7c74a52983cccb836fe3d61
              name: 'DB [{#DBNAME}]: Queries sum query time'
              type: DEPENDENT
              key: 'pgsql.queries.query.time_sum["{#DBNAME}"]'
              units: s
              description: 'Sum query time for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.query_time_sum
              master_item:
                key: 'pgsql.queries.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 4b71f7bbc17c4695beb75cfc9bc67da0
              name: 'DB [{#DBNAME}]: Queries slow transaction count'
              type: DEPENDENT
              key: 'pgsql.queries.tx.slow_count["{#DBNAME}"]'
              description: 'Slow transaction query count for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.tx_slow_count
              master_item:
                key: 'pgsql.queries.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 5489fc69a7ce45a0a0c0cff565a62189
              name: 'DB [{#DBNAME}]: Queries max transaction time'
              type: DEPENDENT
              key: 'pgsql.queries.tx.time_max["{#DBNAME}"]'
              units: s
              description: 'Max transaction query time for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.tx_time_max
              master_item:
                key: 'pgsql.queries.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 3283a1520f1b4adabf01964efdaaa31c
              name: 'DB [{#DBNAME}]: Queries sum transaction time'
              type: DEPENDENT
              key: 'pgsql.queries.tx.time_sum["{#DBNAME}"]'
              units: s
              description: 'Sum transaction query time for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.tx_time_sum
              master_item:
                key: 'pgsql.queries.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 7e7e322396c24c70bb479ae84b79bbcd
              name: 'DB [{#DBNAME}]: Index scans per second'
              type: DEPENDENT
              key: 'pgsql.scans.idx.rate["{#DBNAME}"]'
              description: 'Number of index scans in the database per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.idx
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.scans["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{#DBNAME}"]'
              tags:
                - tag: component
                  value: scans
                - tag: database
                  value: '{#DBNAME}'
            - uuid: c64cdbfa58994f699fb7ad7c3fd38b5f
              name: 'DB [{#DBNAME}]: Sequential scans per second'
              type: DEPENDENT
              key: 'pgsql.scans.seq.rate["{#DBNAME}"]'
              value_type: FLOAT
              description: 'Number of sequential scans in this database per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.seq
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.scans["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{#DBNAME}"]'
              tags:
                - tag: component
                  value: scans
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 8ee891f2e0ae4c74a24ebffc67380f01
              name: 'DB [{#DBNAME}]: Get scans'
              type: ZABBIX_ACTIVE
              key: 'pgsql.scans["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{#DBNAME}"]'
              history: '0'
              value_type: TEXT
              description: 'Number of scans done for table/index in this database.'
              tags:
                - tag: component
                  value: raw
                - tag: database
                  value: '{#DBNAME}'
          graph_prototypes:
            - uuid: 692254ddbb2646ed8f8f73e28d400d28
              name: 'DB [{#DBNAME}]: Block hit/read'
              ymin_type_1: FIXED
              graph_items:
                - color: 199C0D
                  item:
                    host: 'PostgreSQL by Zabbix agent active'
                    key: 'pgsql.dbstat.blks_hit.rate["{#DBNAME}"]'
                - sortorder: '1'
                  color: F63100
                  item:
                    host: 'PostgreSQL by Zabbix agent active'
                    key: 'pgsql.dbstat.blks_read.rate["{#DBNAME}"]'
            - uuid: 0faea1cf0ef4422cabc9af14f3e774e9
              name: 'DB [{#DBNAME}]: Database size'
              ymin_type_1: FIXED
              graph_items:
                - color: 199C0D
                  item:
                    host: 'PostgreSQL by Zabbix agent active'
                    key: 'pgsql.db.size["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}","{#DBNAME}"]'
            - uuid: 61a7e55b8e614ae58a5e8675babba974
              name: 'DB [{#DBNAME}]: Events'
              ymin_type_1: FIXED
              graph_items:
                - drawtype: GRADIENT_LINE
                  color: 199C0D
                  item:
                    host: 'PostgreSQL by Zabbix agent active'
                    key: 'pgsql.dbstat.xact_commit.rate["{#DBNAME}"]'
                - sortorder: '1'
                  color: F63100
                  item:
                    host: 'PostgreSQL by Zabbix agent active'
                    key: 'pgsql.dbstat.conflicts.rate["{#DBNAME}"]'
                - sortorder: '2'
                  color: 00611C
                  item:
                    host: 'PostgreSQL by Zabbix agent active'
                    key: 'pgsql.dbstat.deadlocks.rate["{#DBNAME}"]'
                - sortorder: '3'
                  color: F7941D
                  item:
                    host: 'PostgreSQL by Zabbix agent active'
                    key: 'pgsql.dbstat.xact_rollback.rate["{#DBNAME}"]'
            - uuid: 1ef3d8b8ac0d48d9b19551ceb60de933
              name: 'DB [{#DBNAME}]: Locks'
              ymin_type_1: FIXED
              graph_items:
                - color: 199C0D
                  item:
                    host: 'PostgreSQL by Zabbix agent active'
                    key: 'pgsql.locks.total["{#DBNAME}"]'
            - uuid: 27541a985dc04626836b8c11a038f328
              name: 'DB [{#DBNAME}]: Queries'
              ymin_type_1: FIXED
              graph_items:
                - color: 199C0D
                  yaxisside: RIGHT
                  item:
                    host: 'PostgreSQL by Zabbix agent active'
                    key: 'pgsql.queries.mro.time_max["{#DBNAME}"]'
                - sortorder: '1'
                  color: F63100
                  yaxisside: RIGHT
                  item:
                    host: 'PostgreSQL by Zabbix agent active'
                    key: 'pgsql.queries.query.time_max["{#DBNAME}"]'
                - sortorder: '2'
                  color: 00611C
                  yaxisside: RIGHT
                  item:
                    host: 'PostgreSQL by Zabbix agent active'
                    key: 'pgsql.queries.tx.time_max["{#DBNAME}"]'
                - sortorder: '3'
                  drawtype: GRADIENT_LINE
                  color: F7941D
                  item:
                    host: 'PostgreSQL by Zabbix agent active'
                    key: 'pgsql.queries.mro.time_sum["{#DBNAME}"]'
                - sortorder: '4'
                  drawtype: GRADIENT_LINE
                  color: FC6EA3
                  item:
                    host: 'PostgreSQL by Zabbix agent active'
                    key: 'pgsql.queries.query.time_sum["{#DBNAME}"]'
                - sortorder: '5'
                  drawtype: GRADIENT_LINE
                  color: 6C59DC
                  item:
                    host: 'PostgreSQL by Zabbix agent active'
                    key: 'pgsql.queries.tx.time_sum["{#DBNAME}"]'
            - uuid: 7d858a9a047b453096471773f8a31063
              name: 'DB [{#DBNAME}]: Slow queries'
              ymin_type_1: FIXED
              graph_items:
                - color: 199C0D
                  item:
                    host: 'PostgreSQL by Zabbix agent active'
                    key: 'pgsql.queries.mro.slow_count["{#DBNAME}"]'
                - sortorder: '1'
                  color: F63100
                  item:
                    host: 'PostgreSQL by Zabbix agent active'
                    key: 'pgsql.queries.query.slow_count["{#DBNAME}"]'
                - sortorder: '2'
                  color: 00611C
                  item:
                    host: 'PostgreSQL by Zabbix agent active'
                    key: 'pgsql.queries.tx.slow_count["{#DBNAME}"]'
            - uuid: 806181664b4b4e44b28a099b0281edad
              name: 'DB [{#DBNAME}]: Temp files'
              graph_items:
                - drawtype: GRADIENT_LINE
                  color: 199C0D
                  item:
                    host: 'PostgreSQL by Zabbix agent active'
                    key: 'pgsql.dbstat.temp_bytes.rate["{#DBNAME}"]'
                - sortorder: '1'
                  color: F63100
                  yaxisside: RIGHT
                  item:
                    host: 'PostgreSQL by Zabbix agent active'
                    key: 'pgsql.dbstat.temp_files.rate["{#DBNAME}"]'
            - uuid: e652d9ffb74b4abab75f811dd696bf21
              name: 'DB [{#DBNAME}]: Tuples'
              ymin_type_1: FIXED
              graph_items:
                - color: 199C0D
                  item:
                    host: 'PostgreSQL by Zabbix agent active'
                    key: 'pgsql.dbstat.tup_deleted.rate["{#DBNAME}"]'
                - sortorder: '1'
                  color: F63100
                  item:
                    host: 'PostgreSQL by Zabbix agent active'
                    key: 'pgsql.dbstat.tup_fetched.rate["{#DBNAME}"]'
                - sortorder: '2'
                  color: 00611C
                  item:
                    host: 'PostgreSQL by Zabbix agent active'
                    key: 'pgsql.dbstat.tup_inserted.rate["{#DBNAME}"]'
                - sortorder: '3'
                  color: F7941D
                  item:
                    host: 'PostgreSQL by Zabbix agent active'
                    key: 'pgsql.dbstat.tup_returned.rate["{#DBNAME}"]'
                - sortorder: '4'
                  color: FC6EA3
                  item:
                    host: 'PostgreSQL by Zabbix agent active'
                    key: 'pgsql.dbstat.tup_updated.rate["{#DBNAME}"]'
      tags:
        - tag: class
          value: database
        - tag: subclass
          value: sql
        - tag: target
          value: postgresql
      macros:
        - macro: '{$PG.CACHE_HITRATIO.MIN.WARN}'
          value: '90'
          description: 'Minimum cache hit ratio percentage for trigger expression.'
          config:
            type: TEXT
            priority: '12'
            section_name: Thresholds
            label: 'Minimum cache hit ratio percentage'
            description: 'Minimum cache hit ratio percentage for trigger expression. In the range from 0 to 100 inclusive.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$PG.CHECKPOINTS_REQ.MAX.WARN}'
          value: '5'
          description: 'Maximum required checkpoint occurrences for trigger expression.'
          config:
            type: TEXT
            priority: '13'
            section_name: Thresholds
            label: 'Maximum required checkpoint occurrences'
            description: 'Maximum required checkpoint occurrences for trigger expression. No less than 0.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$PG.CONFLICTS.MAX.WARN}'
          value: '0'
          description: 'Maximum number of recovery conflicts for trigger expression.'
          config:
            type: TEXT
            priority: '17'
            section_name: Thresholds
            label: 'Maximum number of recovery conflicts'
            description: 'Maximum number of recovery conflicts for trigger expression. No less than 0.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$PG.CONN_TOTAL_PCT.MAX.WARN}'
          value: '90'
          description: 'Maximum percentage of current connections for trigger expression.'
          config:
            type: TEXT
            priority: '14'
            section_name: Thresholds
            label: 'Maximum percentage of current connections'
            description: 'Maximum percentage of current connections for trigger expression. In the range from 0 to 100 inclusive.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$PG.DATABASE}'
          value: postgres
          description: 'Default PostgreSQL database for the connection.'
          config:
            type: TEXT
            priority: '5'
            label: 'Default PostgreSQL database for the connection'
            required: 'YES'
        - macro: '{$PG.DEADLOCKS.MAX.WARN}'
          value: '0'
          description: 'Maximum number of detected deadlocks for trigger expression.'
          config:
            type: TEXT
            priority: '15'
            section_name: Thresholds
            label: 'Maximum number of detected deadlocks'
            description: 'Maximum number of detected deadlocks for trigger expression. No less than 0.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$PG.FROZENXID_PCT_STOP.MIN.HIGH}'
          value: '75'
          description: 'Minimum frozen XID before stop percentage for trigger expression.'
          config:
            type: TEXT
            priority: '16'
            section_name: Thresholds
            label: 'Minimum frozen XID before stop percentage'
            description: 'Minimum frozen XID before stop percentage for trigger expression. In the range from 0 to 100 inclusive.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$PG.HOST}'
          value: localhost
          description: 'Hostname or IP of PostgreSQL host.'
          config:
            type: TEXT
            priority: '1'
            label: 'PostgreSQL host'
            description: 'Hostname or IP of PostgreSQL host.'
            required: 'YES'
        - macro: '{$PG.LLD.FILTER.DBNAME}'
          value: .+
          description: 'Filter of discoverable databases.'
          config:
            type: TEXT
            priority: '6'
            section_name: Filters
            label: 'Database name LLD filter'
            description: 'Filter of discoverable databases.'
        - macro: '{$PG.LOCKS.MAX.WARN}'
          value: '100'
          description: 'Maximum number of locks for trigger expression.'
          config:
            type: TEXT
            priority: '7'
            section_name: Thresholds
            label: 'Maximum number of locks'
            description: 'Maximum number of locks for trigger expression. No less than 0.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$PG.PASSWORD}'
          type: SECRET_TEXT
          description: 'PostgreSQL user password.'
          config:
            type: TEXT
            priority: '4'
            label: 'PostgreSQL user password'
            required: 'YES'
        - macro: '{$PG.PING_TIME.MAX.WARN}'
          value: 1s
          description: 'Maximum time of connection response for trigger expression.'
          config:
            type: TEXT
            priority: '8'
            section_name: Thresholds
            label: 'Maximum time of connection response'
            description: 'Maximum time of connection response for trigger expression.'
        - macro: '{$PG.PORT}'
          value: '5432'
          description: 'PostgreSQL service port.'
          config:
            type: TEXT
            priority: '2'
            label: 'PostgreSQL port'
            description: 'PostgreSQL service port. In the range from 1 to 65535 inclusive.'
            required: 'YES'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$PG.QUERY_ETIME.MAX.WARN}'
          value: '30'
          description: 'Execution time limit for count of slow queries.'
          config:
            type: TEXT
            priority: '9'
            section_name: Thresholds
            label: 'Slow queries execution time threshold'
            description: 'Execution time threshold for queries to be considered slow. No less than 0.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$PG.REPL_LAG.MAX.WARN}'
          value: 10m
          description: 'Maximum replication lag time for trigger expression.'
          config:
            type: TEXT
            priority: '10'
            section_name: Thresholds
            label: 'Maximum replication lag time'
            description: 'Maximum replication lag time for trigger expression.'
        - macro: '{$PG.SLOW_QUERIES.MAX.WARN}'
          value: '5'
          description: 'Slow queries count threshold for a trigger.'
          config:
            type: TEXT
            priority: '11'
            section_name: Thresholds
            label: 'Slow queries count threshold'
            description: 'Slow queries count threshold for a trigger. No less than 0.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$PG.USER}'
          value: zbx_monitor
          description: 'PostgreSQL username.'
          config:
            type: TEXT
            priority: '3'
            label: 'PostgreSQL username'
            required: 'YES'
      dashboards:
        - uuid: 1311b2e221bf4de49c394bf689333810
          name: 'PostgreSQL databases'
          pages:
            - widgets:
                - type: graphprototype
                  width: '36'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'PostgreSQL by Zabbix agent active'
                        name: 'DB [{#DBNAME}]: Tuples'
                    - type: STRING
                      name: reference
                      value: AAAAA
                - type: graphprototype
                  'y': '5'
                  width: '36'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'PostgreSQL by Zabbix agent active'
                        name: 'DB [{#DBNAME}]: Block hit/read'
                    - type: STRING
                      name: reference
                      value: AAAAC
                - type: graphprototype
                  'y': '10'
                  width: '36'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'PostgreSQL by Zabbix agent active'
                        name: 'DB [{#DBNAME}]: Locks'
                    - type: STRING
                      name: reference
                      value: AAAAE
                - type: graphprototype
                  'y': '15'
                  width: '36'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'PostgreSQL by Zabbix agent active'
                        name: 'DB [{#DBNAME}]: Queries'
                    - type: STRING
                      name: reference
                      value: AAAAG
                - type: graphprototype
                  x: '36'
                  width: '36'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'PostgreSQL by Zabbix agent active'
                        name: 'DB [{#DBNAME}]: Events'
                    - type: STRING
                      name: reference
                      value: AAAAB
                - type: graphprototype
                  x: '36'
                  'y': '5'
                  width: '36'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'PostgreSQL by Zabbix agent active'
                        name: 'DB [{#DBNAME}]: Temp files'
                    - type: STRING
                      name: reference
                      value: AAAAD
                - type: graphprototype
                  x: '36'
                  'y': '10'
                  width: '36'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'PostgreSQL by Zabbix agent active'
                        name: 'DB [{#DBNAME}]: Database size'
                    - type: STRING
                      name: reference
                      value: AAAAF
                - type: graphprototype
                  x: '36'
                  'y': '15'
                  width: '36'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'PostgreSQL by Zabbix agent active'
                        name: 'DB [{#DBNAME}]: Slow queries'
                    - type: STRING
                      name: reference
                      value: AAAAH
        - uuid: 2d6268f99f9748d18cb0bb4aee1fc550
          name: 'PostgreSQL stat'
          pages:
            - widgets:
                - type: graph
                  width: '36'
                  height: '5'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'PostgreSQL by Zabbix agent active'
                        name: 'PostgreSQL connections'
                    - type: STRING
                      name: reference
                      value: AAAAI
                - type: graph
                  'y': '5'
                  width: '36'
                  height: '5'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'PostgreSQL by Zabbix agent active'
                        name: 'PostgreSQL ping'
                    - type: STRING
                      name: reference
                      value: AAAAK
                - type: graph
                  'y': '10'
                  width: '36'
                  height: '5'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'PostgreSQL by Zabbix agent active'
                        name: 'PostgreSQL replication lag'
                    - type: STRING
                      name: reference
                      value: AAAAM
                - type: graph
                  'y': '15'
                  width: '36'
                  height: '5'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'PostgreSQL by Zabbix agent active'
                        name: 'PostgreSQL bgwriter'
                    - type: STRING
                      name: reference
                      value: AAAAO
                - type: graph
                  x: '36'
                  width: '36'
                  height: '5'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'PostgreSQL by Zabbix agent active'
                        name: 'PostgreSQL transactions'
                    - type: STRING
                      name: reference
                      value: AAAAJ
                - type: graph
                  x: '36'
                  'y': '5'
                  width: '36'
                  height: '5'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'PostgreSQL by Zabbix agent active'
                        name: 'PostgreSQL uptime'
                    - type: STRING
                      name: reference
                      value: AAAAL
                - type: graph
                  x: '36'
                  'y': '10'
                  width: '36'
                  height: '5'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'PostgreSQL by Zabbix agent active'
                        name: 'PostgreSQL WAL'
                    - type: STRING
                      name: reference
                      value: AAAAN
                - type: graph
                  x: '36'
                  'y': '15'
                  width: '36'
                  height: '5'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'PostgreSQL by Zabbix agent active'
                        name: 'PostgreSQL checkpoints'
                    - type: STRING
                      name: reference
                      value: AAAAP
      valuemaps:
        - uuid: 6337031a50574f65aec828b7dd48beaf
          name: 'PostgreSQL recovery role'
          mappings:
            - value: '0'
              newvalue: Master
            - value: '1'
              newvalue: Standby
        - uuid: 0e115837e8c54923ad10a9b7adcda3dd
          name: 'PostgreSQL replication status'
          mappings:
            - value: '0'
              newvalue: Down
            - value: '1'
              newvalue: Up
            - value: '2'
              newvalue: Master
        - uuid: 5bc68afd88094e0fb14572246050181f
          name: 'Service state'
          mappings:
            - value: '0'
              newvalue: Down
            - value: '1'
              newvalue: Up
    - uuid: 5fdd2ca8b8f84962aaea5a218b46ea7d
      template: 'Windows by Zabbix agent active'
      name: 'Windows by Zabbix agent active'
      description: |
        This is an official Windows template. It requires Zabbix agent 8.0 or newer.
        
        You can discuss this template or leave feedback on our forum https://www.zabbix.com/forum/zabbix-suggestions-and-feedback/387224-discussion-thread-for-official-zabbix-template-for-windows
        
        Generated by official Zabbix template tool "Templator"
      wizard_ready: 'YES'
      readme: |
        ## Overview
        
        This is an official Windows template. It requires Zabbix agent 8.0 or newer.
      vendor:
        name: Zabbix
        version: 8.0-0
      groups:
        - name: 'Templates/Operating systems'
      items:
        - uuid: 042ce35b908748c8bdd322f818c52c85
          name: 'Host name of Zabbix agent running'
          type: ZABBIX_ACTIVE
          key: agent.hostname
          delay: 1h
          value_type: CHAR
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1d
          tags:
            - tag: component
              value: system
        - uuid: bd8864ac5450401b9ad479c1ee455805
          name: 'Zabbix agent ping'
          type: ZABBIX_ACTIVE
          key: agent.ping
          description: 'The agent always returns "1" for this item. May be used in combination with `nodata()` for the availability check.'
          valuemap:
            name: 'Zabbix agent ping status'
          tags:
            - tag: component
              value: system
          triggers:
            - uuid: e77c3b1849b64d45a3078794057a2582
              expression: 'nodata(/Windows by Zabbix agent active/agent.ping,{$AGENT.NODATA_TIMEOUT})=1'
              name: 'Windows: Zabbix agent is not available'
              event_name: 'Windows: Zabbix agent is not available (or nodata for {$AGENT.NODATA_TIMEOUT})'
              priority: AVERAGE
              description: 'For active agents, `nodata()` with `agent.ping` is used with `{$AGENT.NODATA_TIMEOUT}` as a time threshold.'
              manual_close: 'YES'
              tags:
                - tag: scope
                  value: availability
        - uuid: 41cec8b443a94efc9ebca6f66c46ad8a
          name: 'Version of Zabbix agent running'
          type: ZABBIX_ACTIVE
          key: agent.version
          delay: 1h
          value_type: CHAR
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1d
          tags:
            - tag: component
              value: application
        - uuid: 20dceb831b1a4d63af7635656239c495
          name: 'Cache bytes'
          type: ZABBIX_ACTIVE
          key: 'perf_counter_en["\Memory\Cache Bytes"]'
          units: B
          description: 'Cache Bytes is the sum of the Memory\\System Cache Resident Bytes, Memory\\System Driver Resident Bytes, Memory\\System Code Resident Bytes, and Memory\\Pool Paged Resident Bytes counters. This counter displays the last observed value only; it is not an average.'
          tags:
            - tag: component
              value: memory
        - uuid: 71bb18af403248c7818d16444a2eec06
          name: 'Free system page table entries'
          type: ZABBIX_ACTIVE
          key: 'perf_counter_en["\Memory\Free System Page Table Entries"]'
          description: 'This indicates the number of page table entries not currently in use by the system. If the number is less than 5,000, there may be a memory leak or you running out of memory.'
          tags:
            - tag: component
              value: memory
          triggers:
            - uuid: 37d6b965dd184b66b37018d4375d3e56
              expression: 'max(/Windows by Zabbix agent active/perf_counter_en["\Memory\Free System Page Table Entries"],5m)<{$MEM.PAGE_TABLE_CRIT.MIN}'
              name: 'Windows: Number of free system page table entries is too low'
              event_name: 'Windows: Number of free system page table entries is too low (less {$MEM.PAGE_TABLE_CRIT.MIN} for 5m)'
              priority: WARNING
              description: '`Memory\Free System Page Table Entries` has been less than `{$MEM.PAGE_TABLE_CRIT.MIN}` for 5 minutes. If the number is less than 5,000, there may be a memory leak.'
              dependencies:
                - name: 'Windows: High memory utilization'
                  expression: 'min(/Windows by Zabbix agent active/vm.memory.util,5m)>{$MEMORY.UTIL.MAX}'
              tags:
                - tag: scope
                  value: capacity
        - uuid: 19ec57305ba34ed890e2e4c8a500a214
          name: 'Memory page faults per second'
          type: ZABBIX_ACTIVE
          key: 'perf_counter_en["\Memory\Page Faults/sec"]'
          value_type: FLOAT
          description: 'Page Faults/sec is the average number of pages faulted per second. It is measured in number of pages faulted per second because only one page is faulted in each fault operation, hence this is also equal to the number of page fault operations. This counter includes both hard faults (those that require disk access) and soft faults (where the faulted page is found elsewhere in physical memory.) Most processors can handle large numbers of soft faults without significant consequence. However, hard faults, which require disk access, can cause significant delays.'
          tags:
            - tag: component
              value: memory
        - uuid: 920faa3a434d46d48f99395e16ef04ec
          name: 'Memory pages per second'
          type: ZABBIX_ACTIVE
          key: 'perf_counter_en["\Memory\Pages/sec"]'
          value_type: FLOAT
          description: |
            This measures the rate at which pages are read from or written to disk to resolve hard page faults.
            If the value is greater than 1,000, as a result of excessive paging, there may be a memory leak.
          tags:
            - tag: component
              value: memory
          triggers:
            - uuid: 05da8b30835e440fb1228fb9a0bc24a4
              expression: 'min(/Windows by Zabbix agent active/perf_counter_en["\Memory\Pages/sec"],5m)>{$MEM.PAGE_SEC.CRIT.MAX}'
              name: 'Windows: The Memory Pages/sec is too high'
              event_name: 'Windows: The Memory Pages/sec is too high (over {$MEM.PAGE_SEC.CRIT.MAX} for 5m)'
              priority: WARNING
              description: 'The Memory Pages/sec in the last 5 minutes exceeds `{$MEM.PAGE_SEC.CRIT.MAX}`. If the value is greater than 1,000, as a result of excessive paging, there may be a memory leak.'
              dependencies:
                - name: 'Windows: High memory utilization'
                  expression: 'min(/Windows by Zabbix agent active/vm.memory.util,5m)>{$MEMORY.UTIL.MAX}'
              tags:
                - tag: scope
                  value: capacity
        - uuid: 3af0a0717da747849c2b5a2ebfa61a2c
          name: 'Memory pool non-paged'
          type: ZABBIX_ACTIVE
          key: 'perf_counter_en["\Memory\Pool Nonpaged Bytes"]'
          units: B
          description: |
            This measures the size, in bytes, of the non-paged pool. This is an area of system memory for objects that cannot be written to disk but instead must remain in physical memory as long as they are allocated.
            There is a possible memory leak if the value is greater than 175MB (or 100MB with the /3GB switch). Consequently, Event ID 2019 is recorded in the system event log.
          tags:
            - tag: component
              value: memory
        - uuid: 4f7b86eff6c84193a2f9187fff578416
          name: 'Used swap space in %'
          type: ZABBIX_ACTIVE
          key: 'perf_counter_en["\Paging file(_Total)\% Usage"]'
          value_type: FLOAT
          units: '%'
          description: 'The used space of swap volume/file in percent.'
          tags:
            - tag: component
              value: memory
            - tag: component
              value: storage
        - uuid: 553249b52ca7492c87386d051ec53db9
          name: 'CPU DPC time'
          type: ZABBIX_ACTIVE
          key: 'perf_counter_en["\Processor Information(_total)\% DPC Time"]'
          value_type: FLOAT
          units: '%'
          description: 'Processor DPC time is the time that a single processor spent receiving and servicing deferred procedure calls (DPCs). DPCs are interrupts that run at a lower priority than standard interrupts. `% DPC Time` is a component of `% Privileged Time` because DPCs are executed in privileged mode. If a high `% DPC Time` is sustained, there may be a processor bottleneck or an application or hardware related issue that can significantly diminish overall system performance.'
          tags:
            - tag: component
              value: cpu
        - uuid: 32a32b9fea5d49989668a96bc52db87b
          name: 'CPU interrupt time'
          type: ZABBIX_ACTIVE
          key: 'perf_counter_en["\Processor Information(_total)\% Interrupt Time"]'
          value_type: FLOAT
          units: '%'
          description: 'The processor information `% Interrupt Time` counter indicates how much time the processor spends handling hardware interrupts during sample intervals. It reflects the activity of devices like the system clock, mouse, disk drivers, and network cards. A value above 20% suggests possible hardware issues.'
          tags:
            - tag: component
              value: cpu
          triggers:
            - uuid: 2eb661f6a42f40ce8cc25cef542763a9
              expression: 'min(/Windows by Zabbix agent active/perf_counter_en["\Processor Information(_total)\% Interrupt Time"],5m)>{$CPU.INTERRUPT.CRIT.MAX}'
              name: 'Windows: CPU interrupt time is too high'
              event_name: 'Windows: CPU interrupt time is too high (over {$CPU.INTERRUPT.CRIT.MAX}% for 5m)'
              priority: WARNING
              description: 'The CPU Interrupt Time in the last 5 minutes exceeds `{$CPU.INTERRUPT.CRIT.MAX}`%.'
              dependencies:
                - name: 'Windows: High CPU utilization'
                  expression: 'min(/Windows by Zabbix agent active/system.cpu.util,5m)>{$CPU.UTIL.CRIT}'
              tags:
                - tag: scope
                  value: performance
        - uuid: 0747e92e52cc4a6a9b83c6f94889bff1
          name: 'CPU privileged time'
          type: ZABBIX_ACTIVE
          key: 'perf_counter_en["\Processor Information(_total)\% Privileged Time"]'
          value_type: FLOAT
          units: '%'
          description: 'The processor information `% Privileged Time` counter shows the percent of time that the processor is spent executing in Kernel (or Privileged) mode. Privileged mode includes services interrupts inside Interrupt Service Routines (ISRs), executing Deferred Procedure Calls (DPCs), Device Driver calls and other kernel-mode functions of the Windows Operating System.'
          tags:
            - tag: component
              value: cpu
          triggers:
            - uuid: cee69c70da6a415186b922305d0cabdc
              expression: 'min(/Windows by Zabbix agent active/perf_counter_en["\Processor Information(_total)\% Privileged Time"],5m)>{$CPU.PRIV.CRIT.MAX}'
              name: 'Windows: CPU privileged time is too high'
              event_name: 'Windows: CPU privileged time is too high (over {$CPU.PRIV.CRIT.MAX}% for 5m)'
              priority: WARNING
              description: 'The CPU privileged time in the last 5 minutes exceeds {$CPU.PRIV.CRIT.MAX}%.'
              dependencies:
                - name: 'Windows: CPU interrupt time is too high'
                  expression: 'min(/Windows by Zabbix agent active/perf_counter_en["\Processor Information(_total)\% Interrupt Time"],5m)>{$CPU.INTERRUPT.CRIT.MAX}'
                - name: 'Windows: High CPU utilization'
                  expression: 'min(/Windows by Zabbix agent active/system.cpu.util,5m)>{$CPU.UTIL.CRIT}'
              tags:
                - tag: scope
                  value: performance
        - uuid: 954a81efad4c4791bee052194b900268
          name: 'CPU user time'
          type: ZABBIX_ACTIVE
          key: 'perf_counter_en["\Processor Information(_total)\% User Time"]'
          value_type: FLOAT
          units: '%'
          description: 'The processor information `% User Time` counter shows the percent of time that the processor(s) is spent executing in User mode.'
          tags:
            - tag: component
              value: cpu
        - uuid: f23957a6fb9a44a3a7010b19b16e77b5
          name: 'Context switches per second'
          type: ZABBIX_ACTIVE
          key: 'perf_counter_en["\System\Context Switches/sec"]'
          value_type: FLOAT
          description: |
            Context Switches/sec is the combined rate at which all processors on the computer are switched from one thread to another.
            Context switches occur when a running thread voluntarily relinquishes the processor, is preempted by a higher priority ready thread, or switches between user-mode and privileged (kernel) mode to use an Executive or subsystem service.
            It is the sum of Thread\\Context Switches/sec for all threads running on all processors in the computer and is measured in numbers of switches.
            There are context switch counters on the System and Thread objects. This counter displays the difference between the values observed in the last two samples, divided by the duration of the sample interval.
          tags:
            - tag: component
              value: cpu
        - uuid: c1da358e5c8f40279c703d93896aa571
          name: 'CPU queue length'
          type: ZABBIX_ACTIVE
          key: 'perf_counter_en["\System\Processor Queue Length"]'
          value_type: FLOAT
          description: 'The Processor Queue Length shows the number of threads that are observed as delayed in the processor Ready Queue and are waiting to be executed.'
          tags:
            - tag: component
              value: cpu
        - uuid: c738b97ec0dc49f380ed0e4a27ae9bb6
          name: 'Number of threads'
          type: ZABBIX_ACTIVE
          key: 'perf_counter_en["\System\Threads"]'
          description: 'The number of threads used by all running processes.'
          tags:
            - tag: component
              value: os
        - uuid: 5229689338ae4a559d3c94a98032131e
          name: 'Number of processes'
          type: ZABBIX_ACTIVE
          key: 'proc.num[]'
          description: 'The number of processes.'
          tags:
            - tag: component
              value: os
        - uuid: 0f3ffe45092d461a91a1296cd6cfb19f
          name: 'CPU utilization'
          type: ZABBIX_ACTIVE
          key: system.cpu.util
          value_type: FLOAT
          units: '%'
          description: 'CPU utilization expressed in %.'
          tags:
            - tag: component
              value: cpu
          triggers:
            - uuid: ab3cbf18088a4d7a82f6c678ce49ffce
              expression: 'min(/Windows by Zabbix agent active/system.cpu.util,5m)>{$CPU.UTIL.CRIT}'
              name: 'Windows: High CPU utilization'
              event_name: 'Windows: High CPU utilization (over {$CPU.UTIL.CRIT}% for 5m)'
              opdata: 'Current utilization: {ITEM.LASTVALUE1}'
              priority: WARNING
              description: 'CPU utilization is too high. The system might be slow to respond.'
              tags:
                - tag: scope
                  value: performance
        - uuid: 5d99b356e30444a0b99e597506f35a69
          name: 'System name'
          type: ZABBIX_ACTIVE
          key: system.hostname
          delay: 1h
          value_type: CHAR
          description: 'The host name of the system.'
          inventory_link: NAME
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1d
          tags:
            - tag: component
              value: system
          triggers:
            - uuid: 3aea75603e584d2f9dc96e7f3cc2b7fa
              expression: 'change(/Windows by Zabbix agent active/system.hostname) and length(last(/Windows by Zabbix agent active/system.hostname))>0'
              name: 'Windows: System name has changed'
              event_name: 'Windows: System name has changed (new name: {ITEM.VALUE})'
              priority: INFO
              description: 'The name of the system has changed. Acknowledge to close the problem manually.'
              manual_close: 'YES'
              tags:
                - tag: scope
                  value: notice
        - uuid: 89f928affba54c4a8dc7abead09cac68
          name: 'System local time'
          type: ZABBIX_ACTIVE
          key: system.localtime
          units: unixtime
          description: 'The local system time of the host.'
          tags:
            - tag: component
              value: system
        - uuid: 16a7ae509f0c4f9d8631efae88fe6324
          name: 'Operating system architecture'
          type: ZABBIX_ACTIVE
          key: system.sw.arch
          delay: 1h
          value_type: CHAR
          description: 'The architecture of the operating system.'
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1d
          tags:
            - tag: component
              value: os
        - uuid: 5159e7263d7a42e499380b70e9d6490a
          name: 'Operating system'
          type: ZABBIX_ACTIVE
          key: system.sw.os
          delay: 1h
          value_type: CHAR
          inventory_link: OS
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1d
          tags:
            - tag: component
              value: os
          triggers:
            - uuid: 01bbea22605947dca9638229cf56e4e1
              expression: 'change(/Windows by Zabbix agent active/system.sw.os) and length(last(/Windows by Zabbix agent active/system.sw.os))>0'
              name: 'Windows: Operating system description has changed'
              priority: INFO
              description: 'The description of the operating system has changed. Possible reasons are that the system has been updated or replaced. Acknowledge to close the problem manually.'
              manual_close: 'YES'
              dependencies:
                - name: 'Windows: System name has changed'
                  expression: 'change(/Windows by Zabbix agent active/system.hostname) and length(last(/Windows by Zabbix agent active/system.hostname))>0'
              tags:
                - tag: scope
                  value: notice
        - uuid: 9d6f14cc540846ab98052bf741a4247b
          name: 'Free swap space'
          type: CALCULATED
          key: system.swap.free
          units: B
          params: 'last(//system.swap.size[,total]) - last(//system.swap.size[,total]) / 100 * last(//perf_counter_en["\Paging file(_Total)\% Usage"])'
          description: 'The free space of the swap volume/file expressed in bytes.'
          tags:
            - tag: component
              value: memory
            - tag: component
              value: storage
        - uuid: e91b5f08c6b745bca975797ea4abd02a
          name: 'Free swap space in %'
          type: DEPENDENT
          key: system.swap.pfree
          value_type: FLOAT
          units: '%'
          description: 'The free space of the swap volume/file expressed in %.'
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - 'return (100 - value)'
          master_item:
            key: 'perf_counter_en["\Paging file(_Total)\% Usage"]'
          tags:
            - tag: component
              value: memory
            - tag: component
              value: storage
        - uuid: b5af29f7b8ee451895b49c0444e929f4
          name: 'Total swap space'
          type: ZABBIX_ACTIVE
          key: 'system.swap.size[,total]'
          units: B
          description: 'The total space of the swap volume/file expressed in bytes.'
          tags:
            - tag: component
              value: memory
            - tag: component
              value: storage
        - uuid: 8fa1259420ad486ab6e2520c9b047073
          name: 'System description'
          type: ZABBIX_ACTIVE
          key: system.uname
          delay: 15m
          value_type: CHAR
          description: 'System description of the host.'
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1d
          tags:
            - tag: component
              value: system
        - uuid: 695053710ea14cc48692b5cb260d0dfb
          name: Uptime
          type: ZABBIX_ACTIVE
          key: system.uptime
          delay: 30s
          trends: '0'
          units: uptime
          description: 'The system uptime expressed in the following format: "N days, hh:mm:ss".'
          tags:
            - tag: component
              value: system
          triggers:
            - uuid: 4114e248a3b347f4a2fefc7816f2e940
              expression: 'last(/Windows by Zabbix agent active/system.uptime)<10m'
              name: 'Windows: Host has been restarted'
              event_name: 'Windows: Host has been restarted (uptime < 10m)'
              priority: WARNING
              description: 'The device uptime is less than 10 minutes.'
              manual_close: 'YES'
              tags:
                - tag: scope
                  value: notice
        - uuid: 60a17a94a9ad4e4192547d0a6a1e1d25
          name: 'Get filesystems'
          type: ZABBIX_ACTIVE
          key: vfs.fs.get
          history: '0'
          value_type: TEXT
          description: 'The `vfs.fs.get` key acquires raw information set about the filesystems. Later to be extracted by preprocessing in dependent items.'
          tags:
            - tag: component
              value: raw
        - uuid: 83185781999742268a7742695c5d3ee3
          name: 'Total memory'
          type: ZABBIX_ACTIVE
          key: 'vm.memory.size[total]'
          units: B
          description: 'Total memory expressed in bytes.'
          tags:
            - tag: component
              value: memory
        - uuid: f85ec8917f084c7d9b6bc36e186d74d6
          name: 'Used memory'
          type: ZABBIX_ACTIVE
          key: 'vm.memory.size[used]'
          units: B
          description: 'Used memory in bytes.'
          tags:
            - tag: component
              value: memory
        - uuid: 9b62965a4670472b8c672dc1021bb8fd
          name: 'Memory utilization'
          type: CALCULATED
          key: vm.memory.util
          value_type: FLOAT
          units: '%'
          params: 'last(//vm.memory.size[used]) / last(//vm.memory.size[total]) * 100'
          description: 'Memory utilization in %.'
          tags:
            - tag: component
              value: memory
          triggers:
            - uuid: 610a0893be834c11b35a0472dcabab7c
              expression: 'min(/Windows by Zabbix agent active/vm.memory.util,5m)>{$MEMORY.UTIL.MAX}'
              name: 'Windows: High memory utilization'
              event_name: 'Windows: High memory utilization (>{$MEMORY.UTIL.MAX}% for 5m)'
              priority: AVERAGE
              description: 'The system is running out of free memory.'
              tags:
                - tag: scope
                  value: capacity
                - tag: scope
                  value: performance
        - uuid: c35940d1a12e4b96b7114ac8dbbfcec4
          name: 'Windows: Network interfaces WMI get'
          type: ZABBIX_ACTIVE
          key: 'wmi.getall[root\cimv2,"select Name,Description,NetConnectionID,Speed,AdapterTypeId,NetConnectionStatus,GUID from win32_networkadapter where PhysicalAdapter=True and NetConnectionStatus>0"]'
          history: '0'
          value_type: TEXT
          description: 'Raw data of `win32_networkadapter.`'
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          tags:
            - tag: component
              value: raw
        - uuid: 3dcf69f6637f496ca0406e0ed403f03c
          name: 'Number of cores'
          type: ZABBIX_ACTIVE
          key: 'wmi.get[root/cimv2,"Select NumberOfLogicalProcessors from Win32_ComputerSystem"]'
          description: 'The number of logical processors available on the computer.'
          tags:
            - tag: component
              value: cpu
        - uuid: 1ac6ebdb5c98415b94cb44da5feeac7f
          name: 'Active agent availability'
          type: INTERNAL
          key: 'zabbix[host,active_agent,available]'
          description: |
            Availability of active checks on the host. The value of this item corresponds to availability icons in the host list.
            Possible values:
            0 - unknown
            1 - available
            2 - not available
          valuemap:
            name: zabbix.host.active_agent.available
          tags:
            - tag: component
              value: health
            - tag: component
              value: network
          triggers:
            - uuid: bad86dfaf5274927bce35ad314a2d21a
              expression: 'min(/Windows by Zabbix agent active/zabbix[host,active_agent,available],{$AGENT.TIMEOUT})=2'
              name: 'Windows: Active checks are not available'
              opdata: 'Current state: {ITEM.LASTVALUE1}'
              priority: HIGH
              description: 'Active checks are considered unavailable. Agent has not sent a heartbeat for a prolonged time.'
              tags:
                - tag: scope
                  value: availability
      discovery_rules:
        - uuid: c05c8d1be5614ffab1688cc92db32f12
          name: 'Network interfaces discovery'
          type: DEPENDENT
          key: net.if.discovery
          filter:
            evaltype: AND
            conditions:
              - macro: '{#IFALIAS}'
                value: '{$NET.IF.IFALIAS.MATCHES}'
              - macro: '{#IFALIAS}'
                value: '{$NET.IF.IFALIAS.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
              - macro: '{#IFDESCR}'
                value: '{$NET.IF.IFDESCR.MATCHES}'
              - macro: '{#IFDESCR}'
                value: '{$NET.IF.IFDESCR.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
              - macro: '{#IFNAME}'
                value: '{$NET.IF.IFNAME.MATCHES}'
              - macro: '{#IFNAME}'
                value: '{$NET.IF.IFNAME.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          description: 'Discovery of installed network interfaces.'
          item_prototypes:
            - uuid: 344f0ce5ba5244cb90cc08db556e6f9c
              name: 'Interface {#IFNAME}({#IFALIAS}): Inbound packets discarded'
              type: ZABBIX_ACTIVE
              key: 'net.if.in["{#IFGUID}",dropped]'
              delay: 3m
              description: 'The number of incoming packets dropped on the network interface.'
              preprocessing:
                - type: CHANGE_PER_SECOND
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#IFALIAS}'
                - tag: interface
                  value: '{#IFNAME}'
            - uuid: a2461163f9b44b678008e3d5fd96a168
              name: 'Interface {#IFNAME}({#IFALIAS}): Inbound packets with errors'
              type: ZABBIX_ACTIVE
              key: 'net.if.in["{#IFGUID}",errors]'
              delay: 3m
              description: 'The number of incoming packets with errors on the network interface.'
              preprocessing:
                - type: CHANGE_PER_SECOND
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#IFALIAS}'
                - tag: interface
                  value: '{#IFNAME}'
            - uuid: a8f69dac86d646b194f9b204f22aeb3b
              name: 'Interface {#IFNAME}({#IFALIAS}): Bits received'
              type: ZABBIX_ACTIVE
              key: 'net.if.in["{#IFGUID}"]'
              delay: 3m
              units: bps
              description: 'Incoming traffic on the network interface.'
              preprocessing:
                - type: CHANGE_PER_SECOND
                - type: MULTIPLIER
                  parameters:
                    - '8'
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#IFALIAS}'
                - tag: interface
                  value: '{#IFNAME}'
            - uuid: 46d947876b844223bb500f29cbf82273
              name: 'Interface {#IFNAME}({#IFALIAS}): Outbound packets discarded'
              type: ZABBIX_ACTIVE
              key: 'net.if.out["{#IFGUID}",dropped]'
              delay: 3m
              description: 'The number of outgoing packets dropped on the network interface.'
              preprocessing:
                - type: CHANGE_PER_SECOND
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#IFALIAS}'
                - tag: interface
                  value: '{#IFNAME}'
            - uuid: 1f5854d4ad5d4b65b63e5ca9ffa5007c
              name: 'Interface {#IFNAME}({#IFALIAS}): Outbound packets with errors'
              type: ZABBIX_ACTIVE
              key: 'net.if.out["{#IFGUID}",errors]'
              delay: 3m
              description: 'The number of outgoing packets with errors on the network interface.'
              preprocessing:
                - type: CHANGE_PER_SECOND
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#IFALIAS}'
                - tag: interface
                  value: '{#IFNAME}'
            - uuid: 1adceed263804e089108bb2cc1aa51e1
              name: 'Interface {#IFNAME}({#IFALIAS}): Bits sent'
              type: ZABBIX_ACTIVE
              key: 'net.if.out["{#IFGUID}"]'
              delay: 3m
              units: bps
              description: 'Outgoing traffic on the network interface.'
              preprocessing:
                - type: CHANGE_PER_SECOND
                - type: MULTIPLIER
                  parameters:
                    - '8'
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#IFALIAS}'
                - tag: interface
                  value: '{#IFNAME}'
            - uuid: 820ca9809e6f46af8aa3f41195f246d9
              name: 'Interface {#IFNAME}({#IFALIAS}): Speed'
              type: DEPENDENT
              key: 'net.if.speed["{#IFGUID}"]'
              trends: '0'
              units: bps
              description: 'Estimated bandwidth of the network interface if any.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$[?(@.GUID == "{#IFGUID}")].Speed.first()'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '0'
                - type: JAVASCRIPT
                  parameters:
                    - 'return (value==''9223372036854775807'' ? 0 : value)'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'wmi.getall[root\cimv2,"select Name,Description,NetConnectionID,Speed,AdapterTypeId,NetConnectionStatus,GUID from win32_networkadapter where PhysicalAdapter=True and NetConnectionStatus>0"]'
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#IFALIAS}'
                - tag: interface
                  value: '{#IFNAME}'
            - uuid: 929917f16ecd4369a5535fe8178248d6
              name: 'Interface {#IFNAME}({#IFALIAS}): Operational status'
              type: DEPENDENT
              key: 'net.if.status["{#IFGUID}"]'
              trends: '0'
              description: 'The operational status of the network interface.'
              valuemap:
                name: 'Win32_NetworkAdapter::NetConnectionStatus'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$[?(@.GUID == "{#IFGUID}")].NetConnectionStatus.first()'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1d
              master_item:
                key: 'wmi.getall[root\cimv2,"select Name,Description,NetConnectionID,Speed,AdapterTypeId,NetConnectionStatus,GUID from win32_networkadapter where PhysicalAdapter=True and NetConnectionStatus>0"]'
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#IFALIAS}'
                - tag: interface
                  value: '{#IFNAME}'
              trigger_prototypes:
                - uuid: f9d1ac2feb0e43249cc849166ca9014c
                  expression: '{$IFCONTROL:"{#IFNAME}"}=1 and last(/Windows by Zabbix agent active/net.if.status["{#IFGUID}"])<>2 and (last(/Windows by Zabbix agent active/net.if.status["{#IFGUID}"],#1)<>last(/Windows by Zabbix agent active/net.if.status["{#IFGUID}"],#2))'
                  recovery_mode: RECOVERY_EXPRESSION
                  recovery_expression: 'last(/Windows by Zabbix agent active/net.if.status["{#IFGUID}"])=2 or {$IFCONTROL:"{#IFNAME}"}=0'
                  name: 'Windows: Interface {#IFNAME}({#IFALIAS}): Link down'
                  opdata: 'Current state: {ITEM.LASTVALUE1}'
                  priority: AVERAGE
                  description: |
                    This trigger expression works as follows:
                    1. It can be triggered if the operations status is down.
                    2. `{$IFCONTROL:"{#IFNAME}"}=1` - a user can redefine the context macro to "0", marking this interface as not important.
                    No new trigger will be fired if this interface is down.
                    3. `last(/TEMPLATE_NAME/METRIC,#1)<>last(/TEMPLATE_NAME/METRIC,#2)` - the trigger fires only if the operational status was up to (1) sometime before (so, does not fire for "eternal off" interfaces.)
                    
                    WARNING: if closed manually - it will not fire again on the next poll, because of .diff.
                  manual_close: 'YES'
                  tags:
                    - tag: scope
                      value: availability
            - uuid: 1e513ffd8cd24a39a04b2140dce65b62
              name: 'Interface {#IFNAME}({#IFALIAS}): Interface type'
              type: DEPENDENT
              key: 'net.if.type["{#IFGUID}"]'
              trends: '0'
              description: 'The type of the network interface.'
              valuemap:
                name: 'Win32_NetworkAdapter::AdapterTypeId'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$[?(@.GUID == "{#IFGUID}")].AdapterTypeId.first()'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1d
              master_item:
                key: 'wmi.getall[root\cimv2,"select Name,Description,NetConnectionID,Speed,AdapterTypeId,NetConnectionStatus,GUID from win32_networkadapter where PhysicalAdapter=True and NetConnectionStatus>0"]'
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#IFALIAS}'
                - tag: interface
                  value: '{#IFNAME}'
          trigger_prototypes:
            - uuid: 27a60f88cbd0457291153105ace75e4d
              expression: |
                change(/Windows by Zabbix agent active/net.if.speed["{#IFGUID}"])<0 and
                last(/Windows by Zabbix agent active/net.if.speed["{#IFGUID}"])>0 and
                last(/Windows by Zabbix agent active/net.if.status["{#IFGUID}"])=2
              name: 'Windows: Interface {#IFNAME}({#IFALIAS}): Ethernet has changed to lower speed than it was before'
              opdata: 'Current reported speed: {ITEM.LASTVALUE1}'
              priority: INFO
              description: 'This Ethernet connection has transitioned down from its known maximum speed. This might be a sign of autonegotiation issues. Acknowledge to close the problem manually.'
              manual_close: 'YES'
              dependencies:
                - name: 'Windows: Interface {#IFNAME}({#IFALIAS}): Link down'
                  expression: '{$IFCONTROL:"{#IFNAME}"}=1 and last(/Windows by Zabbix agent active/net.if.status["{#IFGUID}"])<>2 and (last(/Windows by Zabbix agent active/net.if.status["{#IFGUID}"],#1)<>last(/Windows by Zabbix agent active/net.if.status["{#IFGUID}"],#2))'
                  recovery_expression: 'last(/Windows by Zabbix agent active/net.if.status["{#IFGUID}"])=2 or {$IFCONTROL:"{#IFNAME}"}=0'
              tags:
                - tag: scope
                  value: capacity
            - uuid: a9ead42a45f5496a84a6a2bc619cece4
              expression: |
                (avg(/Windows by Zabbix agent active/net.if.in["{#IFGUID}"],15m)>({$IF.UTIL.MAX:"{#IFNAME}"}/100)*last(/Windows by Zabbix agent active/net.if.speed["{#IFGUID}"]) or
                avg(/Windows by Zabbix agent active/net.if.out["{#IFGUID}"],15m)>({$IF.UTIL.MAX:"{#IFNAME}"}/100)*last(/Windows by Zabbix agent active/net.if.speed["{#IFGUID}"])) and
                last(/Windows by Zabbix agent active/net.if.speed["{#IFGUID}"])>0
              recovery_mode: RECOVERY_EXPRESSION
              recovery_expression: |
                avg(/Windows by Zabbix agent active/net.if.in["{#IFGUID}"],15m)<(({$IF.UTIL.MAX:"{#IFNAME}"}-3)/100)*last(/Windows by Zabbix agent active/net.if.speed["{#IFGUID}"]) and
                avg(/Windows by Zabbix agent active/net.if.out["{#IFGUID}"],15m)<(({$IF.UTIL.MAX:"{#IFNAME}"}-3)/100)*last(/Windows by Zabbix agent active/net.if.speed["{#IFGUID}"])
              name: 'Windows: Interface {#IFNAME}({#IFALIAS}): High bandwidth usage'
              event_name: 'Windows: Interface {#IFNAME}({#IFALIAS}): High bandwidth usage (>{$IF.UTIL.MAX:"{#IFNAME}"}%)'
              opdata: 'In: {ITEM.LASTVALUE1}, out: {ITEM.LASTVALUE3}, speed: {ITEM.LASTVALUE2}'
              priority: WARNING
              description: 'The utilization of the network interface is close to its estimated maximum bandwidth.'
              manual_close: 'YES'
              dependencies:
                - name: 'Windows: Interface {#IFNAME}({#IFALIAS}): Link down'
                  expression: '{$IFCONTROL:"{#IFNAME}"}=1 and last(/Windows by Zabbix agent active/net.if.status["{#IFGUID}"])<>2 and (last(/Windows by Zabbix agent active/net.if.status["{#IFGUID}"],#1)<>last(/Windows by Zabbix agent active/net.if.status["{#IFGUID}"],#2))'
                  recovery_expression: 'last(/Windows by Zabbix agent active/net.if.status["{#IFGUID}"])=2 or {$IFCONTROL:"{#IFNAME}"}=0'
              tags:
                - tag: scope
                  value: performance
            - uuid: 1945fd9bc15c471fb050d0a5430245a6
              expression: |
                min(/Windows by Zabbix agent active/net.if.in["{#IFGUID}",errors],5m)>{$IF.ERRORS.WARN:"{#IFNAME}"}
                or min(/Windows by Zabbix agent active/net.if.out["{#IFGUID}",errors],5m)>{$IF.ERRORS.WARN:"{#IFNAME}"}
              recovery_mode: RECOVERY_EXPRESSION
              recovery_expression: |
                max(/Windows by Zabbix agent active/net.if.in["{#IFGUID}",errors],5m)<{$IF.ERRORS.WARN:"{#IFNAME}"}*0.8
                and max(/Windows by Zabbix agent active/net.if.out["{#IFGUID}",errors],5m)<{$IF.ERRORS.WARN:"{#IFNAME}"}*0.8
              name: 'Windows: Interface {#IFNAME}({#IFALIAS}): High error rate'
              event_name: 'Windows: Interface {#IFNAME}({#IFALIAS}): High error rate (>{$IF.ERRORS.WARN:"{#IFNAME}"} for 5m)'
              opdata: 'errors in: {ITEM.LASTVALUE1}, errors out: {ITEM.LASTVALUE2}'
              priority: WARNING
              description: 'It recovers when it is below 80% of the `{$IF.ERRORS.WARN:"{#IFNAME}"}` threshold.'
              manual_close: 'YES'
              dependencies:
                - name: 'Windows: Interface {#IFNAME}({#IFALIAS}): Link down'
                  expression: '{$IFCONTROL:"{#IFNAME}"}=1 and last(/Windows by Zabbix agent active/net.if.status["{#IFGUID}"])<>2 and (last(/Windows by Zabbix agent active/net.if.status["{#IFGUID}"],#1)<>last(/Windows by Zabbix agent active/net.if.status["{#IFGUID}"],#2))'
                  recovery_expression: 'last(/Windows by Zabbix agent active/net.if.status["{#IFGUID}"])=2 or {$IFCONTROL:"{#IFNAME}"}=0'
              tags:
                - tag: scope
                  value: availability
          graph_prototypes:
            - uuid: 1181f5ffedb643d4953c9fd5df14a21e
              name: 'Interface {#IFNAME}({#IFALIAS}): Network traffic'
              graph_items:
                - drawtype: GRADIENT_LINE
                  color: 199C0D
                  item:
                    host: 'Windows by Zabbix agent active'
                    key: 'net.if.in["{#IFGUID}"]'
                - sortorder: '1'
                  drawtype: BOLD_LINE
                  color: F63100
                  item:
                    host: 'Windows by Zabbix agent active'
                    key: 'net.if.out["{#IFGUID}"]'
                - sortorder: '2'
                  color: 00611C
                  yaxisside: RIGHT
                  item:
                    host: 'Windows by Zabbix agent active'
                    key: 'net.if.out["{#IFGUID}",errors]'
                - sortorder: '3'
                  color: F7941D
                  yaxisside: RIGHT
                  item:
                    host: 'Windows by Zabbix agent active'
                    key: 'net.if.in["{#IFGUID}",errors]'
                - sortorder: '4'
                  color: FC6EA3
                  yaxisside: RIGHT
                  item:
                    host: 'Windows by Zabbix agent active'
                    key: 'net.if.out["{#IFGUID}",dropped]'
                - sortorder: '5'
                  color: 6C59DC
                  yaxisside: RIGHT
                  item:
                    host: 'Windows by Zabbix agent active'
                    key: 'net.if.in["{#IFGUID}",dropped]'
          master_item:
            key: 'wmi.getall[root\cimv2,"select Name,Description,NetConnectionID,Speed,AdapterTypeId,NetConnectionStatus,GUID from win32_networkadapter where PhysicalAdapter=True and NetConnectionStatus>0"]'
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  output = JSON.parse(value).map(function(net){
                  	return {
                  		"{#IFNAME}": net.Name,
                  		"{#IFDESCR}": net.Description,
                  		"{#IFALIAS}": net.NetConnectionID,
                  		"{#IFGUID}": net.GUID
                  	}})
                  return JSON.stringify({"data": output})
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
        - uuid: b2a9c04e3e0846ab89d5dbc39d273567
          name: 'Physical disks discovery'
          type: ZABBIX_ACTIVE
          key: 'perf_instance_en.discovery[PhysicalDisk]'
          delay: 1h
          filter:
            evaltype: AND
            conditions:
              - macro: '{#DEVNAME}'
                value: '{$VFS.DEV.DEVNAME.MATCHES}'
              - macro: '{#DEVNAME}'
                value: '{$VFS.DEV.DEVNAME.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          description: 'Discovery of installed physical disks.'
          item_prototypes:
            - uuid: 714bbd069d34400895df413fe4627543
              name: '{#DEVNAME}: Disk utilization by idle time'
              type: ZABBIX_ACTIVE
              key: 'perf_counter_en["\PhysicalDisk({#DEVNAME})\% Idle Time",60]'
              value_type: FLOAT
              units: '%'
              description: 'This item is the percentage of elapsed time that the selected disk drive was busy servicing read or writes requests based on idle time.'
              preprocessing:
                - type: JAVASCRIPT
                  parameters:
                    - 'return (100 - value)'
              tags:
                - tag: component
                  value: storage
                - tag: disk
                  value: '{#DEVNAME}'
              trigger_prototypes:
                - uuid: 00031ae791d6424dbd29c91be91a249f
                  expression: 'min(/Windows by Zabbix agent active/perf_counter_en["\PhysicalDisk({#DEVNAME})\% Idle Time",60],15m)>{$VFS.DEV.UTIL.MAX.WARN}'
                  name: 'Windows: {#DEVNAME}: Disk is overloaded'
                  event_name: 'Windows: {#DEVNAME}: Disk is overloaded (util > {$VFS.DEV.UTIL.MAX.WARN}% for 15m)'
                  priority: WARNING
                  description: 'The disk appears to be under heavy load.'
                  manual_close: 'YES'
                  dependencies:
                    - name: 'Windows: {#DEVNAME}: Disk read request responses are too high'
                      expression: 'min(/Windows by Zabbix agent active/perf_counter_en["\PhysicalDisk({#DEVNAME})\Avg. Disk sec/Read",60],15m) > {$VFS.DEV.READ.AWAIT.WARN:"{#DEVNAME}"}'
                    - name: 'Windows: {#DEVNAME}: Disk write request responses are too high'
                      expression: 'min(/Windows by Zabbix agent active/perf_counter_en["\PhysicalDisk({#DEVNAME})\Avg. Disk sec/Write",60],15m) > {$VFS.DEV.WRITE.AWAIT.WARN:"{#DEVNAME}"}'
                  tags:
                    - tag: scope
                      value: performance
            - uuid: abdcdffc92114fda93d4893c772cf14a
              name: '{#DEVNAME}: Average disk read queue length'
              type: ZABBIX_ACTIVE
              key: 'perf_counter_en["\PhysicalDisk({#DEVNAME})\Avg. Disk Read Queue Length",60]'
              value_type: FLOAT
              description: 'Average disk read queue, the number of requests outstanding on the disk at the time the performance data is collected.'
              tags:
                - tag: component
                  value: storage
                - tag: disk
                  value: '{#DEVNAME}'
            - uuid: 208b3a3868844e85a7e3e5f3940d744d
              name: '{#DEVNAME}: Disk read request avg waiting time'
              type: ZABBIX_ACTIVE
              key: 'perf_counter_en["\PhysicalDisk({#DEVNAME})\Avg. Disk sec/Read",60]'
              value_type: FLOAT
              units: s
              description: 'The average time for read requests issued to the device to be served. This includes the time spent by the requests in queue and the time spent servicing them.'
              tags:
                - tag: component
                  value: storage
                - tag: disk
                  value: '{#DEVNAME}'
              trigger_prototypes:
                - uuid: f6c28fa8eef542a786b29d745dd2e56f
                  expression: 'min(/Windows by Zabbix agent active/perf_counter_en["\PhysicalDisk({#DEVNAME})\Avg. Disk sec/Read",60],15m) > {$VFS.DEV.READ.AWAIT.WARN:"{#DEVNAME}"}'
                  name: 'Windows: {#DEVNAME}: Disk read request responses are too high'
                  event_name: 'Windows: {#DEVNAME}: Disk read request responses are too high (read > {$VFS.DEV.READ.AWAIT.WARN:"{#DEVNAME}"}s for 15m)'
                  priority: WARNING
                  description: 'This trigger might indicate the disk {#DEVNAME} saturation.'
                  manual_close: 'YES'
                  tags:
                    - tag: scope
                      value: performance
            - uuid: 6a162aca790c48a7bd726d54494d67e9
              name: '{#DEVNAME}: Disk write request avg waiting time'
              type: ZABBIX_ACTIVE
              key: 'perf_counter_en["\PhysicalDisk({#DEVNAME})\Avg. Disk sec/Write",60]'
              value_type: FLOAT
              units: s
              description: 'The average time for write requests issued to the device to be served. This includes the time spent by the requests in queue and the time spent servicing them.'
              tags:
                - tag: component
                  value: storage
                - tag: disk
                  value: '{#DEVNAME}'
              trigger_prototypes:
                - uuid: 9a0c7aa60e0e40d8abec9be6d6d49190
                  expression: 'min(/Windows by Zabbix agent active/perf_counter_en["\PhysicalDisk({#DEVNAME})\Avg. Disk sec/Write",60],15m) > {$VFS.DEV.WRITE.AWAIT.WARN:"{#DEVNAME}"}'
                  name: 'Windows: {#DEVNAME}: Disk write request responses are too high'
                  event_name: 'Windows: {#DEVNAME}: Disk write request responses are too high (write > {$VFS.DEV.WRITE.AWAIT.WARN:"{#DEVNAME}"}s for 15m)'
                  priority: WARNING
                  description: 'This trigger might indicate the disk {#DEVNAME} saturation.'
                  manual_close: 'YES'
                  tags:
                    - tag: scope
                      value: performance
            - uuid: ba3a369741544f6c88a476a4f2d30ab2
              name: '{#DEVNAME}: Average disk write queue length'
              type: ZABBIX_ACTIVE
              key: 'perf_counter_en["\PhysicalDisk({#DEVNAME})\Avg. Disk Write Queue Length",60]'
              value_type: FLOAT
              description: 'Average disk write queue, the number of requests outstanding on the disk at the time the performance data is collected.'
              tags:
                - tag: component
                  value: storage
                - tag: disk
                  value: '{#DEVNAME}'
            - uuid: 24d15f53439148919e11d5811f25adf1
              name: '{#DEVNAME}: Disk average queue size (avgqu-sz)'
              type: ZABBIX_ACTIVE
              key: 'perf_counter_en["\PhysicalDisk({#DEVNAME})\Current Disk Queue Length",60]'
              value_type: FLOAT
              description: 'The current average disk queue; the number of requests outstanding on the disk while the performance data is being collected.'
              tags:
                - tag: component
                  value: storage
                - tag: disk
                  value: '{#DEVNAME}'
            - uuid: c1424c1c2fe647a8baf3357c34ae261e
              name: '{#DEVNAME}: Disk read rate'
              type: ZABBIX_ACTIVE
              key: 'perf_counter_en["\PhysicalDisk({#DEVNAME})\Disk Reads/sec",60]'
              value_type: FLOAT
              units: '!r/s'
              description: 'Rate of read operations on the disk.'
              tags:
                - tag: component
                  value: storage
                - tag: disk
                  value: '{#DEVNAME}'
            - uuid: 4d10e563bbd1402daa1c9c8516095aa8
              name: '{#DEVNAME}: Disk write rate'
              type: ZABBIX_ACTIVE
              key: 'perf_counter_en["\PhysicalDisk({#DEVNAME})\Disk Writes/sec",60]'
              value_type: FLOAT
              units: '!w/s'
              description: 'Rate of write operations on the disk.'
              tags:
                - tag: component
                  value: storage
                - tag: disk
                  value: '{#DEVNAME}'
          graph_prototypes:
            - uuid: e249ca7462a14508bdbdbf748102015a
              name: '{#DEVNAME}: Disk average queue length'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'Windows by Zabbix agent active'
                    key: 'perf_counter_en["\PhysicalDisk({#DEVNAME})\Avg. Disk Read Queue Length",60]'
                - sortorder: '1'
                  color: F63100
                  item:
                    host: 'Windows by Zabbix agent active'
                    key: 'perf_counter_en["\PhysicalDisk({#DEVNAME})\Avg. Disk Write Queue Length",60]'
            - uuid: 790265fa66e14e97badadfce392ef8df
              name: '{#DEVNAME}: Disk average waiting time'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'Windows by Zabbix agent active'
                    key: 'perf_counter_en["\PhysicalDisk({#DEVNAME})\Avg. Disk sec/Read",60]'
                - sortorder: '1'
                  drawtype: GRADIENT_LINE
                  color: F63100
                  item:
                    host: 'Windows by Zabbix agent active'
                    key: 'perf_counter_en["\PhysicalDisk({#DEVNAME})\Avg. Disk sec/Write",60]'
            - uuid: 024945537eab4facb18483b6f3ce8d3e
              name: '{#DEVNAME}: Disk read/write rates'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'Windows by Zabbix agent active'
                    key: 'perf_counter_en["\PhysicalDisk({#DEVNAME})\Disk Reads/sec",60]'
                - sortorder: '1'
                  drawtype: GRADIENT_LINE
                  color: F63100
                  item:
                    host: 'Windows by Zabbix agent active'
                    key: 'perf_counter_en["\PhysicalDisk({#DEVNAME})\Disk Writes/sec",60]'
            - uuid: 70de55df5604410d8a67cdca31957b03
              name: '{#DEVNAME}: Disk utilization and queue'
              graph_items:
                - color: 199C0D
                  yaxisside: RIGHT
                  item:
                    host: 'Windows by Zabbix agent active'
                    key: 'perf_counter_en["\PhysicalDisk({#DEVNAME})\Current Disk Queue Length",60]'
                - sortorder: '1'
                  drawtype: GRADIENT_LINE
                  color: F63100
                  item:
                    host: 'Windows by Zabbix agent active'
                    key: 'perf_counter_en["\PhysicalDisk({#DEVNAME})\% Idle Time",60]'
          preprocessing:
            - type: STR_REPLACE
              parameters:
                - '{#INSTANCE}'
                - '{#DEVNAME}'
        - uuid: dbde6e6c7c13436b9bd20230f1d309ed
          name: 'Windows services discovery'
          type: ZABBIX_ACTIVE
          key: service.discovery
          delay: 1h
          filter:
            evaltype: AND
            conditions:
              - macro: '{#SERVICE.NAME}'
                value: '{$SERVICE.NAME.MATCHES}'
              - macro: '{#SERVICE.NAME}'
                value: '{$SERVICE.NAME.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
              - macro: '{#SERVICE.STARTUPNAME}'
                value: '{$SERVICE.STARTUPNAME.MATCHES}'
              - macro: '{#SERVICE.STARTUPNAME}'
                value: '{$SERVICE.STARTUPNAME.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          description: 'Used for the discovery of Windows services of different types as defined in the template''s macros.'
          item_prototypes:
            - uuid: d6379e85f1974734abbe60fef1a6ca1d
              name: 'State of service "{#SERVICE.NAME}" ({#SERVICE.DISPLAYNAME})'
              type: ZABBIX_ACTIVE
              key: 'service.info["{#SERVICE.NAME}",state]'
              valuemap:
                name: 'Windows service state'
              tags:
                - tag: component
                  value: system
                - tag: name
                  value: '{#SERVICE.DISPLAYNAME}'
                - tag: service
                  value: '{#SERVICE.NAME}'
              trigger_prototypes:
                - uuid: c6f2c1c32cdf401091e4439624a24fab
                  expression: 'min(/Windows by Zabbix agent active/service.info["{#SERVICE.NAME}",state],#3)<>0'
                  name: 'Windows: "{#SERVICE.NAME}" ({#SERVICE.DISPLAYNAME}) is not running'
                  event_name: 'Windows: "{#SERVICE.NAME}" ({#SERVICE.DISPLAYNAME}) is not running (startup type {#SERVICE.STARTUPNAME})'
                  priority: AVERAGE
                  description: 'The service has a state other than "Running" for the last three times.'
                  tags:
                    - tag: scope
                      value: notice
        - uuid: 4fbbdf83609e48e68011f6c394c652f9
          name: 'Mounted filesystem discovery'
          type: DEPENDENT
          key: vfs.fs.dependent.discovery
          filter:
            evaltype: AND
            conditions:
              - macro: '{#FSDRIVETYPE}'
                value: '{$VFS.FS.FSDRIVETYPE.MATCHES}'
              - macro: '{#FSDRIVETYPE}'
                value: '{$VFS.FS.FSDRIVETYPE.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
              - macro: '{#FSNAME}'
                value: '{$VFS.FS.FSNAME.MATCHES}'
              - macro: '{#FSNAME}'
                value: '{$VFS.FS.FSNAME.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
              - macro: '{#FSTYPE}'
                value: '{$VFS.FS.FSTYPE.MATCHES}'
              - macro: '{#FSTYPE}'
                value: '{$VFS.FS.FSTYPE.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          description: 'Discovery of filesystems of different types.'
          item_prototypes:
            - uuid: 821daa0e25a2456ca637e441a844dfe6
              name: 'FS [{#FSLABEL}({#FSNAME})]: Space: Available'
              type: DEPENDENT
              key: 'vfs.fs.dependent.size[{#FSNAME},free]'
              units: B
              description: 'Available storage space expressed in bytes.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.bytes.free
              master_item:
                key: 'vfs.fs.dependent[{#FSNAME},data]'
              tags:
                - tag: component
                  value: storage
                - tag: filesystem
                  value: '{#FSNAME}'
                - tag: fstype
                  value: '{#FSTYPE}'
            - uuid: 8949201f93ab46f0a0ad95ca6ce6124c
              name: 'FS [{#FSLABEL}({#FSNAME})]: Space: Used, in %'
              type: DEPENDENT
              key: 'vfs.fs.dependent.size[{#FSNAME},pused]'
              value_type: FLOAT
              units: '%'
              description: 'Calculated as the percentage of currently used space compared to the maximum available space.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.bytes.pused
              master_item:
                key: 'vfs.fs.dependent[{#FSNAME},data]'
              tags:
                - tag: component
                  value: storage
                - tag: filesystem
                  value: '{#FSNAME}'
                - tag: fstype
                  value: '{#FSTYPE}'
              trigger_prototypes:
                - uuid: 5bed682545044584852888d96454df86
                  expression: 'min(/Windows by Zabbix agent active/vfs.fs.dependent.size[{#FSNAME},pused],5m)>{$VFS.FS.PUSED.MAX.CRIT:"{#FSLABEL}({#FSNAME})"}'
                  name: 'Windows: FS [{#FSLABEL}({#FSNAME})]: Space is critically low'
                  event_name: 'Windows: FS [{#FSLABEL}({#FSNAME})]: Space is critically low (used > {$VFS.FS.PUSED.MAX.CRIT:"{#FSLABEL}({#FSNAME})"}%, total {{?last(//vfs.fs.dependent.size[{#FSNAME},total])/1024/1024/1024}.fmtnum(1)}GB)'
                  opdata: 'Space used: {{ITEM.LASTVALUE1}.fmtnum(1)}%'
                  priority: AVERAGE
                  description: |
                    The volume's space usage exceeds the `{$VFS.FS.PUSED.MAX.CRIT:"{#FSNAME}"}%` limit.
                    The trigger expression is based on the current used and maximum available spaces.
                    Event name represents the total volume space, which can differ from the maximum available space, depending on the filesystem type.
                  manual_close: 'YES'
                  tags:
                    - tag: scope
                      value: availability
                    - tag: scope
                      value: capacity
                - uuid: 1e5e9718c5a14099b9421ff7956b2f33
                  expression: 'min(/Windows by Zabbix agent active/vfs.fs.dependent.size[{#FSNAME},pused],5m)>{$VFS.FS.PUSED.MAX.WARN:"{#FSLABEL}({#FSNAME})"}'
                  name: 'Windows: FS [{#FSLABEL}({#FSNAME})]: Space is low'
                  event_name: 'Windows: FS [{#FSLABEL}({#FSNAME})]: Space is low (used > {$VFS.FS.PUSED.MAX.WARN:"{#FSLABEL}({#FSNAME})"}%, total {{?last(//vfs.fs.dependent.size[{#FSNAME},total])/1024/1024/1024}.fmtnum(1)}GB)'
                  opdata: 'Space used: {{ITEM.LASTVALUE1}.fmtnum(1)}%'
                  priority: WARNING
                  description: |
                    The volume's space usage exceeds the `{$VFS.FS.PUSED.MAX.WARN:"{#FSNAME}"}%` limit.
                    The trigger expression is based on the current used and maximum available spaces.
                    Event name represents the total volume space, which can differ from the maximum available space, depending on the filesystem type.
                  manual_close: 'YES'
                  dependencies:
                    - name: 'Windows: FS [{#FSLABEL}({#FSNAME})]: Space is critically low'
                      expression: 'min(/Windows by Zabbix agent active/vfs.fs.dependent.size[{#FSNAME},pused],5m)>{$VFS.FS.PUSED.MAX.CRIT:"{#FSLABEL}({#FSNAME})"}'
                  tags:
                    - tag: scope
                      value: availability
                    - tag: scope
                      value: capacity
            - uuid: d45f2c3469dd424486bdee586e4a61eb
              name: 'FS [{#FSLABEL}({#FSNAME})]: Space: Total'
              type: DEPENDENT
              key: 'vfs.fs.dependent.size[{#FSNAME},total]'
              units: B
              description: 'Total space expressed in bytes.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.bytes.total
              master_item:
                key: 'vfs.fs.dependent[{#FSNAME},data]'
              tags:
                - tag: component
                  value: storage
                - tag: filesystem
                  value: '{#FSNAME}'
                - tag: fstype
                  value: '{#FSTYPE}'
            - uuid: ddd24d7eaa5742ac9d6cbae42bcfa1ae
              name: 'FS [{#FSLABEL}({#FSNAME})]: Space: Used'
              type: DEPENDENT
              key: 'vfs.fs.dependent.size[{#FSNAME},used]'
              units: B
              description: 'Used storage expressed in bytes.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.bytes.used
              master_item:
                key: 'vfs.fs.dependent[{#FSNAME},data]'
              tags:
                - tag: component
                  value: storage
                - tag: filesystem
                  value: '{#FSNAME}'
                - tag: fstype
                  value: '{#FSTYPE}'
            - uuid: b9ad1677ea6841309c7dc3a304b61c37
              name: 'FS [{#FSLABEL}({#FSNAME})]: Get data'
              type: DEPENDENT
              key: 'vfs.fs.dependent[{#FSNAME},data]'
              history: 1h
              value_type: TEXT
              description: 'Intermediate data of `{#FSNAME}` filesystem.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$.[?(@.fsname==''{#FSNAME}'')].first()'
              master_item:
                key: vfs.fs.get
              tags:
                - tag: component
                  value: raw
                - tag: component
                  value: storage
                - tag: filesystem
                  value: '{#FSNAME}'
                - tag: fstype
                  value: '{#FSTYPE}'
          graph_prototypes:
            - uuid: 478c7beb397a48318994fc96acc2c4da
              name: 'FS [{#FSLABEL}({#FSNAME})]: Space usage graph, in %'
              width: '600'
              height: '340'
              ymin_type_1: FIXED
              ymax_type_1: FIXED
              graph_items:
                - drawtype: FILLED_REGION
                  color: F63100
                  calc_fnc: ALL
                  item:
                    host: 'Windows by Zabbix agent active'
                    key: 'vfs.fs.dependent.size[{#FSNAME},pused]'
            - uuid: 8d0581d07b92406aa9f007f6d03ad24e
              name: 'FS [{#FSLABEL}({#FSNAME})]: Space utilization chart'
              width: '600'
              height: '340'
              type: PIE
              show_3d: 'YES'
              graph_items:
                - color: '787878'
                  calc_fnc: LAST
                  type: GRAPH_SUM
                  item:
                    host: 'Windows by Zabbix agent active'
                    key: 'vfs.fs.dependent.size[{#FSNAME},total]'
                - sortorder: '1'
                  color: F63100
                  calc_fnc: LAST
                  item:
                    host: 'Windows by Zabbix agent active'
                    key: 'vfs.fs.dependent.size[{#FSNAME},used]'
                - sortorder: '2'
                  color: 199C09
                  calc_fnc: LAST
                  item:
                    host: 'Windows by Zabbix agent active'
                    key: 'vfs.fs.dependent.size[{#FSNAME},free]'
          master_item:
            key: vfs.fs.get
          lld_macro_paths:
            - lld_macro: '{#FSDRIVETYPE}'
              path: $.fsdrivetype
            - lld_macro: '{#FSLABEL}'
              path: $.fslabel
            - lld_macro: '{#FSNAME}'
              path: $.fsname
            - lld_macro: '{#FSTYPE}'
              path: $.fstype
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  var filesystems = JSON.parse(value);
                  
                  result = filesystems.map(function (filesystem) {
                  	return {
                  		'fsname': filesystem.fsname,
                  		'fstype': filesystem.fstype,
                  		'fslabel': filesystem.fslabel,
                  		'fsdrivetype': filesystem.fsdrivetype
                  	};
                  });
                  
                  return JSON.stringify(result);
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
      tags:
        - tag: class
          value: os
        - tag: target
          value: windows
      macros:
        - macro: '{$AGENT.NODATA_TIMEOUT}'
          value: 30m
          description: 'No data timeout for active agents. Consider to keep it relatively high.'
          config:
            type: TEXT
            priority: '1'
            section_name: Thresholds
            label: 'Time since the last agent data was received'
            description: 'Threshold value of time since the last data was received from the agent.'
        - macro: '{$AGENT.TIMEOUT}'
          value: 5m
          description: 'Timeout after which agent is considered unavailable.'
          config:
            type: TEXT
            priority: '2'
            label: 'Seconds since the last Zabbix agent seen'
            description: 'Timeout after which agent is considered unavailable.'
        - macro: '{$CPU.INTERRUPT.CRIT.MAX}'
          value: '50'
          description: 'The critical threshold of the % Interrupt Time counter.'
          config:
            type: TEXT
            priority: '4'
            section_name: Thresholds
            label: 'Threshold for Interrupt Time counter (critical)'
            description: 'Critical threshold of the % Interrupt Time counter. In the range from 0 to 100 inclusive.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$CPU.PRIV.CRIT.MAX}'
          value: '30'
          description: 'The threshold of the % Privileged Time counter.'
          config:
            type: TEXT
            priority: '5'
            section_name: Thresholds
            label: 'Threshold for Privileged Time counter (critical)'
            description: 'Threshold of the % Privileged Time counter. In the range from 0 to 100 inclusive.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$CPU.QUEUE.CRIT.MAX}'
          value: '3'
          description: 'The threshold of the Processor Queue Length counter.'
          config:
            type: TEXT
            priority: '6'
            section_name: Thresholds
            label: 'Threshold for Processor Queue Length counter (critical)'
            description: 'Threshold of the Processor Queue Length counter. No less than 0.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$CPU.UTIL.CRIT}'
          value: '90'
          description: 'The critical threshold of the CPU utilization expressed in %.'
          config:
            type: TEXT
            priority: '3'
            section_name: Thresholds
            label: 'Threshold of the CPU utilization'
            description: 'Critical threshold of the CPU utilization expressed in %. In the range from 0 to 100 inclusive.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$IF.ERRORS.WARN}'
          value: '2'
          description: 'Warning threshold of error packet rate. Can be used with interface name as context.'
          config:
            type: TEXT
            priority: '26'
            section_name: Thresholds
            label: 'Threshold of error packet rate'
            description: 'Warning threshold of error packet rate. In the range from 0 to 100 inclusive.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$IF.UTIL.MAX}'
          value: '90'
          description: 'Used as a threshold in the interface utilization trigger.'
          config:
            type: TEXT
            priority: '25'
            section_name: Thresholds
            label: 'The threshold in the interface utilization'
            description: 'Used as a threshold in the interface utilization trigger. In the range from 0 to 100 inclusive.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$IFCONTROL}'
          value: '1'
          description: 'Macro for the interface operational state for the "link down" trigger. Can be used with interface name as context.'
          config:
            type: CHECKBOX
            priority: '24'
            label: 'Interfaces control'
            description: 'Fire a trigger when the interface operational status changes to "Link down".'
            options:
              - checked: '1'
                unchecked: '0'
        - macro: '{$MEM.PAGE_SEC.CRIT.MAX}'
          value: '1000'
          description: 'The warning threshold of the Memory Pages/sec counter.'
          config:
            type: TEXT
            priority: '10'
            section_name: Thresholds
            label: 'Threshold of the Memory Pages/sec counter (critical)'
            description: 'Critical threshold of the Memory Pages/sec counter.'
        - macro: '{$MEM.PAGE_TABLE_CRIT.MIN}'
          value: '5000'
          description: 'The warning threshold of the Free System Page Table Entries counter.'
          config:
            type: TEXT
            priority: '9'
            section_name: Thresholds
            label: 'Threshold of the Free System Page Table Entries counter (critical)'
            description: 'Critical threshold of the Free System Page Table Entries counter.'
        - macro: '{$MEMORY.UTIL.MAX}'
          value: '90'
          description: 'The warning threshold of the Memory util item.'
          config:
            type: TEXT
            priority: '7'
            section_name: Thresholds
            label: 'Threshold of the Memory utilization'
            description: 'Warning threshold of the Memory util item. In the range from 0 to 100 inclusive.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$NET.IF.IFALIAS.MATCHES}'
          value: '.*'
          description: 'Used in Network interface discovery. Can be overridden on the host or linked template level.'
          config:
            type: TEXT
            priority: '29'
            section_name: Filters
            label: 'Filter for network interfaces by alias'
            description: 'Regex string to include discovered interface by alias.'
        - macro: '{$NET.IF.IFALIAS.NOT_MATCHES}'
          value: CHANGE_THIS
          description: 'Used in Network interface discovery. Can be overridden on the host or linked template level.'
          config:
            type: TEXT
            priority: '30'
            section_name: Filters
            label: 'Filter for network interfaces by alias (exclude)'
            description: 'Regex string to exclude discovered interface by alias.'
        - macro: '{$NET.IF.IFDESCR.MATCHES}'
          value: '.*'
          description: 'Used in Network interface discovery. Can be overridden on the host or linked template level.'
          config:
            type: TEXT
            priority: '31'
            section_name: Filters
            label: 'Filter for network interfaces by description'
            description: 'Regex string to include discovered interface by description.'
        - macro: '{$NET.IF.IFDESCR.NOT_MATCHES}'
          value: CHANGE_THIS
          description: 'Used in Network interface discovery. Can be overridden on the host or linked template level.'
          config:
            type: TEXT
            priority: '32'
            section_name: Filters
            label: 'Filter for network interfaces by description (exclude)'
            description: 'Regex string to exclude discovered interface by description.'
        - macro: '{$NET.IF.IFNAME.MATCHES}'
          value: '.*'
          description: 'Used in Network interface discovery. Can be overridden on the host or linked template level.'
          config:
            type: TEXT
            priority: '27'
            section_name: Filters
            label: 'Filter for network interface by name.'
            description: 'Regex string to include discovered interface by name.'
        - macro: '{$NET.IF.IFNAME.NOT_MATCHES}'
          value: Miniport|Virtual|Teredo|Kernel|Loopback|Bluetooth|HTTPS|6to4|QoS|Layer
          description: 'Used in Network interface discovery. Can be overridden on the host or linked template level.'
          config:
            type: TEXT
            priority: '28'
            section_name: Filters
            label: 'Filter for network interface by name (exclude).'
            description: 'Filters out `loopbacks`, `nulls`, docker `veth` links and `docker0` bridge by default.'
        - macro: '{$SERVICE.NAME.MATCHES}'
          value: '^.*$'
          description: 'Used in Service discovery. Can be overridden on the host or linked template level.'
          config:
            type: TEXT
            priority: '33'
            section_name: Filters
            label: 'Filter for service by name'
            description: 'Regex string to include discovered service by name.'
        - macro: '{$SERVICE.NAME.NOT_MATCHES}'
          value: '^(?:RemoteRegistry|MMCSS|gupdate|SysmonLog|clr_optimization_v.+|sppsvc|gpsvc|Pml Driver HPZ12|Net Driver HPZ12|MapsBroker|IntelAudioService|Intel\(R\) TPM Provisioning Service|dbupdate|DoSvc|CDPUserSvc_.+|WpnUserService_.+|OneSyncSvc_.+|WbioSrvc|BITS|tiledatamodelsvc|GISvc|ShellHWDetection|TrustedInstaller|TabletInputService|CDPSvc|wuauserv|edgeupdate|cbdhsvc_.+)$'
          description: 'Used in Service discovery. Can be overridden on the host or linked template level.'
          config:
            type: TEXT
            priority: '34'
            section_name: Filters
            label: 'Filter for service by name (exclude)'
            description: 'Regex string to exclude discovered service by name.'
        - macro: '{$SERVICE.STARTUPNAME.MATCHES}'
          value: '^(?:automatic|automatic delayed)$'
          description: 'Used in Service discovery. Can be overridden on the host or linked template level.'
          config:
            type: TEXT
            priority: '35'
            section_name: Filters
            label: 'Filter for service by startup name'
            description: 'Regex string to include discovered service by startup name.'
        - macro: '{$SERVICE.STARTUPNAME.NOT_MATCHES}'
          value: '^(?:manual|disabled)$'
          description: 'Used in Service discovery. Can be overridden on the host or linked template level.'
          config:
            type: TEXT
            priority: '36'
            section_name: Filters
            label: 'Filter for service by startup name (exclude)'
            description: 'Regex string to exclude discovered service by startup name.'
        - macro: '{$SWAP.PFREE.MIN.WARN}'
          value: '20'
          description: 'The warning threshold of the minimum free swap.'
          config:
            type: TEXT
            priority: '8'
            section_name: Thresholds
            label: 'Threshold of the minimum free swap'
            description: 'Warning threshold of the minimum free swap. In the range from 0 to 100 inclusive.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$VFS.DEV.DEVNAME.MATCHES}'
          value: '.*'
          description: 'Used in physical disk discovery. Can be overridden on the host or linked template level.'
          config:
            type: TEXT
            priority: '22'
            section_name: Filters
            label: 'Filter for physical disk by name'
            description: 'Regex string to include discovered physical disk by name.'
        - macro: '{$VFS.DEV.DEVNAME.NOT_MATCHES}'
          value: _Total
          description: 'Used in physical disk discovery. Can be overridden on the host or linked template level.'
          config:
            type: TEXT
            priority: '23'
            section_name: Filters
            label: 'Filter for physical disk by name (exclude)'
            description: 'Regex string to exclude discovered physical disk by name.'
        - macro: '{$VFS.DEV.READ.AWAIT.WARN}'
          value: '0.02'
          description: 'Disk read average response time (in s) before the trigger fires.'
          config:
            type: TEXT
            priority: '20'
            section_name: Thresholds
            label: 'Disk read average response time (in s)'
            description: 'Disk read average response time (in s) before the trigger fires. No less than 0.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$VFS.DEV.UTIL.MAX.WARN}'
          value: '95'
          description: 'The warning threshold of disk time utilization in percent.'
          config:
            type: TEXT
            priority: '19'
            section_name: Thresholds
            label: 'Threshold for disk time utilization'
            description: 'Warning threshold of disk time utilization in percent. In the range from 0 to 100 inclusive.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$VFS.DEV.WRITE.AWAIT.WARN}'
          value: '0.02'
          description: 'Disk write average response time (in s) before the trigger fires.'
          config:
            type: TEXT
            priority: '21'
            section_name: Thresholds
            label: 'Disk write average response time (in s)'
            description: 'Disk write average response time (in s) before the trigger fires. No less than 0.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$VFS.FS.FSDRIVETYPE.MATCHES}'
          value: fixed
          description: 'Used in filesystem discovery. Can be overridden on the host or linked template level.'
          config:
            type: TEXT
            priority: '17'
            section_name: Filters
            label: 'Filter for filesystems by drive type'
            description: 'Regex string to include discovered filesystems by drive type.'
        - macro: '{$VFS.FS.FSDRIVETYPE.NOT_MATCHES}'
          value: ^\s$
          description: 'Used in filesystem discovery. Can be overridden on the host or linked template level.'
          config:
            type: TEXT
            priority: '18'
            section_name: Filters
            label: 'Filter for filesystems by drive type (exclude)'
            description: 'Regex string to exclude discovered filesystems by drive type.'
        - macro: '{$VFS.FS.FSNAME.MATCHES}'
          value: '.*'
          description: 'Used in filesystem discovery. Can be overridden on the host or linked template level.'
          config:
            type: TEXT
            priority: '13'
            section_name: Filters
            label: 'Filter for filesystems by name'
            description: 'Regex string to include discovered filesystems by name.'
        - macro: '{$VFS.FS.FSNAME.NOT_MATCHES}'
          value: '^(?:/dev|/sys|/run|/proc|.+/shm$)'
          description: 'Used in filesystem discovery. Can be overridden on the host or linked template level.'
          config:
            type: TEXT
            priority: '14'
            section_name: Filters
            label: 'Filter for filesystems by name (exclude)'
            description: 'Regex string to exclude discovered filesystems by name.'
        - macro: '{$VFS.FS.FSTYPE.MATCHES}'
          value: '.*'
          description: 'Used in filesystem discovery. Can be overridden on the host or linked template level.'
          config:
            type: TEXT
            priority: '15'
            section_name: Filters
            label: 'Filter for filesystems by type'
            description: 'Regex string to include discovered filesystems by type.'
        - macro: '{$VFS.FS.FSTYPE.NOT_MATCHES}'
          value: ^\s$
          description: 'Used in filesystem discovery. Can be overridden on the host or linked template level.'
          config:
            type: TEXT
            priority: '16'
            section_name: Filters
            label: 'Filter for filesystems by type (exclude)'
            description: 'Regex string to exclude discovered filesystems by type.'
        - macro: '{$VFS.FS.PUSED.MAX.CRIT}'
          value: '90'
          description: 'The critical threshold of the filesystem utilization.'
          config:
            type: TEXT
            priority: '12'
            section_name: Thresholds
            label: 'Threshold for filesystem utilization (critical)'
            description: 'Critical threshold of the filesystem utilization. In the range from 0 to 100 inclusive.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$VFS.FS.PUSED.MAX.WARN}'
          value: '80'
          description: 'The warning threshold of the filesystem utilization.'
          config:
            type: TEXT
            priority: '11'
            section_name: Thresholds
            label: 'Threshold for filesystem utilization (warning)'
            description: 'Warning threshold of the filesystem utilization. In the range from 0 to 100 inclusive.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
      dashboards:
        - uuid: 681dd7ed662243709a406069f4a4a206
          name: Filesystems
          pages:
            - name: Overview
              widgets:
                - type: graphprototype
                  width: '72'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '3'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'Windows by Zabbix agent active'
                        name: 'FS [{#FSLABEL}({#FSNAME})]: Space utilization chart'
                    - type: STRING
                      name: reference
                      value: AAAEB
                - type: graphprototype
                  'y': '5'
                  width: '72'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'Windows by Zabbix agent active'
                        name: 'FS [{#FSLABEL}({#FSNAME})]: Space usage graph, in %'
                    - type: STRING
                      name: reference
                      value: AAAEC
        - uuid: 59033ebe1b084a86b820fc59049db125
          name: 'Network interfaces'
          pages:
            - name: Overview
              widgets:
                - type: graphprototype
                  width: '72'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'Windows by Zabbix agent active'
                        name: 'Interface {#IFNAME}({#IFALIAS}): Network traffic'
                    - type: STRING
                      name: reference
                      value: AAAAI
        - uuid: 234161507ccb4d83b111cb31e0db8ae5
          name: 'System performance'
          pages:
            - widgets:
                - type: graph
                  width: '36'
                  height: '5'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Windows by Zabbix agent active'
                        name: 'Windows: CPU usage'
                    - type: STRING
                      name: reference
                      value: AAAAA
                - type: graph
                  'y': '5'
                  width: '36'
                  height: '5'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Windows by Zabbix agent active'
                        name: 'Windows: Memory utilization'
                    - type: STRING
                      name: reference
                      value: AAAAC
                - type: graphprototype
                  'y': '10'
                  width: '72'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '3'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'Windows by Zabbix agent active'
                        name: 'FS [{#FSLABEL}({#FSNAME})]: Space utilization chart'
                    - type: STRING
                      name: reference
                      value: AAAEA
                - type: graphprototype
                  'y': '15'
                  width: '72'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'Windows by Zabbix agent active'
                        name: '{#DEVNAME}: Disk read/write rates'
                    - type: STRING
                      name: reference
                      value: AAAAF
                - type: graphprototype
                  'y': '20'
                  width: '72'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'Windows by Zabbix agent active'
                        name: '{#DEVNAME}: Disk utilization and queue'
                    - type: STRING
                      name: reference
                      value: AAAAG
                - type: graphprototype
                  'y': '25'
                  width: '72'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'Windows by Zabbix agent active'
                        name: 'Interface {#IFNAME}({#IFALIAS}): Network traffic'
                    - type: STRING
                      name: reference
                      value: AAAAH
                - type: graph
                  x: '36'
                  width: '36'
                  height: '5'
                  fields:
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Windows by Zabbix agent active'
                        key: 'perf_counter_en["\System\Processor Queue Length"]'
                    - type: STRING
                      name: reference
                      value: AAAAB
                    - type: INTEGER
                      name: source_type
                      value: '1'
                - type: graph
                  x: '36'
                  'y': '5'
                  width: '36'
                  height: '5'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Windows by Zabbix agent active'
                        name: 'Windows: Swap usage'
                    - type: STRING
                      name: reference
                      value: AAAAD
      valuemaps:
        - uuid: 224ca38281f04c83844763251505cdce
          name: 'Win32_NetworkAdapter::AdapterTypeId'
          mappings:
            - value: '0'
              newvalue: 'Ethernet 802.3'
            - value: '1'
              newvalue: 'Token Ring 802.5'
            - value: '2'
              newvalue: 'Fiber Distributed Data Interface (FDDI)'
            - value: '3'
              newvalue: 'Wide Area Network (WAN)'
            - value: '4'
              newvalue: LocalTalk
            - value: '5'
              newvalue: 'Ethernet using DIX header format'
            - value: '6'
              newvalue: ARCNET
            - value: '7'
              newvalue: 'ARCNET (878.2)'
            - value: '8'
              newvalue: ATM
            - value: '9'
              newvalue: Wireless
            - value: '10'
              newvalue: 'Infrared Wireless'
            - value: '11'
              newvalue: Bpc
            - value: '12'
              newvalue: CoWan
            - value: '13'
              newvalue: '1394'
        - uuid: 850e339a24de4ef6a0a881dc57bfa3a6
          name: 'Win32_NetworkAdapter::NetConnectionStatus'
          mappings:
            - value: '0'
              newvalue: Disconnected
            - value: '1'
              newvalue: Connecting
            - value: '2'
              newvalue: Connected
            - value: '3'
              newvalue: Disconnecting
            - value: '4'
              newvalue: 'Hardware Not Present'
            - value: '5'
              newvalue: 'Hardware Disabled'
            - value: '6'
              newvalue: 'Hardware Malfunction'
            - value: '7'
              newvalue: 'Media Disconnected'
            - value: '8'
              newvalue: Authenticating
            - value: '9'
              newvalue: 'Authentication Succeeded'
            - value: '10'
              newvalue: 'Authentication Failed'
            - value: '11'
              newvalue: 'Invalid Address'
            - value: '12'
              newvalue: 'Credentials Required'
        - uuid: e29ffb786c21406aa2338e3d35b484ef
          name: 'Windows service state'
          mappings:
            - value: '0'
              newvalue: Running
            - value: '1'
              newvalue: Paused
            - value: '2'
              newvalue: 'Start pending'
            - value: '3'
              newvalue: 'Pause pending'
            - value: '4'
              newvalue: 'Continue pending'
            - value: '5'
              newvalue: 'Stop pending'
            - value: '6'
              newvalue: Stopped
            - value: '7'
              newvalue: Unknown
            - value: '255'
              newvalue: 'No such service'
        - uuid: 131de6a1016e43019d7cac2ce76901d4
          name: zabbix.host.active_agent.available
          mappings:
            - value: '0'
              newvalue: unknown
            - value: '1'
              newvalue: available
            - value: '2'
              newvalue: 'not available'
        - uuid: 0b50ea7e6695421da023ece0a23bed10
          name: 'Zabbix agent ping status'
          mappings:
            - value: '1'
              newvalue: Up
    - uuid: 3db86b0d235e4c7b80f7d6144ca08925
      template: 'ZYXEL IES-500x by SNMP'
      name: 'ZYXEL IES-500x by SNMP'
      description: |
        ZYXEL IES-500x
        
        MIBs used:
        RFC1213-MIB
        HOST-RESOURCES-MIB
        ADSL-LINE-MIB
        ZYXEL-IES5000-MIB
        IF-MIB
        
        Known Issues:
        
          Description: Incorrect handling of SNMP bulk requests. Disable the use of bulk requests in the SNMP interface settings.
          Version: all versions firmware
          Device: ZYXEL IES-500x
        
        You can discuss this template or leave feedback on our forum https://www.zabbix.com/forum/zabbix-suggestions-and-feedback/422668-discussion-thread-for-official-zabbix-templates-for-zyxel
        
        Generated by official Zabbix template tool "Templator"
      wizard_ready: 'YES'
      readme: |
        ## Overview
        
        https://service-provider.zyxel.com/global/en/products/msansdslams/central-msans/chassis-msans/ies-5000-series
        
        ### Known Issues
        
        Description: Incorrect handling of SNMP bulk requests. Disable the use of bulk requests in the SNMP interface settings.
        Version: all versions firmware
        Device: ZYXEL IES-500x
      vendor:
        name: Zabbix
        version: 8.0-2
      groups:
        - name: 'Templates/Network devices'
      items:
        - uuid: dbaf039727f542a6935223c944fab95d
          name: 'SNMP agent availability'
          type: INTERNAL
          key: 'zabbix[host,snmp,available]'
          valuemap:
            name: 'SNMP available'
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          tags:
            - tag: component
              value: network
          triggers:
            - uuid: 73967d1d3d01458c8e947a1aacb838b0
              expression: 'max(/ZYXEL IES-500x by SNMP/zabbix[host,snmp,available],{$SNMP.TIMEOUT})=0'
              name: 'ZYXEL: No SNMP data collection'
              opdata: 'Current state: {ITEM.LASTVALUE1}'
              priority: WARNING
              description: 'SNMP is not available for polling. Please check device connectivity and SNMP settings.'
              tags:
                - tag: scope
                  value: availability
        - uuid: 5bc150cfc9b147e68b5d15a750546a3f
          name: Contact
          type: SNMP_AGENT
          snmp_oid: 'get[1.3.6.1.2.1.1.4.0]'
          key: zyxel.ies500x.contact
          delay: 1h
          value_type: CHAR
          description: |
            MIB: RFC1213-MIB
            The textual identification of the contact person
            for this managed node, together with information
            on how to contact this person.
          inventory_link: CONTACT
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
          tags:
            - tag: component
              value: inventory
        - uuid: 5fa56229a8854d62bb6c516da873d63b
          name: 'Uptime (hardware)'
          type: SNMP_AGENT
          snmp_oid: 'get[1.3.6.1.2.1.25.1.1.0]'
          key: zyxel.ies500x.hw.uptime
          delay: 30s
          trends: '0'
          units: uptime
          description: |
            MIB: HOST-RESOURCES-MIB
            The amount of time since this host was last initialized.
            Note that this is different from sysUpTime in the SNMPv2-MIB
            [RFC1907] because sysUpTime is the uptime of the
            network management portion of the system.
          preprocessing:
            - type: CHECK_NOT_SUPPORTED
              parameters:
                - '-1'
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
            - type: MULTIPLIER
              parameters:
                - '0.01'
          tags:
            - tag: component
              value: system
        - uuid: cd669772d4454a359f1c372dce4a01de
          name: Location
          type: SNMP_AGENT
          snmp_oid: 'get[1.3.6.1.2.1.1.6.0]'
          key: zyxel.ies500x.location
          delay: 1h
          value_type: CHAR
          description: |
            MIB: RFC1213-MIB
            The physical location of this node (e.g.,
            `telephone closet, 3rd floor').
          inventory_link: LOCATION
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
          tags:
            - tag: component
              value: inventory
        - uuid: 591148b198854413aed834874bf8f137
          name: 'MAC address'
          type: SNMP_AGENT
          snmp_oid: 'get[1.3.6.1.2.1.2.2.1.6.1]'
          key: zyxel.ies500x.mac
          delay: 1h
          value_type: CHAR
          description: |
            MIB: IF-MIB
            The interface's address at the protocol layer
            immediately `below' the network layer in the
            protocol stack.  For interfaces which do not have
            such an address (e.g., a serial line), this object
            should contain an octet string of zero length.
          inventory_link: MACADDRESS_A
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
          tags:
            - tag: component
              value: inventory
        - uuid: aa26dcc1d8c54feaaa70d42c6ff4d1c7
          name: 'Hardware model name'
          type: SNMP_AGENT
          snmp_oid: 'get[1.3.6.1.2.1.1.1.0]'
          key: zyxel.ies500x.model
          delay: 1h
          value_type: CHAR
          description: |
            MIB: RFC1213-MIB
            A textual description of the entity.  This value
            should include the full name and version
            identification of the system's hardware type,
            software operating-system, and networking
            software.  It is mandatory that this only contain
            printable ASCII characters.
          inventory_link: MODEL
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
          tags:
            - tag: component
              value: inventory
          triggers:
            - uuid: d4b378535f5c4299af1295029e94f9d1
              expression: 'not(last(/ZYXEL IES-500x by SNMP/zyxel.ies500x.model)="IES-5000" or last(/ZYXEL IES-500x by SNMP/zyxel.ies500x.model)="IES-5005")'
              name: 'ZYXEL: Template does not match hardware'
              priority: INFO
              description: 'This template is for Zyxel IES-500x, but connected to {ITEM.VALUE}'
              tags:
                - tag: scope
                  value: notice
        - uuid: ee9da829778e4da69fde78f72b5b0783
          name: 'Host name'
          type: SNMP_AGENT
          snmp_oid: 'get[1.3.6.1.2.1.1.5.0]'
          key: zyxel.ies500x.name
          delay: 1h
          value_type: CHAR
          description: |
            MIB: RFC1213-MIB
            An administratively-assigned name for this
            managed node.  By convention, this is the node's
            fully-qualified domain name.
          inventory_link: NAME
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
          tags:
            - tag: component
              value: inventory
        - uuid: 28df2d29a94d429d811dd40ceb510fcf
          name: 'Uptime (network)'
          type: SNMP_AGENT
          snmp_oid: 'get[1.3.6.1.2.1.1.3.0]'
          key: zyxel.ies500x.net.uptime
          delay: 30s
          trends: '0'
          units: uptime
          description: |
            MIB: RFC1213-MIB
            The time (in hundredths of a second) since the
            network management portion of the system was last
            re-initialized.
          preprocessing:
            - type: MULTIPLIER
              parameters:
                - '0.01'
          tags:
            - tag: component
              value: system
      discovery_rules:
        - uuid: 2ddba614e41f4014abef703418439e2a
          name: 'Packet buffer discovery'
          type: SNMP_AGENT
          snmp_oid: 'discovery[{#ZYXEL.BUFFERHIGHTHRESH},1.3.6.1.4.1.890.1.5.13.5.11.3.5.1.4]'
          key: zyxel.ies500x.buffer.discovery
          delay: 1h
          description: 'A table that contains packet buffer usage information.'
          item_prototypes:
            - uuid: ac3d27ace5b54f80ad1dd9182d01c0fa
              name: 'Slot {#ZYXEL.SLOT.ID}: Packet buffer utilization'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.4.1.890.1.5.13.5.11.3.5.1.2.{#SNMPINDEX}]'
              key: 'zyxel.ies500x.buffer[{#SNMPINDEX}]'
              units: '%'
              description: |
                MIB: ZYXEL-IES5000-MIB
                The packet buffer usage in the past 60 seconds.
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              tags:
                - tag: component
                  value: system
              trigger_prototypes:
                - uuid: b02248180f314948bdbb68e8b940cb99
                  expression: 'min(/ZYXEL IES-500x by SNMP/zyxel.ies500x.buffer[{#SNMPINDEX}],5m)>{#ZYXEL.BUFFERHIGHTHRESH}'
                  name: 'ZYXEL: High Packet buffer utilization in Slot {#ZYXEL.SLOT.ID}'
                  event_name: 'ZYXEL: High Packet buffer utilization in Slot {#ZYXEL.SLOT.ID} (>{#ZYXEL.BUFFERHIGHTHRESH}% for 5m)'
                  priority: AVERAGE
                  description: 'The system is running out of free buffer.'
                  tags:
                    - tag: scope
                      value: performance
          graph_prototypes:
            - uuid: 83573a387ef24596bf7e4171506a9ea5
              name: 'ZYXEL IES-500x: Slot {#ZYXEL.SLOT.ID}: Packet buffer utilization'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'ZYXEL IES-500x by SNMP'
                    key: 'zyxel.ies500x.buffer[{#SNMPINDEX}]'
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  var inArray = JSON.parse(value);
                  var outArr = []
                  inArray.forEach(function (item, i, arr) {
                  	item['{#ZYXEL.SLOT.ID}'] = item['{#SNMPINDEX}'].split('.')[1];
                  	item['{#ZYXEL.SENSOR.ID}'] = item['{#SNMPINDEX}'].split('.')[2];
                  	outArr.push(item)
                  });
                  return JSON.stringify(outArr);
        - uuid: 72237ffed25148bea512b9a977e0bbde
          name: 'CPU discovery'
          type: SNMP_AGENT
          snmp_oid: 'discovery[{#ZYXEL.CPU.THRESH.HIGH},1.3.6.1.4.1.890.1.5.13.5.11.3.4.1.4]'
          key: zyxel.ies500x.cpu.discovery
          delay: 1h
          description: |
            A table that contains CPU utilization information.
            This table is supported by R1.03 and later versions.
          item_prototypes:
            - uuid: 570e8cb266cd4b38819f2091d3981f24
              name: 'Slot {#ZYXEL.SLOT.ID}: CPU utilization'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.4.1.890.1.5.13.5.11.3.4.1.2.{#SNMPINDEX}]'
              key: 'zyxel.ies500x.cpu[{#SNMPINDEX}]'
              units: '%'
              description: |
                MIB: ZYXEL-IES5000-MIB
                The CPU utilization in the past 60 seconds.
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              tags:
                - tag: component
                  value: cpu
              trigger_prototypes:
                - uuid: e2e689642a884509a5254e946deaf69f
                  expression: 'min(/ZYXEL IES-500x by SNMP/zyxel.ies500x.cpu[{#SNMPINDEX}],5m)>{#ZYXEL.CPU.THRESH.HIGH}'
                  name: 'ZYXEL: Slot {#ZYXEL.SLOT.ID} high CPU utilization'
                  event_name: 'ZYXEL: Slot {#ZYXEL.SLOT.ID} high CPU utilization (over {#ZYXEL.CPU.THRESH.HIGH}% for 5m)'
                  opdata: 'Current utilization: {ITEM.LASTVALUE1}'
                  priority: WARNING
                  description: 'The CPU utilization is too high. The system might be slow to respond.'
                  tags:
                    - tag: scope
                      value: performance
          graph_prototypes:
            - uuid: c9a9a54478ba46bbb91b4945c977a823
              name: 'ZYXEL IES-500x: Slot {#ZYXEL.SLOT.ID}: CPU utilization'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'ZYXEL IES-500x by SNMP'
                    key: 'zyxel.ies500x.cpu[{#SNMPINDEX}]'
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  var inArray = JSON.parse(value);
                  var outArr = []
                  inArray.forEach(function (item, i, arr) {
                  	item['{#ZYXEL.SLOT.ID}'] = item['{#SNMPINDEX}'].split('.')[1];
                  	item['{#ZYXEL.SENSOR.ID}'] = item['{#SNMPINDEX}'].split('.')[2];
                  	outArr.push(item)
                  });
                  return JSON.stringify(outArr);
        - uuid: 6b75915015194d40b043d69754b0e8e9
          name: 'Fan discovery'
          type: SNMP_AGENT
          snmp_oid: 'discovery[{#ZYXEL.FANRPM.THRESH.HIGH},1.3.6.1.4.1.890.1.5.13.5.11.3.1.1.7,{#ZYXEL.FANRPM.THRESH.LOW},1.3.6.1.4.1.890.1.5.13.5.11.3.1.1.5]'
          key: zyxel.ies500x.fan.discovery
          delay: 1h
          description: 'An entry in fanRpmTable.'
          item_prototypes:
            - uuid: 5edaea71cd9e4190912a9d4a916436b3
              name: 'Fan #{#SNMPINDEX}'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.4.1.890.1.5.13.5.11.3.1.1.2.{#SNMPINDEX}]'
              key: 'zyxel.ies500x.fan[{#SNMPINDEX}]'
              units: '!rpm'
              description: |
                MIB: ZYXEL-IES5000-MIB
                Current speed in Revolutions Per Minute (RPM) on the fan.
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              tags:
                - tag: component
                  value: fan
                - tag: component
                  value: sensor
              trigger_prototypes:
                - uuid: 9e249839db314f05a7a3cd16172ae9a7
                  expression: 'last(/ZYXEL IES-500x by SNMP/zyxel.ies500x.fan[{#SNMPINDEX}])<{#ZYXEL.FANRPM.THRESH.LOW} or last(/ZYXEL IES-500x by SNMP/zyxel.ies500x.fan[{#SNMPINDEX}])>{#ZYXEL.FANRPM.THRESH.HIGH}'
                  name: 'ZYXEL: FAN{#SNMPINDEX} is in critical state'
                  opdata: 'Current state: {ITEM.LASTVALUE1}'
                  priority: AVERAGE
                  description: 'Please check the fan unit'
                  tags:
                    - tag: scope
                      value: notice
          graph_prototypes:
            - uuid: 79f318a961b5418e888de36f8ffe17e7
              name: 'ZYXEL IES-500x: Fan #{#SNMPINDEX}'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'ZYXEL IES-500x by SNMP'
                    key: 'zyxel.ies500x.fan[{#SNMPINDEX}]'
        - uuid: 3b33b6eb85b14bfba025b0cd4909fa3e
          name: 'Memory discovery'
          type: SNMP_AGENT
          snmp_oid: 'discovery[{#ZYXEL.MEMORYHIGHTHRESH},1.3.6.1.4.1.890.1.5.13.5.11.3.6.1.4]'
          key: zyxel.ies500x.memory.discovery
          delay: 1h
          description: 'A table that contains memory usage information.'
          item_prototypes:
            - uuid: 61d07cbd85734ea6933182cbcb77b6a8
              name: 'Slot {#ZYXEL.SLOT.ID}: Memory utilization'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.4.1.890.1.5.13.5.11.3.6.1.2.{#SNMPINDEX}]'
              key: 'zyxel.ies500x.memory[{#SNMPINDEX}]'
              units: '%'
              description: |
                MIB: ZYXEL-IES5000-MIB
                The memory usage in the past 60 seconds.
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              tags:
                - tag: component
                  value: memory
              trigger_prototypes:
                - uuid: c3099861742f4303af838a0bf3921fac
                  expression: 'min(/ZYXEL IES-500x by SNMP/zyxel.ies500x.memory[{#SNMPINDEX}],5m)>{#ZYXEL.MEMORYHIGHTHRESH}'
                  name: 'ZYXEL: High memory utilization in Slot {#ZYXEL.SLOT.ID} pool'
                  event_name: 'ZYXEL: High memory utilization in Slot {#ZYXEL.SLOT.ID} pool (>{#ZYXEL.MEMORYHIGHTHRESH}% for 5m)'
                  priority: AVERAGE
                  description: 'The system is running out of free memory.'
                  tags:
                    - tag: scope
                      value: performance
          graph_prototypes:
            - uuid: 0b72c4f49d434e0c9a7de3a6617511ea
              name: 'ZYXEL IES-500x: Slot {#ZYXEL.SLOT.ID}: Memory utilization'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'ZYXEL IES-500x by SNMP'
                    key: 'zyxel.ies500x.memory[{#SNMPINDEX}]'
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  var inArray = JSON.parse(value);
                  var outArr = []
                  inArray.forEach(function (item, i, arr) {
                  	item['{#ZYXEL.SLOT.ID}'] = item['{#SNMPINDEX}'].split('.')[1];
                  	item['{#ZYXEL.SENSOR.ID}'] = item['{#SNMPINDEX}'].split('.')[2];
                  	outArr.push(item)
                  });
                  return JSON.stringify(outArr);
        - uuid: f3cb59dc48924203bc34da090f084665
          name: 'ADSL interface discovery'
          type: SNMP_AGENT
          snmp_oid: 'discovery[{#ZYXEL.IF.NAME},1.3.6.1.2.1.31.1.1.1.1,{#ZYXEL.IF.LINKSTATUS},1.3.6.1.2.1.2.2.1.8,{#ZYXEL.IF.DESC},1.3.6.1.2.1.31.1.1.1.18]'
          key: zyxel.ies500x.net.adsl.discovery
          delay: 1h
          filter:
            evaltype: AND
            conditions:
              - macro: '{#ZYXEL.IF.DESC}'
                value: '{$ZYXEL.LLD.FILTER.IF.DESC.MATCHES}'
              - macro: '{#ZYXEL.IF.DESC}'
                value: '{$ZYXEL.LLD.FILTER.IF.DESC.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
              - macro: '{#ZYXEL.IF.LINKSTATUS}'
                value: '{$ZYXEL.LLD.FILTER.IF.LINKSTATUS.MATCHES}'
              - macro: '{#ZYXEL.IF.LINKSTATUS}'
                value: '{$ZYXEL.LLD.FILTER.IF.LINKSTATUS.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
              - macro: '{#ZYXEL.IF.NAME}'
                value: adsl
          item_prototypes:
            - uuid: be9de0c5e397414bbef8edd74d0f6500
              name: 'Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID}: Administrative status'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.2.2.1.7.{#SNMPINDEX}]'
              key: 'zyxel.ies500x.net.adsl.adminstatus[{#SNMPINDEX}]'
              description: |
                MIB: IF-MIB
                The desired state of the interface.  The
                testing(3) state indicates that no operational
                packets can be passed.
              valuemap:
                name: 'ZYXEL IES-500x port admin status'
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: 3a97021a210442c3bdc461060fbe700b
              name: 'Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID}: ATUC attenuation'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.10.94.1.1.2.1.5.{#SNMPINDEX}]'
              key: 'zyxel.ies500x.net.adsl.atuc.atn[{#SNMPINDEX}]'
              value_type: FLOAT
              units: dB
              description: |
                MIB: ADSL-LINE-MIB
                Measured difference in the total power transmitted by
                the peer ATU and the total power received by this ATU.
                The Info Atuc fields show data acquired from the ATUC (ADSL Termination Unit - Central), in this case ZYXEL IES-500x, during negotiation/provisioning message interchanges.
              preprocessing:
                - type: MULTIPLIER
                  parameters:
                    - '0.1'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
              trigger_prototypes:
                - uuid: 375982ea68ec4800aa27a50a89fd79d5
                  expression: 'min(/ZYXEL IES-500x by SNMP/zyxel.ies500x.net.adsl.atuc.atn[{#SNMPINDEX}],5m)>{$ZYXEL.ADSL.ATN.MAX}'
                  name: 'ZYXEL: High the DSL line attenuation in Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID}'
                  event_name: 'ZYXEL: High the DSL line attenuation in Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID} (>{$ZYXEL.ADSL.ATN.MAX}dB for 5m)'
                  priority: WARNING
                  description: 'The reductions in amplitude of the downstream and upstream DSL signals.'
                  tags:
                    - tag: scope
                      value: capacity
            - uuid: 62f3eb71d01946a68d799aa6ed1d29a3
              name: 'Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID}: ATUC output power'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.10.94.1.1.2.1.7.{#SNMPINDEX}]'
              key: 'zyxel.ies500x.net.adsl.atuc.outpwr[{#SNMPINDEX}]'
              value_type: FLOAT
              units: dB
              description: |
                MIB: ADSL-LINE-MIB
                Measured total output power transmitted by this ATU.
                The Info Atuc fields show data acquired from the ATUC (ADSL Termination Unit - Central), in this case ZYXEL IES-500x, during negotiation/provisioning message interchanges.
              preprocessing:
                - type: MULTIPLIER
                  parameters:
                    - '0.1'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: 540251c3a4024e4289194130853be305
              name: 'Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID}: ATUC noise margin'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.10.94.1.1.2.1.4.{#SNMPINDEX}]'
              key: 'zyxel.ies500x.net.adsl.atuc.snrmgn[{#SNMPINDEX}]'
              value_type: FLOAT
              units: dB
              description: |
                MIB: ADSL-LINE-MIB
                Noise Margin as seen by this ATU with respect to its
                received signal in tenth dB.
                The Info Atuc fields show data acquired from the ATUC (ADSL Termination Unit - Central), in this case ZYXEL IES-500x, during negotiation/provisioning message interchanges.
              preprocessing:
                - type: MULTIPLIER
                  parameters:
                    - '0.1'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
              trigger_prototypes:
                - uuid: 8d2f57548d4e47f2981a4fd79d065246
                  expression: 'min(/ZYXEL IES-500x by SNMP/zyxel.ies500x.net.adsl.atuc.snrmgn[{#SNMPINDEX}],5m)<{$ZYXEL.ADSL.SNR.MIN}'
                  name: 'ZYXEL: Low the DSL line noise margins in Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID}'
                  event_name: 'ZYXEL: Low the DSL line noise margins in Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID} (<{$ZYXEL.ADSL.SNR.MIN}dB for 5m)'
                  priority: WARNING
                  description: 'Signal-to-noise margin (SNR Margin) which is the difference between the actual SNR and the SNR required to sync at a specific speed'
                  tags:
                    - tag: scope
                      value: capacity
            - uuid: a664c452a98d4478b4663aa7cca9c19c
              name: 'Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID}: ATUR attenuation'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.10.94.1.1.3.1.5.{#SNMPINDEX}]'
              key: 'zyxel.ies500x.net.adsl.atur.atn[{#SNMPINDEX}]'
              value_type: FLOAT
              units: dB
              description: |
                MIB: ADSL-LINE-MIB
                Measured difference in the total power transmitted by
                the peer ATU and the total power received by this ATU.
                The Info Atur fields show data acquired from the ATUR (ADSL Termination Unit - Remote), in this case the subscriber's ADSL modem or router, during negotiation/provisioning message interchanges.
              preprocessing:
                - type: MULTIPLIER
                  parameters:
                    - '0.1'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
              trigger_prototypes:
                - uuid: 1dec7ed135a348b1a1cebb3b4319d77f
                  expression: 'min(/ZYXEL IES-500x by SNMP/zyxel.ies500x.net.adsl.atur.atn[{#SNMPINDEX}],5m)>{$ZYXEL.ADSL.ATN.MAX}'
                  name: 'ZYXEL: High the DSL line attenuation in Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID}'
                  event_name: 'ZYXEL: High the DSL line attenuation in Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID} (>{$ZYXEL.ADSL.ATN.MAX}dB for 5m)'
                  priority: WARNING
                  description: 'The reductions in amplitude of the downstream and upstream DSL signals.'
                  tags:
                    - tag: scope
                      value: capacity
            - uuid: 91a4b40293d54fe8bc8894303055cba3
              name: 'Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID}: ATUR output power'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.10.94.1.1.3.1.7.{#SNMPINDEX}]'
              key: 'zyxel.ies500x.net.adsl.atur.outpwr[{#SNMPINDEX}]'
              value_type: FLOAT
              units: dB
              description: |
                MIB: ADSL-LINE-MIB
                Measured total output power transmitted by this ATU.
                The Info Atur fields show data acquired from the ATUR (ADSL Termination Unit - Remote), in this case the subscriber's ADSL modem or router, during negotiation/provisioning message interchanges.
              preprocessing:
                - type: MULTIPLIER
                  parameters:
                    - '0.1'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: 691ffcf882c54ebe8d0dfa305d8497e0
              name: 'Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID}: ATUR noise margin'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.10.94.1.1.3.1.4.{#SNMPINDEX}]'
              key: 'zyxel.ies500x.net.adsl.atur.snrmgn[{#SNMPINDEX}]'
              value_type: FLOAT
              units: dB
              description: |
                MIB: ADSL-LINE-MIB
                Noise Margin as seen by this ATU with respect to its
                received signal in tenth dB.
                The Info Atur fields show data acquired from the ATUR (ADSL Termination Unit - Remote), in this case the subscriber's ADSL modem or router, during negotiation/provisioning message interchanges.
              preprocessing:
                - type: MULTIPLIER
                  parameters:
                    - '0.1'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
              trigger_prototypes:
                - uuid: 7f8f4a2bff14464fbe2f956be87ad56d
                  expression: 'min(/ZYXEL IES-500x by SNMP/zyxel.ies500x.net.adsl.atur.snrmgn[{#SNMPINDEX}],5m)<{$ZYXEL.ADSL.SNR.MIN}'
                  name: 'ZYXEL: Low the DSL line noise margins in Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID}'
                  event_name: 'ZYXEL: Low the DSL line noise margins in Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID} (<{$ZYXEL.ADSL.SNR.MIN}dB for 5m)'
                  priority: WARNING
                  description: 'Signal-to-noise margin (SNR Margin) which is the difference between the actual SNR and the SNR required to sync at a specific speed'
                  tags:
                    - tag: scope
                      value: capacity
            - uuid: c00cf2ee74c0476f9118594d04e6640d
              name: 'Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID}: Interface description'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.31.1.1.1.18.{#SNMPINDEX}]'
              key: 'zyxel.ies500x.net.adsl.descr[{#SNMPINDEX}]'
              value_type: CHAR
              description: |
                MIB: IF-MIB
                A textual string containing information about the interface
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: 3df0ee0298c2445f81e1aca8ee748a50
              name: 'Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID}: Incoming broadcast packages'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.31.1.1.1.9.{#SNMPINDEX}]'
              key: 'zyxel.ies500x.net.adsl.in.broadcastpkts[{#SNMPINDEX}]'
              units: packets/s
              description: |
                MIB: IF-MIB
                The number of packets, delivered by this sub-layer to a
                higher (sub-)layer, which were addressed to a broadcast
                address at this sub-layer.
              preprocessing:
                - type: CHANGE_PER_SECOND
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: 05799441c906425d8f584ead3e9b909b
              name: 'Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID}: Incoming multicast packages'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.31.1.1.1.8.{#SNMPINDEX}]'
              key: 'zyxel.ies500x.net.adsl.in.multicastpkts[{#SNMPINDEX}]'
              units: packets/s
              description: |
                MIB: IF-MIB
                The number of packets, delivered by this sub-layer to a
                higher (sub-)layer, which were addressed to a multicast
                address at this sub-layer.  For a MAC layer protocol, this
                includes both Group and Functional addresses.
              preprocessing:
                - type: CHANGE_PER_SECOND
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: fff4c400f6774b9ba5e47fbeb214e5ec
              name: 'Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID}: Incoming traffic'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.31.1.1.1.6.{#SNMPINDEX}]'
              key: 'zyxel.ies500x.net.adsl.in.traffic[{#SNMPINDEX}]'
              units: bps
              description: |
                MIB: IF-MIB
                The total number of octets received on the interface,
                including framing characters.
              preprocessing:
                - type: MULTIPLIER
                  parameters:
                    - '8'
                - type: CHANGE_PER_SECOND
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: 4ffe4823f03b4c738b305f03ae4f1d55
              name: 'Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID}: Incoming unicast packages'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.31.1.1.1.7.{#SNMPINDEX}]'
              key: 'zyxel.ies500x.net.adsl.in.ucastpkts[{#SNMPINDEX}]'
              units: packets/s
              description: |
                MIB: IF-MIB
                The number of packets, delivered by this sub-layer to a
                higher (sub-)layer, which were not addressed to a multicast
                or broadcast address at this sub-layer
              preprocessing:
                - type: CHANGE_PER_SECOND
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: 514910a945e34befa0ecc22ea0b89783
              name: 'Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID}: Interface name'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.31.1.1.1.1.{#SNMPINDEX}]'
              key: 'zyxel.ies500x.net.adsl.name[{#SNMPINDEX}]'
              value_type: CHAR
              description: |
                MIB: IF-MIB
                A textual string containing information about the interface
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: 216ad17a0c3348d7a250697f768a6481
              name: 'Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID}: Operational status'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.2.2.1.8.{#SNMPINDEX}]'
              key: 'zyxel.ies500x.net.adsl.operstatus[{#SNMPINDEX}]'
              description: |
                MIB: IF-MIB
                The current operational state of the interface.
                The testing(3) state indicates that no operational
                packets can be passed.
              valuemap:
                name: 'ZYXEL IES-500x port operational status'
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
              trigger_prototypes:
                - uuid: 8afcc973a7e94a0782a057205cc1b8ed
                  expression: 'last(/ZYXEL IES-500x by SNMP/zyxel.ies500x.net.adsl.operstatus[{#SNMPINDEX}])=2 and last(/ZYXEL IES-500x by SNMP/zyxel.ies500x.net.adsl.operstatus[{#SNMPINDEX}],#1)<>last(/ZYXEL IES-500x by SNMP/zyxel.ies500x.net.adsl.operstatus[{#SNMPINDEX}],#2)'
                  recovery_mode: RECOVERY_EXPRESSION
                  recovery_expression: 'last(/ZYXEL IES-500x by SNMP/zyxel.ies500x.net.adsl.operstatus[{#SNMPINDEX}])<>2'
                  name: 'ZYXEL: Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID}: Link down'
                  opdata: 'Current state: {ITEM.LASTVALUE1}'
                  priority: AVERAGE
                  description: |
                    This trigger expression works as follows:
                    1. It can be triggered if the operations status is down.
                    2. `{$IFCONTROL:"{#IFNAME}"}=1` - a user can redefine context macro to value - 0. That marks this interface as not important. No new trigger will be fired if this interface is down.
                    3. `{TEMPLATE_NAME:METRIC.diff()}=1` - the trigger fires only if the operational status was up to (1) sometime before (so, do not fire for the 'eternal off' interfaces.)
                    
                    WARNING: if closed manually - it will not fire again on the next poll, because of .diff.
                  manual_close: 'YES'
                  tags:
                    - tag: scope
                      value: notice
            - uuid: 7eec054602cb4f988999d80b29f25a32
              name: 'Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID}: Outgoing broadcast packages'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.31.1.1.1.13.{#SNMPINDEX}]'
              key: 'zyxel.ies500x.net.adsl.out.broadcastpkts[{#SNMPINDEX}]'
              units: packets/s
              description: |
                MIB: IF-MIB
                The total number of packets that higher-level protocols
                requested be transmitted, and which were addressed to a
                broadcast address at this sub-layer, including those that
                were discarded or not sent.
              preprocessing:
                - type: CHANGE_PER_SECOND
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: 420fa08f36bf487cb0af6dc64f335e7b
              name: 'Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID}: Outgoing multicast packages'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.31.1.1.1.12.{#SNMPINDEX}]'
              key: 'zyxel.ies500x.net.adsl.out.multicastpkts[{#SNMPINDEX}]'
              units: packets/s
              description: |
                MIB: IF-MIB
                The total number of packets that higher-level protocols
                requested be transmitted, and which were addressed to a
                multicast address at this sub-layer, including those that
                were discarded or not sent.  For a MAC layer protocol, this
                includes both Group and Functional addresses.
              preprocessing:
                - type: CHANGE_PER_SECOND
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: 70a1342e17634500ac9c896c66177de6
              name: 'Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID}: Outgoing traffic'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.31.1.1.1.10.{#SNMPINDEX}]'
              key: 'zyxel.ies500x.net.adsl.out.traffic[{#SNMPINDEX}]'
              units: bps
              description: |
                MIB: IF-MIB
                The total number of octets transmitted out of the
                interface, including framing characters.  This object is a
                64-bit version of ifOutOctets.
              preprocessing:
                - type: MULTIPLIER
                  parameters:
                    - '8'
                - type: CHANGE_PER_SECOND
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: 5c2f168d421e4b81a3d62e415ec8218a
              name: 'Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID}: Outgoing unicast packages'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.31.1.1.1.11.{#SNMPINDEX}]'
              key: 'zyxel.ies500x.net.adsl.out.ucastpkts[{#SNMPINDEX}]'
              units: packets/s
              description: |
                MIB: IF-MIB
                The total number of packets that higher-level protocols
                requested be transmitted, and which were not addressed to a
                multicast or broadcast address at this sub-layer, including
                those that were discarded or not sent.
              preprocessing:
                - type: CHANGE_PER_SECOND
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
          graph_prototypes:
            - uuid: a98704946d534a06909de85a05d75224
              name: 'ZYXEL IES-500x: Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID}: Packets traffic'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'ZYXEL IES-500x by SNMP'
                    key: 'zyxel.ies500x.net.adsl.in.ucastpkts[{#SNMPINDEX}]'
                - sortorder: '1'
                  color: F63100
                  item:
                    host: 'ZYXEL IES-500x by SNMP'
                    key: 'zyxel.ies500x.net.adsl.out.ucastpkts[{#SNMPINDEX}]'
                - sortorder: '2'
                  color: 00611C
                  item:
                    host: 'ZYXEL IES-500x by SNMP'
                    key: 'zyxel.ies500x.net.adsl.in.multicastpkts[{#SNMPINDEX}]'
                - sortorder: '3'
                  color: F7941D
                  item:
                    host: 'ZYXEL IES-500x by SNMP'
                    key: 'zyxel.ies500x.net.adsl.out.multicastpkts[{#SNMPINDEX}]'
                - sortorder: '4'
                  color: FC6EA3
                  item:
                    host: 'ZYXEL IES-500x by SNMP'
                    key: 'zyxel.ies500x.net.adsl.in.broadcastpkts[{#SNMPINDEX}]'
                - sortorder: '5'
                  color: 6C59DC
                  item:
                    host: 'ZYXEL IES-500x by SNMP'
                    key: 'zyxel.ies500x.net.adsl.out.broadcastpkts[{#SNMPINDEX}]'
            - uuid: 184fddf8b22047e6a7ff4c5837642e60
              name: 'ZYXEL IES-500x: Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID}: Traffic'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'ZYXEL IES-500x by SNMP'
                    key: 'zyxel.ies500x.net.adsl.in.traffic[{#SNMPINDEX}]'
                - sortorder: '1'
                  color: F63100
                  item:
                    host: 'ZYXEL IES-500x by SNMP'
                    key: 'zyxel.ies500x.net.adsl.out.traffic[{#SNMPINDEX}]'
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  var inArray = JSON.parse(value);
                  var outArr = []
                  inArray.forEach(function (item, i, arr) {
                  	item['{#ZYXEL.SLOT.ID}'] = Math.floor(item['{#SNMPINDEX}'] / 100);
                  	item['{#ZYXEL.PORTID}'] = item['{#SNMPINDEX}'] % 100;
                  	outArr.push(item)
                  });
                  return JSON.stringify(outArr);
          overrides:
            - name: 'Don''t create triggers for matching interface'
              step: '1'
              filter:
                conditions:
                  - macro: '{#ZYXEL.IF.NAME}'
                    value: '{$ZYXEL.LLD.FILTER.IF.CONTROL.MATCHES}'
                    operator: NOT_MATCHES_REGEX
              operations:
                - operationobject: TRIGGER_PROTOTYPE
                  operator: REGEXP
                  value: '.*'
                  discover: NO_DISCOVER
        - uuid: 5121e130194244869e45f9f7bda7cd01
          name: 'Ethernet interface discovery'
          type: SNMP_AGENT
          snmp_oid: 'discovery[{#ZYXEL.IF.NAME},1.3.6.1.2.1.31.1.1.1.1,{#ZYXEL.IF.LINKSTATUS},1.3.6.1.2.1.2.2.1.8,{#ZYXEL.IF.DESC},1.3.6.1.2.1.31.1.1.1.18]'
          key: zyxel.ies500x.net.if.discovery
          delay: 1h
          filter:
            evaltype: AND
            conditions:
              - macro: '{#ZYXEL.IF.DESC}'
                value: '{$ZYXEL.LLD.FILTER.IF.DESC.MATCHES}'
              - macro: '{#ZYXEL.IF.DESC}'
                value: '{$ZYXEL.LLD.FILTER.IF.DESC.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
              - macro: '{#ZYXEL.IF.LINKSTATUS}'
                value: '{$ZYXEL.LLD.FILTER.IF.LINKSTATUS.MATCHES}'
              - macro: '{#ZYXEL.IF.LINKSTATUS}'
                value: '{$ZYXEL.LLD.FILTER.IF.LINKSTATUS.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
              - macro: '{#ZYXEL.IF.NAME}'
                value: enet
          item_prototypes:
            - uuid: bc53c15035a94ed4a7537f0ab119d738
              name: 'Port {#SNMPINDEX}: Administrative status'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.2.2.1.7.{#SNMPINDEX}]'
              key: 'zyxel.ies500x.net.if.adminstatus[{#SNMPINDEX}]'
              description: |
                MIB: IF-MIB
                The desired state of the interface.  The
                testing(3) state indicates that no operational
                packets can be passed.
              valuemap:
                name: 'ZYXEL IES-500x port admin status'
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: 7bd13f8dd37c417dbbc92abbcbefbdde
              name: 'Port {#SNMPINDEX}: Interface description'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.31.1.1.1.18.{#SNMPINDEX}]'
              key: 'zyxel.ies500x.net.if.descr[{#SNMPINDEX}]'
              value_type: CHAR
              description: |
                MIB: IF-MIB
                A textual string containing information about the interface
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: 7ab66a4640ee4852ad0e587eb1076f9d
              name: 'Port {#SNMPINDEX}: Link speed'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.31.1.1.1.15.{#SNMPINDEX}]'
              key: 'zyxel.ies500x.net.if.highspeed[{#SNMPINDEX}]'
              units: bps
              description: |
                MIB: IF-MIB
                An estimate of the interface's current bandwidth in bits per second
              preprocessing:
                - type: MULTIPLIER
                  parameters:
                    - '1000000'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: 0b1508bec31642c381b4bab5b1c394fb
              name: 'Port {#SNMPINDEX}: Incoming broadcast packages'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.31.1.1.1.9.{#SNMPINDEX}]'
              key: 'zyxel.ies500x.net.if.in.broadcastpkts[{#SNMPINDEX}]'
              units: packets/s
              description: |
                MIB: IF-MIB
                The number of packets, delivered by this sub-layer to a
                higher (sub-)layer, which were addressed to a broadcast
                address at this sub-layer.
              preprocessing:
                - type: CHANGE_PER_SECOND
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: 5a77fb99febd45feaadbb4f1c6f58ead
              name: 'Port {#SNMPINDEX}: Incoming multicast packages'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.31.1.1.1.8.{#SNMPINDEX}]'
              key: 'zyxel.ies500x.net.if.in.multicastpkts[{#SNMPINDEX}]'
              units: packets/s
              description: |
                MIB: IF-MIB
                The number of packets, delivered by this sub-layer to a
                higher (sub-)layer, which were addressed to a multicast
                address at this sub-layer.  For a MAC layer protocol, this
                includes both Group and Functional addresses.
              preprocessing:
                - type: CHANGE_PER_SECOND
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: a4375745658546598b786c43bafb629f
              name: 'Port {#SNMPINDEX}: Incoming traffic'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.31.1.1.1.6.{#SNMPINDEX}]'
              key: 'zyxel.ies500x.net.if.in.traffic[{#SNMPINDEX}]'
              units: bps
              description: |
                MIB: IF-MIB
                The total number of octets received on the interface,
                including framing characters.
              preprocessing:
                - type: MULTIPLIER
                  parameters:
                    - '8'
                - type: CHANGE_PER_SECOND
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: eb00c7f533b24a06b3b9b926dc8aff2d
              name: 'Port {#SNMPINDEX}: Incoming unicast packages'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.31.1.1.1.7.{#SNMPINDEX}]'
              key: 'zyxel.ies500x.net.if.in.ucastpkts[{#SNMPINDEX}]'
              units: packets/s
              description: |
                MIB: IF-MIB
                The number of packets, delivered by this sub-layer to a
                higher (sub-)layer, which were not addressed to a multicast
                or broadcast address at this sub-layer
              preprocessing:
                - type: CHANGE_PER_SECOND
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: c90cfe865d7a4fdd89970e086b04a9a7
              name: 'Port {#SNMPINDEX}: Incoming utilization'
              type: CALCULATED
              key: 'zyxel.ies500x.net.if.in.util[{#SNMPINDEX}]'
              value_type: FLOAT
              units: '%'
              params: 'last(//zyxel.ies500x.net.if.in.traffic[{#SNMPINDEX}]) * (last(//zyxel.ies500x.net.if.highspeed[{#SNMPINDEX}]) <> 0) /( last(//zyxel.ies500x.net.if.highspeed[{#SNMPINDEX}]) + (last(//zyxel.ies500x.net.if.highspeed[{#SNMPINDEX}]) = 0) ) * 100'
              description: 'Interface utilization percentage'
              preprocessing:
                - type: IN_RANGE
                  parameters:
                    - '0'
                    - '100'
                  error_handler: DISCARD_VALUE
                - type: JAVASCRIPT
                  parameters:
                    - 'return +parseFloat(value).toFixed(0);'
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: bbbd8624e0e24db8b062625a2de1785b
              name: 'Port {#SNMPINDEX}: Interface name'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.31.1.1.1.1.{#SNMPINDEX}]'
              key: 'zyxel.ies500x.net.if.name[{#SNMPINDEX}]'
              value_type: CHAR
              description: |
                MIB: IF-MIB
                A textual string containing information about the interface
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: d3e519c9648c4c58a7e55a9c90d8a3c0
              name: 'Port {#SNMPINDEX}: Operational status'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.2.2.1.8.{#SNMPINDEX}]'
              key: 'zyxel.ies500x.net.if.operstatus[{#SNMPINDEX}]'
              description: |
                MIB: IF-MIB
                The current operational state of the interface.
                The testing(3) state indicates that no operational
                packets can be passed.
              valuemap:
                name: 'ZYXEL IES-500x port operational status'
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
              trigger_prototypes:
                - uuid: 71a10836f3094184bba728a0cf4d005a
                  expression: 'last(/ZYXEL IES-500x by SNMP/zyxel.ies500x.net.if.operstatus[{#SNMPINDEX}])=2 and last(/ZYXEL IES-500x by SNMP/zyxel.ies500x.net.if.operstatus[{#SNMPINDEX}],#1)<>last(/ZYXEL IES-500x by SNMP/zyxel.ies500x.net.if.operstatus[{#SNMPINDEX}],#2)'
                  recovery_mode: RECOVERY_EXPRESSION
                  recovery_expression: 'last(/ZYXEL IES-500x by SNMP/zyxel.ies500x.net.if.operstatus[{#SNMPINDEX}])<>2'
                  name: 'ZYXEL: Port {#SNMPINDEX}: Link down'
                  opdata: 'Current state: {ITEM.LASTVALUE1}'
                  priority: AVERAGE
                  description: |
                    This trigger expression works as follows:
                    1. It can be triggered if the operations status is down.
                    2. `{$IFCONTROL:"{#IFNAME}"}=1` - a user can redefine context macro to value - 0. That marks this interface as not important. No new trigger will be fired if this interface is down.
                    3. `{TEMPLATE_NAME:METRIC.diff()}=1` - the trigger fires only if the operational status was up to (1) sometime before (so, do not fire for the 'eternal off' interfaces.)
                    
                    WARNING: if closed manually - it will not fire again on the next poll, because of .diff.
                  manual_close: 'YES'
                  tags:
                    - tag: scope
                      value: notice
            - uuid: 7816c8845baa498a96cc6d0a4049357c
              name: 'Port {#SNMPINDEX}: Outgoing broadcast packages'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.31.1.1.1.13.{#SNMPINDEX}]'
              key: 'zyxel.ies500x.net.if.out.broadcastpkts[{#SNMPINDEX}]'
              units: packets/s
              description: |
                MIB: IF-MIB
                The total number of packets that higher-level protocols
                requested be transmitted, and which were addressed to a
                broadcast address at this sub-layer, including those that
                were discarded or not sent.
              preprocessing:
                - type: CHANGE_PER_SECOND
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: bbd80eaceee848019cfef5e20f0c356a
              name: 'Port {#SNMPINDEX}: Outgoing multicast packages'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.31.1.1.1.12.{#SNMPINDEX}]'
              key: 'zyxel.ies500x.net.if.out.multicastpkts[{#SNMPINDEX}]'
              units: packets/s
              description: |
                MIB: IF-MIB
                The total number of packets that higher-level protocols
                requested be transmitted, and which were addressed to a
                multicast address at this sub-layer, including those that
                were discarded or not sent.  For a MAC layer protocol, this
                includes both Group and Functional addresses.
              preprocessing:
                - type: CHANGE_PER_SECOND
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: c9f694268c334213a39c09dbadcdd067
              name: 'Port {#SNMPINDEX}: Outgoing traffic'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.31.1.1.1.10.{#SNMPINDEX}]'
              key: 'zyxel.ies500x.net.if.out.traffic[{#SNMPINDEX}]'
              units: bps
              description: |
                MIB: IF-MIB
                The total number of octets transmitted out of the
                interface, including framing characters.  This object is a
                64-bit version of ifOutOctets.
              preprocessing:
                - type: MULTIPLIER
                  parameters:
                    - '8'
                - type: CHANGE_PER_SECOND
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: f929a7e5d0b741c4b557715fbc5a7e1f
              name: 'Port {#SNMPINDEX}: Outgoing unicast packages'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.31.1.1.1.11.{#SNMPINDEX}]'
              key: 'zyxel.ies500x.net.if.out.ucastpkts[{#SNMPINDEX}]'
              units: packets/s
              description: |
                MIB: IF-MIB
                The total number of packets that higher-level protocols
                requested be transmitted, and which were not addressed to a
                multicast or broadcast address at this sub-layer, including
                those that were discarded or not sent.
              preprocessing:
                - type: CHANGE_PER_SECOND
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: 74beae2dcc424702a906aa736e9f9d0f
              name: 'Port {#SNMPINDEX}: Outgoing utilization'
              type: CALCULATED
              key: 'zyxel.ies500x.net.if.out.util[{#SNMPINDEX}]'
              value_type: FLOAT
              units: '%'
              params: 'last(//zyxel.ies500x.net.if.out.traffic[{#SNMPINDEX}]) * (last(//zyxel.ies500x.net.if.highspeed[{#SNMPINDEX}]) <> 0) /( last(//zyxel.ies500x.net.if.highspeed[{#SNMPINDEX}]) + (last(//zyxel.ies500x.net.if.highspeed[{#SNMPINDEX}]) = 0) ) * 100'
              description: 'Interface utilization percentage'
              preprocessing:
                - type: IN_RANGE
                  parameters:
                    - '0'
                    - '100'
                  error_handler: DISCARD_VALUE
                - type: JAVASCRIPT
                  parameters:
                    - 'return +parseFloat(value).toFixed(0);'
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
          graph_prototypes:
            - uuid: cb09087451b3472ab5d04f18c829acc9
              name: 'ZYXEL IES-500x: Port {#SNMPINDEX}: Packets traffic'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'ZYXEL IES-500x by SNMP'
                    key: 'zyxel.ies500x.net.if.in.ucastpkts[{#SNMPINDEX}]'
                - sortorder: '1'
                  color: F63100
                  item:
                    host: 'ZYXEL IES-500x by SNMP'
                    key: 'zyxel.ies500x.net.if.out.ucastpkts[{#SNMPINDEX}]'
                - sortorder: '2'
                  color: 00611C
                  item:
                    host: 'ZYXEL IES-500x by SNMP'
                    key: 'zyxel.ies500x.net.if.in.multicastpkts[{#SNMPINDEX}]'
                - sortorder: '3'
                  color: F7941D
                  item:
                    host: 'ZYXEL IES-500x by SNMP'
                    key: 'zyxel.ies500x.net.if.out.multicastpkts[{#SNMPINDEX}]'
                - sortorder: '4'
                  color: FC6EA3
                  item:
                    host: 'ZYXEL IES-500x by SNMP'
                    key: 'zyxel.ies500x.net.if.in.broadcastpkts[{#SNMPINDEX}]'
                - sortorder: '5'
                  color: 6C59DC
                  item:
                    host: 'ZYXEL IES-500x by SNMP'
                    key: 'zyxel.ies500x.net.if.out.broadcastpkts[{#SNMPINDEX}]'
            - uuid: 82fd413110454b88ab811229cc598eeb
              name: 'ZYXEL IES-500x: Port {#SNMPINDEX}: Traffic'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'ZYXEL IES-500x by SNMP'
                    key: 'zyxel.ies500x.net.if.in.traffic[{#SNMPINDEX}]'
                - sortorder: '1'
                  color: F63100
                  item:
                    host: 'ZYXEL IES-500x by SNMP'
                    key: 'zyxel.ies500x.net.if.out.traffic[{#SNMPINDEX}]'
            - uuid: c4cbf45592f8421eacc85a833509a819
              name: 'ZYXEL IES-500x: Port {#SNMPINDEX}: Utilization'
              ymin_type_1: FIXED
              ymax_type_1: FIXED
              graph_items:
                - color: 199C0D
                  item:
                    host: 'ZYXEL IES-500x by SNMP'
                    key: 'zyxel.ies500x.net.if.out.util[{#SNMPINDEX}]'
                - sortorder: '1'
                  color: F63100
                  item:
                    host: 'ZYXEL IES-500x by SNMP'
                    key: 'zyxel.ies500x.net.if.in.util[{#SNMPINDEX}]'
          overrides:
            - name: 'Don''t create triggers for matching interface'
              step: '1'
              filter:
                conditions:
                  - macro: '{#ZYXEL.IF.NAME}'
                    value: '{$ZYXEL.LLD.FILTER.IF.CONTROL.MATCHES}'
                    operator: NOT_MATCHES_REGEX
              operations:
                - operationobject: TRIGGER_PROTOTYPE
                  operator: REGEXP
                  value: '.*'
                  discover: NO_DISCOVER
        - uuid: 3edd9015b1794d39819acf0a2fdc35ba
          name: 'Slot discovery'
          type: SNMP_AGENT
          snmp_oid: 'discovery[{#ZYXEL.SLOTSTATUS},1.3.6.1.4.1.890.1.5.13.5.6.3.1.7,{#ZYXEL.SLOT.ID},1.3.6.1.4.1.890.1.5.13.5.6.3.1.1]'
          key: zyxel.ies500x.slot.discovery
          delay: 1h
          filter:
            evaltype: AND
            conditions:
              - macro: '{#ZYXEL.SLOTSTATUS}'
                value: '{$ZYXEL.LLD.FILTER.SLOT.STATUS.MATCHES}'
              - macro: '{#ZYXEL.SLOTSTATUS}'
                value: '{$ZYXEL.LLD.FILTER.SLOT.STATUS.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          description: 'The table which contains the slot information in a chassis.'
          item_prototypes:
            - uuid: e3a25e0a2532495291446bd1a6641926
              name: 'Slot {#ZYXEL.SLOT.ID}: Alarm status'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.4.1.890.1.5.13.5.6.3.1.8.{#SNMPINDEX}]'
              key: 'zyxel.ies500x.slot.alarm[{#SNMPINDEX}]'
              value_type: CHAR
              description: |
                MIB: ZYXEL-IES5000-MIB
                This variable indicates the alarm status of the module.
                It is a bit map represented a sum, therefore, it can represent
                multiple defects simultaneously. The moduleNoDefect should be set
                if and only if no other flag is set.
                The various bit positions are:
                1   moduleNoDefect
                2   moduleOverHeat
                3   moduleFanRpmLow
                4   moduleVoltageLow
                5   moduleThermalSensorFailure
                6   modulePullOut
                7   powerDC48VAFailure
                8   powerDC48VBFailure
                9   extAlarmInputTrigger
                10   moduleDown
                11   mscSwitchOverOK
                12   networkTopologyChange
                13   macSpoof
                14   cpuHigh
                15   memoryUsageHigh
                16   packetBufferUsageHigh
                17   loopguardOccurence
              preprocessing:
                - type: JAVASCRIPT
                  parameters:
                    - |
                      var valueArray = [
                      	'moduleNoDefect',
                      	'moduleOverHeat',
                      	'moduleFanRpmLow',
                      	'moduleVoltageLow',
                      	'moduleThermalSensorFailure',
                      	'modulePullOut',
                      	'powerDC48VAFailure',
                      	'powerDC48VBFailure',
                      	'extAlarmInputTrigger',
                      	'moduleDown',
                      	'mscSwitchOverOK',
                      	'networkTopologyChange',
                      	'macSpoof',
                      	'cpuHigh',
                      	'memoryUsageHigh',
                      	'packetBufferUsageHigh',
                      	'loopguardOccurence'
                      ];
                      var base2 = parseInt(value).toString(2);
                      var outArray = [];
                      for (var i = 0; i < base2.length; ++i) {
                      	if (base2[base2.length - 1 - i] === '1') outArray.push(valueArray[i]);
                      }
                      return outArray.join();
              tags:
                - tag: component
                  value: line-card
                - tag: interface
                  value: 'slot-{#ZYXEL.SLOT.ID}'
              trigger_prototypes:
                - uuid: d2dd1a23dbbb467e90ab99ff59a817a2
                  expression: 'find(/ZYXEL IES-500x by SNMP/zyxel.ies500x.slot.alarm[{#SNMPINDEX}],,"like","moduleNoDefect")=0'
                  name: 'ZYXEL: Slot {#ZYXEL.SLOT.ID} alarm'
                  priority: AVERAGE
                  description: 'The slot reported an error.'
                  tags:
                    - tag: scope
                      value: notice
            - uuid: a58ef41b02d94d16abe294bc26fc0874
              name: 'Slot {#ZYXEL.SLOT.ID}: DSL modem code version'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.4.1.890.1.5.13.5.6.3.1.6.{#SNMPINDEX}]'
              key: 'zyxel.ies500x.slot.cv.ver[{#SNMPINDEX}]'
              delay: 1h
              value_type: CHAR
              description: |
                MIB: ZYXEL-IES5000-MIB
                The DSL modem code version of the plug-in card.
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              tags:
                - tag: component
                  value: firmware
                - tag: component
                  value: line-card
                - tag: interface
                  value: 'slot-{#ZYXEL.SLOT.ID}'
              trigger_prototypes:
                - uuid: 1b163693dc87407db836021da67bdccc
                  expression: 'last(/ZYXEL IES-500x by SNMP/zyxel.ies500x.slot.cv.ver[{#SNMPINDEX}],#1)<>last(/ZYXEL IES-500x by SNMP/zyxel.ies500x.slot.cv.ver[{#SNMPINDEX}],#2) and length(last(/ZYXEL IES-500x by SNMP/zyxel.ies500x.slot.cv.ver[{#SNMPINDEX}]))>0'
                  name: 'ZYXEL: Slot {#ZYXEL.SLOT.ID}: DSL modem code has changed'
                  opdata: 'Current value: {ITEM.LASTVALUE1}'
                  priority: INFO
                  description: 'Firmware version has changed. Acknowledge to close the problem manually.'
                  manual_close: 'YES'
                  tags:
                    - tag: scope
                      value: notice
            - uuid: bf65cd99df724b64a4cad64c0681ab27
              name: 'Slot {#ZYXEL.SLOT.ID}: Description'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.4.1.890.1.5.13.5.6.3.1.3.{#SNMPINDEX}]'
              key: 'zyxel.ies500x.slot.desc[{#SNMPINDEX}]'
              value_type: CHAR
              description: |
                MIB: ZYXEL-IES5000-MIB
                The descriptions of the plug-in card.
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              tags:
                - tag: component
                  value: line-card
                - tag: interface
                  value: 'slot-{#ZYXEL.SLOT.ID}'
            - uuid: 081fb5758fb6412890a54630d737f239
              name: 'Slot {#ZYXEL.SLOT.ID}: Driver version'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.4.1.890.1.5.13.5.6.3.1.5.{#SNMPINDEX}]'
              key: 'zyxel.ies500x.slot.dv.ver[{#SNMPINDEX}]'
              delay: 1h
              value_type: CHAR
              description: |
                MIB: ZYXEL-IES5000-MIB
                The DSL driver of the plug-in card.
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              tags:
                - tag: component
                  value: firmware
                - tag: component
                  value: line-card
                - tag: interface
                  value: 'slot-{#ZYXEL.SLOT.ID}'
              trigger_prototypes:
                - uuid: 44f7087bcb524593a419887c199fb613
                  expression: 'last(/ZYXEL IES-500x by SNMP/zyxel.ies500x.slot.dv.ver[{#SNMPINDEX}],#1)<>last(/ZYXEL IES-500x by SNMP/zyxel.ies500x.slot.dv.ver[{#SNMPINDEX}],#2) and length(last(/ZYXEL IES-500x by SNMP/zyxel.ies500x.slot.dv.ver[{#SNMPINDEX}]))>0'
                  name: 'ZYXEL: Slot {#ZYXEL.SLOT.ID}: Driver has changed'
                  opdata: 'Current value: {ITEM.LASTVALUE1}'
                  priority: INFO
                  description: 'Firmware version has changed. Acknowledge to close the problem manually.'
                  manual_close: 'YES'
                  tags:
                    - tag: scope
                      value: notice
            - uuid: 6b3a925397094b00aa31efee03a226fa
              name: 'Slot {#ZYXEL.SLOT.ID}: Firmware version'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.4.1.890.1.5.13.5.6.3.1.4.{#SNMPINDEX}]'
              key: 'zyxel.ies500x.slot.fw.ver[{#SNMPINDEX}]'
              delay: 1h
              value_type: CHAR
              description: |
                MIB: ZYXEL-IES5000-MIB
                The firmware version of the plug-in card.
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              tags:
                - tag: component
                  value: firmware
                - tag: component
                  value: line-card
                - tag: interface
                  value: 'slot-{#ZYXEL.SLOT.ID}'
              trigger_prototypes:
                - uuid: 6de6e5adadf04a79813ed7778b454043
                  expression: 'last(/ZYXEL IES-500x by SNMP/zyxel.ies500x.slot.fw.ver[{#SNMPINDEX}],#1)<>last(/ZYXEL IES-500x by SNMP/zyxel.ies500x.slot.fw.ver[{#SNMPINDEX}],#2) and length(last(/ZYXEL IES-500x by SNMP/zyxel.ies500x.slot.fw.ver[{#SNMPINDEX}]))>0'
                  name: 'ZYXEL: Slot {#ZYXEL.SLOT.ID}: Firmware has changed'
                  opdata: 'Current value: {ITEM.LASTVALUE1}'
                  priority: INFO
                  description: 'Firmware version has changed. Acknowledge to close the problem manually.'
                  manual_close: 'YES'
                  tags:
                    - tag: scope
                      value: notice
            - uuid: c16e15224326406ba5f4c58a1c2e3b2c
              name: 'Slot {#ZYXEL.SLOT.ID}: Hardware version'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.4.1.890.1.5.13.5.6.3.1.10.{#SNMPINDEX}]'
              key: 'zyxel.ies500x.slot.hw.ver[{#SNMPINDEX}]'
              delay: 1h
              value_type: CHAR
              description: |
                MIB: ZYXEL-IES5000-MIB
                The hardware version of the plug-in card.
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              tags:
                - tag: component
                  value: firmware
                - tag: component
                  value: line-card
                - tag: interface
                  value: 'slot-{#ZYXEL.SLOT.ID}'
              trigger_prototypes:
                - uuid: 42969016e9c846a8954ebf95d2ff0ffc
                  expression: 'last(/ZYXEL IES-500x by SNMP/zyxel.ies500x.slot.hw.ver[{#SNMPINDEX}],#1)<>last(/ZYXEL IES-500x by SNMP/zyxel.ies500x.slot.hw.ver[{#SNMPINDEX}],#2) and length(last(/ZYXEL IES-500x by SNMP/zyxel.ies500x.slot.hw.ver[{#SNMPINDEX}]))>0'
                  name: 'ZYXEL: Slot {#ZYXEL.SLOT.ID}: Hardware version has changed'
                  opdata: 'Current value: {ITEM.LASTVALUE1}'
                  priority: INFO
                  description: 'Firmware version has changed. Acknowledge to close the problem manually.'
                  manual_close: 'YES'
                  tags:
                    - tag: scope
                      value: notice
            - uuid: eed64c81e4b54ccd9d7f0e5b86ede083
              name: 'Slot {#ZYXEL.SLOT.ID}: MAC address 1'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.4.1.890.1.5.13.5.6.3.1.12.{#SNMPINDEX}]'
              key: 'zyxel.ies500x.slot.mac1[{#SNMPINDEX}]'
              value_type: CHAR
              description: |
                MIB: ZYXEL-IES5000-MIB
                The MAC Address of the plug-in card.
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              tags:
                - tag: component
                  value: line-card
                - tag: interface
                  value: 'slot-{#ZYXEL.SLOT.ID}'
            - uuid: d0fdd2a7dcb348b58dd3bea0357f84b3
              name: 'Slot {#ZYXEL.SLOT.ID}: MAC address 2'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.4.1.890.1.5.13.5.6.3.1.13.{#SNMPINDEX}]'
              key: 'zyxel.ies500x.slot.mac2[{#SNMPINDEX}]'
              value_type: CHAR
              description: |
                MIB: ZYXEL-IES5000-MIB
                The MAC Address of the plug-in card.
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              tags:
                - tag: component
                  value: line-card
                - tag: interface
                  value: 'slot-{#ZYXEL.SLOT.ID}'
            - uuid: 6f9532e9368344ad8f7d35273e14c358
              name: 'Slot {#ZYXEL.SLOT.ID}: Serial number'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.4.1.890.1.5.13.5.6.3.1.9.{#SNMPINDEX}]'
              key: 'zyxel.ies500x.slot.serial[{#SNMPINDEX}]'
              value_type: CHAR
              description: |
                MIB: ZYXEL-IES5000-MIB
                The serial number of the plug-in card.
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              tags:
                - tag: component
                  value: line-card
                - tag: interface
                  value: 'slot-{#ZYXEL.SLOT.ID}'
              trigger_prototypes:
                - uuid: 0994c0ab8b004dc280d1a036e7043cc0
                  expression: 'last(/ZYXEL IES-500x by SNMP/zyxel.ies500x.slot.serial[{#SNMPINDEX}],#1)<>last(/ZYXEL IES-500x by SNMP/zyxel.ies500x.slot.serial[{#SNMPINDEX}],#2) and length(last(/ZYXEL IES-500x by SNMP/zyxel.ies500x.slot.serial[{#SNMPINDEX}]))>0'
                  name: 'ZYXEL: Slot {#ZYXEL.SLOT.ID} has been replaced'
                  event_name: 'ZYXEL: Slot {#ZYXEL.SLOT.ID} has been replaced (new serial number received)'
                  priority: INFO
                  description: 'Slot {#ZYXEL.SLOT.ID} serial number has changed. Acknowledge to close the problem manually.'
                  manual_close: 'YES'
                  tags:
                    - tag: scope
                      value: notice
            - uuid: 7b8791b7c91e4c14aa56a29617a6fa81
              name: 'Slot {#ZYXEL.SLOT.ID}: Status'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.4.1.890.1.5.13.5.6.3.1.7.{#SNMPINDEX}]'
              key: 'zyxel.ies500x.slot.status[{#SNMPINDEX}]'
              description: |
                MIB: ZYXEL-IES5000-MIB
                The module state of the plug-in card.
              valuemap:
                name: 'ZYXEL IES-500x module status'
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              tags:
                - tag: component
                  value: line-card
                - tag: interface
                  value: 'slot-{#ZYXEL.SLOT.ID}'
            - uuid: 9387847247134f3296e077713407686e
              name: 'Slot {#ZYXEL.SLOT.ID}: Type'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.4.1.890.1.5.13.5.6.3.1.2.{#SNMPINDEX}]'
              key: 'zyxel.ies500x.slot.type[{#SNMPINDEX}]'
              description: |
                MIB: ZYXEL-IES5000-MIB
                Card type of the plug-in card.
              valuemap:
                name: 'ZYXEL IES-500x module type'
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              tags:
                - tag: component
                  value: line-card
                - tag: interface
                  value: 'slot-{#ZYXEL.SLOT.ID}'
            - uuid: be141094a1ee4b2391bf8684ddca86e6
              name: 'Slot {#ZYXEL.SLOT.ID}: Uptime'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.4.1.890.1.5.13.5.6.3.1.11.{#SNMPINDEX}]'
              key: 'zyxel.ies500x.slot.uptime[{#SNMPINDEX}]'
              units: s
              description: |
                MIB: ZYXEL-IES5000-MIB
                The time (in seconds) since the plug-in card was last re-initialized.
              tags:
                - tag: component
                  value: line-card
                - tag: interface
                  value: 'slot-{#ZYXEL.SLOT.ID}'
              trigger_prototypes:
                - uuid: 6717069c115147b095321f2c4c5ec51b
                  expression: 'last(/ZYXEL IES-500x by SNMP/zyxel.ies500x.slot.uptime[{#SNMPINDEX}])<10m'
                  name: 'ZYXEL: Slot {#ZYXEL.SLOT.ID} has been restarted'
                  event_name: 'ZYXEL: Slot {#ZYXEL.SLOT.ID} has been restarted (uptime < 10m)'
                  priority: INFO
                  description: 'Uptime is less than 10 minutes.'
                  manual_close: 'YES'
                  tags:
                    - tag: scope
                      value: notice
        - uuid: c2d924fbfe3b44a58454e6a4392aa6a8
          name: 'Temperature discovery'
          type: SNMP_AGENT
          snmp_oid: 'discovery[{#ZYXEL.TEMP.THRESH.LOW},1.3.6.1.4.1.890.1.5.13.5.11.3.3.1.7,{#ZYXEL.TEMP.THRESH.HIGH},1.3.6.1.4.1.890.1.5.13.5.11.3.3.1.5]'
          key: zyxel.ies500x.temp.discovery
          delay: 1h
          description: 'An entry in tempTable.'
          item_prototypes:
            - uuid: c8f98b46dbc3464eaa390c504198f550
              name: 'Slot {#ZYXEL.SLOT.ID}: Temperature "{#ZYXEL.TEMP.ID}"'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.4.1.890.1.5.13.5.11.3.3.1.2.{#SNMPINDEX}]'
              key: 'zyxel.ies500x.temp[{#SNMPINDEX}]'
              units: '!°C'
              description: |
                MIB: ZYXEL-IES5000-MIB
                The current temperature measured at this sensor
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              tags:
                - tag: component
                  value: sensor
                - tag: component
                  value: temperature
              trigger_prototypes:
                - uuid: c4993b2d52e04808862ac0d043b0e982
                  expression: 'last(/ZYXEL IES-500x by SNMP/zyxel.ies500x.temp[{#SNMPINDEX}])>{#ZYXEL.TEMP.THRESH.HIGH} or last(/ZYXEL IES-500x by SNMP/zyxel.ies500x.temp[{#SNMPINDEX}])<{#ZYXEL.TEMP.THRESH.LOW}'
                  name: 'ZYXEL: Temperature Slot {#ZYXEL.SLOT.ID} Sensor: {#ZYXEL.TEMP.ID} is in critical state'
                  opdata: 'Current state: {ITEM.LASTVALUE1}'
                  priority: AVERAGE
                  description: 'Please check the temperature'
                  tags:
                    - tag: scope
                      value: notice
          graph_prototypes:
            - uuid: 3b8799c609344e749de0da409b666714
              name: 'ZYXEL IES-500x: "Temperature Slot {#ZYXEL.SLOT.ID} Sensor: {#ZYXEL.TEMP.ID}'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'ZYXEL IES-500x by SNMP'
                    key: 'zyxel.ies500x.temp[{#SNMPINDEX}]'
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  var inArray = JSON.parse(value);
                  var outArr = [];
                  inArray.forEach(function (item, i, arr) {
                  	item['{#ZYXEL.SLOT.ID}'] = item['{#SNMPINDEX}'].split('.')[1];
                  	item['{#ZYXEL.TEMP.ID}'] = item['{#SNMPINDEX}'].split('.')[2];
                  	outArr.push(item);
                  });
                  return JSON.stringify(outArr);
        - uuid: dbc4a230a0bd408b9847b1507c248062
          name: 'Voltage discovery'
          type: SNMP_AGENT
          snmp_oid: 'discovery[{#ZYXEL.VOLT.THRESH.HIGH},1.3.6.1.4.1.890.1.5.13.5.11.3.2.1.8,{#ZYXEL.VOLT.THRESH.LOW},1.3.6.1.4.1.890.1.5.13.5.11.3.2.1.6,{#ZYXEL.VOLT.NOMINAL},1.3.6.1.4.1.890.1.5.13.5.11.3.2.1.5]'
          key: zyxel.ies500x.volt.discovery
          delay: 1h
          description: 'An entry in voltageTable.'
          item_prototypes:
            - uuid: 1b3485d6cc6847639d75d4dbcfda99ea
              name: 'Slot {#ZYXEL.SLOT.ID}: Nominal "{#ZYXEL.VOLT.NOMINAL}"'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.4.1.890.1.5.13.5.11.3.2.1.2.{#SNMPINDEX}]'
              key: 'zyxel.ies500x.volt[{#SNMPINDEX}]'
              value_type: FLOAT
              units: V
              description: |
                MIB: ZYXEL-IES5000-MIB
                The current voltage reading.
              preprocessing:
                - type: MULTIPLIER
                  parameters:
                    - '0.001'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              tags:
                - tag: component
                  value: sensor
                - tag: component
                  value: voltage
              trigger_prototypes:
                - uuid: 55bc511ff2094a86b10c542e896d10e2
                  expression: 'last(/ZYXEL IES-500x by SNMP/zyxel.ies500x.volt[{#SNMPINDEX}])<{#ZYXEL.VOLT.THRESH.LOW} or last(/ZYXEL IES-500x by SNMP/zyxel.ies500x.volt[{#SNMPINDEX}])>{#ZYXEL.VOLT.THRESH.HIGH}'
                  name: 'ZYXEL: Voltage Slot {#ZYXEL.SLOT.ID} {#ZYXEL.VOLT.NOMINAL} is in critical state'
                  opdata: 'Current state: {ITEM.LASTVALUE1}'
                  priority: AVERAGE
                  description: 'Please check the power supply'
                  tags:
                    - tag: scope
                      value: notice
          graph_prototypes:
            - uuid: bf0cfa212f934287b8dd3e405f8d1de3
              name: 'ZYXEL IES-500x: Slot {#ZYXEL.SLOT.ID}: Nominal "{#ZYXEL.VOLT.NOMINAL}"'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'ZYXEL IES-500x by SNMP'
                    key: 'zyxel.ies500x.volt[{#SNMPINDEX}]'
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  var inArray = JSON.parse(value);
                  var outArr = []
                  inArray.forEach(function (item, i, arr) {
                  	item['{#ZYXEL.SLOT.ID}'] = item['{#SNMPINDEX}'].split('.')[1];
                  	item['{#ZYXEL.SENSOR.ID}'] = item['{#SNMPINDEX}'].split('.')[2];
                  	item["{#ZYXEL.VOLT.NOMINAL}"] = "+" + item["{#ZYXEL.VOLT.NOMINAL}"] / 1000 + "V";
                  	item["{#ZYXEL.VOLT.THRESH.LOW}"] /= 1000;
                  	item["{#ZYXEL.VOLT.THRESH.HIGH}"] /= 1000;
                  	outArr.push(item)
                  });
                  return JSON.stringify(outArr);
      tags:
        - tag: class
          value: network
        - tag: target
          value: dslam
        - tag: target
          value: ies-5000
        - tag: target
          value: ies-5005
        - tag: target
          value: zyxel
      macros:
        - macro: '{$SNMP.TIMEOUT}'
          value: 5m
          description: 'The time interval for SNMP agent availability trigger expression.'
          config:
            type: TEXT
            priority: '2'
            section_name: Thresholds
            label: 'Time interval'
            description: 'The time interval for SNMP agent availability trigger expression.'
        - macro: '{$ZYXEL.ADSL.ATN.MAX}'
          value: '40'
          description: 'Type the maximum signal attenuation'
          config:
            type: TEXT
            priority: '4'
            section_name: Thresholds
            label: 'Max signal attenuation'
            description: 'Type the maximum signal attenuation'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$ZYXEL.ADSL.SNR.MIN}'
          value: '8'
          description: 'Type the minimum signal to noise margin (0-31 dB)'
          config:
            type: TEXT
            priority: '3'
            section_name: Thresholds
            label: 'Min signal-to-noise margin (0-31 dB)'
            description: 'Type the minimum signal to noise margin (0-31 dB)'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$ZYXEL.LLD.FILTER.IF.CONTROL.MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'Triggers will be created only for interfaces whose description contains the value of this macro'
          config:
            type: TEXT
            priority: '1'
            section_name: Filters
            label: 'Filter for interface control (include)'
            description: 'Triggers will be created only for interfaces whose description contains the value of this macro'
        - macro: '{$ZYXEL.LLD.FILTER.IF.DESC.MATCHES}'
          value: '.*'
          description: 'Filter by discoverable interface names.'
          config:
            type: TEXT
            priority: '5'
            section_name: Filters
            label: 'Filter for interface description (include)'
            description: 'Filter by discoverable interface names.'
        - macro: '{$ZYXEL.LLD.FILTER.IF.DESC.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'Filter to exclude discovered interfaces by name.'
          config:
            type: TEXT
            priority: '6'
            section_name: Filters
            label: 'Filter for interface description (exclude)'
            description: 'Filter to exclude discovered interfaces by name.'
        - macro: '{$ZYXEL.LLD.FILTER.IF.LINKSTATUS.MATCHES}'
          value: '.*'
          description: 'Filter of discoverable link types.'
          config:
            type: TEXT
            priority: '9'
            section_name: Filters
            label: 'Filter for interface link status (include)'
            description: 'Filter of discoverable link types.'
        - macro: '{$ZYXEL.LLD.FILTER.IF.LINKSTATUS.NOT_MATCHES}'
          value: '2'
          description: 'Filter to exclude discovered by link types.'
          config:
            type: TEXT
            priority: '10'
            section_name: Filters
            label: 'Filter for interface link status (exclude)'
            description: 'Filter to exclude discovered by link types.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$ZYXEL.LLD.FILTER.SLOT.STATUS.MATCHES}'
          value: '.*'
          description: 'Filter by discoverable slot status.'
          config:
            type: TEXT
            priority: '7'
            section_name: Filters
            label: 'Filter for slot status (include)'
            description: 'Filter by discoverable slot status.'
        - macro: '{$ZYXEL.LLD.FILTER.SLOT.STATUS.NOT_MATCHES}'
          value: '1'
          description: 'Filter to exclude discovered slots by status.'
          config:
            type: TEXT
            priority: '8'
            section_name: Filters
            label: 'Filter for slot status (exclude)'
            description: 'Filter to exclude discovered slots by status.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
      dashboards:
        - uuid: 0efca78d067b40eea6f371b9404cef1b
          name: 'Network interfaces'
          pages:
            - widgets:
                - type: graphprototype
                  width: '72'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'ZYXEL IES-500x by SNMP'
                        name: 'ZYXEL IES-500x: Port {#SNMPINDEX}: Traffic'
                    - type: STRING
                      name: reference
                      value: AAAAA
                    - type: INTEGER
                      name: rows
                      value: '5'
      valuemaps:
        - uuid: 10dd3d9951014a38bc3517df54381a66
          name: 'SNMP available'
          mappings:
            - value: '0'
              newvalue: 'not available'
            - value: '1'
              newvalue: available
            - value: '2'
              newvalue: unknown
        - uuid: efd6a6086011465ca956b1664f7d6474
          name: 'ZYXEL IES-500x module status'
          mappings:
            - value: '1'
              newvalue: Empty
            - value: '2'
              newvalue: Up
            - value: '3'
              newvalue: Down
            - value: '4'
              newvalue: Testing
            - value: '5'
              newvalue: Standby
        - uuid: 892651d2b1e3431490f2c531a50e2732
          name: 'ZYXEL IES-500x module type'
          mappings:
            - value: '1'
              newvalue: unknown
            - value: '101'
              newvalue: msc1000G
            - value: '102'
              newvalue: alc1248G_51
            - value: '103'
              newvalue: alc1248G_53
            - value: '104'
              newvalue: slc1248G_22
            - value: '105'
              newvalue: vlc1224G_41
            - value: '106'
              newvalue: msc1024G
            - value: '107'
              newvalue: alc1272G_51
            - value: '108'
              newvalue: vop1248G_61_SIP
            - value: '109'
              newvalue: msc1000GA
            - value: '110'
              newvalue: vlc1324G_51
            - value: '111'
              newvalue: msc1224G
            - value: '112'
              newvalue: vop1248G_61_H248
            - value: '113'
              newvalue: vlc1348G_51
            - value: '114'
              newvalue: elc1220G_55
            - value: '115'
              newvalue: msc1024GA
            - value: '116'
              newvalue: vlc1324G_53
            - value: '117'
              newvalue: ima1408G_81
            - value: '118'
              newvalue: vlc1424G_56
            - value: '119'
              newvalue: slc1348G_22
            - value: '120'
              newvalue: vlc1348G_53
            - value: '121'
              newvalue: alc1372G_51
            - value: '122'
              newvalue: msc1024GB
            - value: '123'
              newvalue: msc1224GB
            - value: '124'
              newvalue: vop1372G_61_H248
        - uuid: 9174dafc199e438994256eff4dd87bdd
          name: 'ZYXEL IES-500x port admin status'
          mappings:
            - value: '1'
              newvalue: Up
            - value: '2'
              newvalue: Down
            - value: '3'
              newvalue: Testing
        - uuid: f64c046f1eca45e09dad683603f4674b
          name: 'ZYXEL IES-500x port operational status'
          mappings:
            - value: '1'
              newvalue: Up
            - value: '2'
              newvalue: Down
            - value: '3'
              newvalue: Testing
            - value: '4'
              newvalue: Unknown
            - value: '5'
              newvalue: Dormant
            - value: '6'
              newvalue: NotPresent
            - value: '7'
              newvalue: lowerLayerDown
    - uuid: 3645654baaf04f11927b171bcb048349
      template: 'ZYXEL IES-6000 by SNMP'
      name: 'ZYXEL IES-6000 by SNMP'
      description: |
        ZYXEL IES-6000
        
        MIBs used:
        RFC1213-MIB
        HOST-RESOURCES-MIB
        ADSL-LINE-MIB
        ZYXEL-IES5000-MIB
        IF-MIB
        
        Known Issues:
        
          Description: Incorrect handling of SNMP bulk requests. Disable the use of bulk requests in the SNMP interface settings.
          Version: all versions firmware
          Device: ZYXEL IES-6000
        
        You can discuss this template or leave feedback on our forum https://www.zabbix.com/forum/zabbix-suggestions-and-feedback/422668-discussion-thread-for-official-zabbix-templates-for-zyxel
        
        Generated by official Zabbix template tool "Templator"
      wizard_ready: 'YES'
      readme: |
        ## Overview
        
        https://service-provider.zyxel.com/global/en/products/msansdslams/central-msans/chassis-msans/ies-6000-series
        
        ### Known Issues
        
        Description: Incorrect handling of SNMP bulk requests. Disable the use of bulk requests in the SNMP interface settings.
        Version: all versions firmware
        Device: ZYXEL IES-6000
      vendor:
        name: Zabbix
        version: 8.0-2
      groups:
        - name: 'Templates/Network devices'
      items:
        - uuid: ab61e5047280486885692ba89781c9fd
          name: 'SNMP agent availability'
          type: INTERNAL
          key: 'zabbix[host,snmp,available]'
          valuemap:
            name: 'SNMP available'
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          tags:
            - tag: component
              value: network
          triggers:
            - uuid: 41eb76d6be3e47b8b0ca1296470372aa
              expression: 'max(/ZYXEL IES-6000 by SNMP/zabbix[host,snmp,available],{$SNMP.TIMEOUT})=0'
              name: 'ZYXEL: No SNMP data collection'
              opdata: 'Current state: {ITEM.LASTVALUE1}'
              priority: WARNING
              description: 'SNMP is not available for polling. Please check device connectivity and SNMP settings.'
              tags:
                - tag: scope
                  value: availability
        - uuid: c4856aae926047078d33bc760833ec12
          name: Contact
          type: SNMP_AGENT
          snmp_oid: 'get[1.3.6.1.2.1.1.4.0]'
          key: zyxel.ies6000.contact
          delay: 1h
          value_type: CHAR
          description: |
            MIB: RFC1213-MIB
            The textual identification of the contact person
            for this managed node, together with information
            on how to contact this person.
          inventory_link: CONTACT
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
          tags:
            - tag: component
              value: inventory
        - uuid: 006a65489cfc4231acad12cdb501a55c
          name: 'Uptime (hardware)'
          type: SNMP_AGENT
          snmp_oid: 'get[1.3.6.1.2.1.25.1.1.0]'
          key: zyxel.ies6000.hw.uptime
          delay: 30s
          trends: '0'
          units: uptime
          description: |
            MIB: HOST-RESOURCES-MIB
            The amount of time since this host was last initialized.
            Note that this is different from sysUpTime in the SNMPv2-MIB
            [RFC1907] because sysUpTime is the uptime of the
            network management portion of the system.
          preprocessing:
            - type: CHECK_NOT_SUPPORTED
              parameters:
                - '-1'
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
            - type: MULTIPLIER
              parameters:
                - '0.01'
          tags:
            - tag: component
              value: system
        - uuid: 631f2bc2963c4abb8d01b5cca6179d77
          name: Location
          type: SNMP_AGENT
          snmp_oid: 'get[1.3.6.1.2.1.1.6.0]'
          key: zyxel.ies6000.location
          delay: 1h
          value_type: CHAR
          description: |
            MIB: RFC1213-MIB
            The physical location of this node (e.g.,
            `telephone closet, 3rd floor').
          inventory_link: LOCATION
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
          tags:
            - tag: component
              value: inventory
        - uuid: 663131027cc84bd188fb4e5bd240777c
          name: 'MAC address'
          type: SNMP_AGENT
          snmp_oid: 'get[1.3.6.1.2.1.2.2.1.6.1]'
          key: zyxel.ies6000.mac
          delay: 1h
          value_type: CHAR
          description: |
            MIB: IF-MIB
            The interface's address at the protocol layer
            immediately `below' the network layer in the
            protocol stack.  For interfaces which do not have
            such an address (e.g., a serial line), this object
            should contain an octet string of zero length.
          inventory_link: MACADDRESS_A
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
          tags:
            - tag: component
              value: inventory
        - uuid: a91730326e1c4479bb330110a15ee689
          name: 'Hardware model name'
          type: SNMP_AGENT
          snmp_oid: 'get[1.3.6.1.2.1.1.1.0]'
          key: zyxel.ies6000.model
          delay: 1h
          value_type: CHAR
          description: |
            MIB: RFC1213-MIB
            A textual description of the entity.  This value
            should include the full name and version
            identification of the system's hardware type,
            software operating-system, and networking
            software.  It is mandatory that this only contain
            printable ASCII characters.
          inventory_link: MODEL
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
          tags:
            - tag: component
              value: inventory
          triggers:
            - uuid: 7f6f8bdde2644182a892792ff2bb7c68
              expression: 'last(/ZYXEL IES-6000 by SNMP/zyxel.ies6000.model)<>"IES-6000"'
              name: 'ZYXEL: Template does not match hardware'
              priority: INFO
              description: 'This template is for Zyxel IES-6000, but connected to {ITEM.VALUE}'
              tags:
                - tag: scope
                  value: notice
        - uuid: 2062eb7816e242668936c020e6e1d532
          name: 'Host name'
          type: SNMP_AGENT
          snmp_oid: 'get[1.3.6.1.2.1.1.5.0]'
          key: zyxel.ies6000.name
          delay: 1h
          value_type: CHAR
          description: |
            MIB: RFC1213-MIB
            An administratively-assigned name for this
            managed node.  By convention, this is the node's
            fully-qualified domain name.
          inventory_link: NAME
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
          tags:
            - tag: component
              value: inventory
        - uuid: e79a790f3ca54943997f1d0b3e74943d
          name: 'Uptime (network)'
          type: SNMP_AGENT
          snmp_oid: 'get[1.3.6.1.2.1.1.3.0]'
          key: zyxel.ies6000.net.uptime
          delay: 30s
          trends: '0'
          units: uptime
          description: |
            MIB: RFC1213-MIB
            The time (in hundredths of a second) since the
            network management portion of the system was last
            re-initialized.
          preprocessing:
            - type: MULTIPLIER
              parameters:
                - '0.01'
          tags:
            - tag: component
              value: system
      discovery_rules:
        - uuid: 6023c8a68b5547dcab838414cbf544ea
          name: 'Packet buffer discovery'
          type: SNMP_AGENT
          snmp_oid: 'discovery[{#ZYXEL.BUFFERHIGHTHRESH},1.3.6.1.4.1.890.1.5.13.5.11.3.5.1.4]'
          key: zyxel.ies6000.buffer.discovery
          delay: 1h
          description: 'A table that contains packet buffer usage information.'
          item_prototypes:
            - uuid: 5de9037f3a1444adbcf5bcfbe4618ad6
              name: 'Slot {#ZYXEL.SLOT.ID}: Packet buffer utilization'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.4.1.890.1.5.13.5.11.3.5.1.2.{#SNMPINDEX}]'
              key: 'zyxel.ies6000.buffer[{#SNMPINDEX}]'
              units: '%'
              description: |
                MIB: ZYXEL-IES5000-MIB
                The packet buffer usage in the past 60 seconds.
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              tags:
                - tag: component
                  value: system
              trigger_prototypes:
                - uuid: 1173ae0cf9f440f595366a6da7a4c672
                  expression: 'min(/ZYXEL IES-6000 by SNMP/zyxel.ies6000.buffer[{#SNMPINDEX}],5m)>{#ZYXEL.BUFFERHIGHTHRESH}'
                  name: 'ZYXEL: High Packet buffer utilization in Slot {#ZYXEL.SLOT.ID}'
                  event_name: 'ZYXEL: High Packet buffer utilization in Slot {#ZYXEL.SLOT.ID} (>{#ZYXEL.BUFFERHIGHTHRESH}% for 5m)'
                  priority: AVERAGE
                  description: 'The system is running out of free buffer.'
                  tags:
                    - tag: scope
                      value: performance
          graph_prototypes:
            - uuid: fcb46fd73a884e60b1ba3d4e8873bbce
              name: 'ZYXEL IES-6000: Slot {#ZYXEL.SLOT.ID}: Packet buffer utilization'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'ZYXEL IES-6000 by SNMP'
                    key: 'zyxel.ies6000.buffer[{#SNMPINDEX}]'
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  var inArray = JSON.parse(value);
                  var outArr = []
                  inArray.forEach(function (item, i, arr) {
                  	item['{#ZYXEL.SLOT.ID}'] = item['{#SNMPINDEX}'].split('.')[1];
                  	item['{#ZYXEL.SENSOR.ID}'] = item['{#SNMPINDEX}'].split('.')[2];
                  	outArr.push(item)
                  });
                  return JSON.stringify(outArr);
        - uuid: 1aace4fa8bdc49d28d8785aeadcdc8d4
          name: 'CPU discovery'
          type: SNMP_AGENT
          snmp_oid: 'discovery[{#ZYXEL.CPU.THRESH.HIGH},1.3.6.1.4.1.890.1.5.13.5.11.3.4.1.4]'
          key: zyxel.ies6000.cpu.discovery
          delay: 1h
          description: |
            A table that contains CPU utilization information.
            This table is supported by R1.03 and later versions.
          item_prototypes:
            - uuid: 209b18dabcaa4d6a8870864eec2fc898
              name: 'Slot {#ZYXEL.SLOT.ID}: CPU utilization'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.4.1.890.1.5.13.5.11.3.4.1.2.{#SNMPINDEX}]'
              key: 'zyxel.ies6000.cpu[{#SNMPINDEX}]'
              units: '%'
              description: |
                MIB: ZYXEL-IES5000-MIB
                The CPU utilization in the past 60 seconds.
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              tags:
                - tag: component
                  value: cpu
              trigger_prototypes:
                - uuid: 0d882e8f017e46c78727437bd55759d4
                  expression: 'min(/ZYXEL IES-6000 by SNMP/zyxel.ies6000.cpu[{#SNMPINDEX}],5m)>{#ZYXEL.CPU.THRESH.HIGH}'
                  name: 'ZYXEL: Slot {#ZYXEL.SLOT.ID} high CPU utilization'
                  event_name: 'ZYXEL: Slot {#ZYXEL.SLOT.ID} high CPU utilization (over {#ZYXEL.CPU.THRESH.HIGH}% for 5m)'
                  opdata: 'Current utilization: {ITEM.LASTVALUE1}'
                  priority: WARNING
                  description: 'The CPU utilization is too high. The system might be slow to respond.'
                  tags:
                    - tag: scope
                      value: performance
          graph_prototypes:
            - uuid: 6c3837433afe4a1cb64038c62743be15
              name: 'ZYXEL IES-6000: Slot {#ZYXEL.SLOT.ID}: CPU utilization'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'ZYXEL IES-6000 by SNMP'
                    key: 'zyxel.ies6000.cpu[{#SNMPINDEX}]'
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  var inArray = JSON.parse(value);
                  var outArr = []
                  inArray.forEach(function (item, i, arr) {
                  	item['{#ZYXEL.SLOT.ID}'] = item['{#SNMPINDEX}'].split('.')[1];
                  	item['{#ZYXEL.SENSOR.ID}'] = item['{#SNMPINDEX}'].split('.')[2];
                  	outArr.push(item)
                  });
                  return JSON.stringify(outArr);
        - uuid: abd64129536e4b43b5718adde7979c18
          name: 'Fan discovery'
          type: SNMP_AGENT
          snmp_oid: 'discovery[{#ZYXEL.FANRPM.THRESH.HIGH},1.3.6.1.4.1.890.1.5.13.5.11.3.1.1.7,{#ZYXEL.FANRPM.THRESH.LOW},1.3.6.1.4.1.890.1.5.13.5.11.3.1.1.5]'
          key: zyxel.ies6000.fan.discovery
          delay: 1h
          description: 'An entry in fanRpmTable.'
          item_prototypes:
            - uuid: cfb5021170ca4365a72e76fca74efd9c
              name: 'Fan #{#SNMPINDEX}'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.4.1.890.1.5.13.5.11.3.1.1.2.{#SNMPINDEX}]'
              key: 'zyxel.ies6000.fan[{#SNMPINDEX}]'
              units: '!rpm'
              description: |
                MIB: ZYXEL-IES5000-MIB
                Current speed in Revolutions Per Minute (RPM) on the fan.
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              tags:
                - tag: component
                  value: fan
                - tag: component
                  value: sensor
              trigger_prototypes:
                - uuid: d5f65aebabf741798dcd0b452302aefb
                  expression: 'last(/ZYXEL IES-6000 by SNMP/zyxel.ies6000.fan[{#SNMPINDEX}])<{#ZYXEL.FANRPM.THRESH.LOW} or last(/ZYXEL IES-6000 by SNMP/zyxel.ies6000.fan[{#SNMPINDEX}])>{#ZYXEL.FANRPM.THRESH.HIGH}'
                  name: 'ZYXEL: FAN{#SNMPINDEX} is in critical state'
                  opdata: 'Current state: {ITEM.LASTVALUE1}'
                  priority: AVERAGE
                  description: 'Please check the fan unit'
                  tags:
                    - tag: scope
                      value: notice
          graph_prototypes:
            - uuid: 48736da52a8947e6a69cef3a9980bfbb
              name: 'ZYXEL IES-6000: Fan #{#SNMPINDEX}'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'ZYXEL IES-6000 by SNMP'
                    key: 'zyxel.ies6000.fan[{#SNMPINDEX}]'
        - uuid: 691c50d10ae342e0b9825c9d72a4cff9
          name: 'Memory discovery'
          type: SNMP_AGENT
          snmp_oid: 'discovery[{#ZYXEL.MEMORYHIGHTHRESH},1.3.6.1.4.1.890.1.5.13.5.11.3.6.1.4]'
          key: zyxel.ies6000.memory.discovery
          delay: 1h
          description: 'A table that contains memory usage information.'
          item_prototypes:
            - uuid: 41168b2146274e8d8d93d49e89b0f018
              name: 'Slot {#ZYXEL.SLOT.ID}: Memory utilization'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.4.1.890.1.5.13.5.11.3.6.1.2.{#SNMPINDEX}]'
              key: 'zyxel.ies6000.memory[{#SNMPINDEX}]'
              units: '%'
              description: |
                MIB: ZYXEL-IES5000-MIB
                The memory usage in the past 60 seconds.
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              tags:
                - tag: component
                  value: memory
              trigger_prototypes:
                - uuid: 64108d56dc6d43148f67503383fc6705
                  expression: 'min(/ZYXEL IES-6000 by SNMP/zyxel.ies6000.memory[{#SNMPINDEX}],5m)>{#ZYXEL.MEMORYHIGHTHRESH}'
                  name: 'ZYXEL: High memory utilization in Slot {#ZYXEL.SLOT.ID} pool'
                  event_name: 'ZYXEL: High memory utilization in Slot {#ZYXEL.SLOT.ID} pool (>{#ZYXEL.MEMORYHIGHTHRESH}% for 5m)'
                  priority: AVERAGE
                  description: 'The system is running out of free memory.'
                  tags:
                    - tag: scope
                      value: performance
          graph_prototypes:
            - uuid: c85c2345f80448feb2253a10ec16778a
              name: 'ZYXEL IES-6000: Slot {#ZYXEL.SLOT.ID}: Memory utilization'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'ZYXEL IES-6000 by SNMP'
                    key: 'zyxel.ies6000.memory[{#SNMPINDEX}]'
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  var inArray = JSON.parse(value);
                  var outArr = []
                  inArray.forEach(function (item, i, arr) {
                  	item['{#ZYXEL.SLOT.ID}'] = item['{#SNMPINDEX}'].split('.')[1];
                  	item['{#ZYXEL.SENSOR.ID}'] = item['{#SNMPINDEX}'].split('.')[2];
                  	outArr.push(item)
                  });
                  return JSON.stringify(outArr);
        - uuid: cc124fe17126405f82fd61f248fe1abe
          name: 'ADSL interface discovery'
          type: SNMP_AGENT
          snmp_oid: 'discovery[{#ZYXEL.IF.NAME},1.3.6.1.2.1.31.1.1.1.1,{#ZYXEL.IF.LINKSTATUS},1.3.6.1.2.1.2.2.1.8,{#ZYXEL.IF.DESC},1.3.6.1.2.1.31.1.1.1.18]'
          key: zyxel.ies6000.net.adsl.discovery
          delay: 1h
          filter:
            evaltype: AND
            conditions:
              - macro: '{#ZYXEL.IF.DESC}'
                value: '{$ZYXEL.LLD.FILTER.IF.DESC.MATCHES}'
              - macro: '{#ZYXEL.IF.DESC}'
                value: '{$ZYXEL.LLD.FILTER.IF.DESC.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
              - macro: '{#ZYXEL.IF.LINKSTATUS}'
                value: '{$ZYXEL.LLD.FILTER.IF.LINKSTATUS.MATCHES}'
              - macro: '{#ZYXEL.IF.LINKSTATUS}'
                value: '{$ZYXEL.LLD.FILTER.IF.LINKSTATUS.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
              - macro: '{#ZYXEL.IF.NAME}'
                value: adsl
          item_prototypes:
            - uuid: d8a6e995233245cd8ac684232add71f0
              name: 'Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID}: Administrative status'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.2.2.1.7.{#SNMPINDEX}]'
              key: 'zyxel.ies6000.net.adsl.adminstatus[{#SNMPINDEX}]'
              description: |
                MIB: IF-MIB
                The desired state of the interface.  The
                testing(3) state indicates that no operational
                packets can be passed.
              valuemap:
                name: 'ZYXEL IES-6000 port admin status'
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: dfd46b4bf39140b391bb2a8ab21db668
              name: 'Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID}: ATUC attenuation'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.10.94.1.1.2.1.5.{#SNMPINDEX}]'
              key: 'zyxel.ies6000.net.adsl.atuc.atn[{#SNMPINDEX}]'
              value_type: FLOAT
              units: dB
              description: |
                MIB: ADSL-LINE-MIB
                Measured difference in the total power transmitted by
                the peer ATU and the total power received by this ATU.
                The Info Atuc fields show data acquired from the ATUC (ADSL Termination Unit - Central), in this case ZYXEL IES-6000, during negotiation/provisioning message interchanges.
              preprocessing:
                - type: MULTIPLIER
                  parameters:
                    - '0.1'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
              trigger_prototypes:
                - uuid: e1233b29eb764b0bb5a2ce35f79060bf
                  expression: 'min(/ZYXEL IES-6000 by SNMP/zyxel.ies6000.net.adsl.atuc.atn[{#SNMPINDEX}],5m)>{$ZYXEL.ADSL.ATN.MAX}'
                  name: 'ZYXEL: High the DSL line attenuation in Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID}'
                  event_name: 'ZYXEL: High the DSL line attenuation in Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID} (>{$ZYXEL.ADSL.ATN.MAX}dB for 5m)'
                  priority: WARNING
                  description: 'The reductions in amplitude of the downstream and upstream DSL signals.'
                  tags:
                    - tag: scope
                      value: capacity
            - uuid: 0b77f799291548de84478dff54742afe
              name: 'Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID}: ATUC output power'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.10.94.1.1.2.1.7.{#SNMPINDEX}]'
              key: 'zyxel.ies6000.net.adsl.atuc.outpwr[{#SNMPINDEX}]'
              value_type: FLOAT
              units: dB
              description: |
                MIB: ADSL-LINE-MIB
                Measured total output power transmitted by this ATU.
                The Info Atuc fields show data acquired from the ATUC (ADSL Termination Unit - Central), in this case ZYXEL IES-6000, during negotiation/provisioning message interchanges.
              preprocessing:
                - type: MULTIPLIER
                  parameters:
                    - '0.1'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: 292d33986274498b819ab0b6b3ac3c21
              name: 'Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID}: ATUC noise margin'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.10.94.1.1.2.1.4.{#SNMPINDEX}]'
              key: 'zyxel.ies6000.net.adsl.atuc.snrmgn[{#SNMPINDEX}]'
              value_type: FLOAT
              units: dB
              description: |
                MIB: ADSL-LINE-MIB
                Noise Margin as seen by this ATU with respect to its
                received signal in tenth dB.
                The Info Atuc fields show data acquired from the ATUC (ADSL Termination Unit - Central), in this case ZYXEL IES-6000, during negotiation/provisioning message interchanges.
              preprocessing:
                - type: MULTIPLIER
                  parameters:
                    - '0.1'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
              trigger_prototypes:
                - uuid: d7392fd0c372459bb21b9a85a47ccb8c
                  expression: 'min(/ZYXEL IES-6000 by SNMP/zyxel.ies6000.net.adsl.atuc.snrmgn[{#SNMPINDEX}],5m)<{$ZYXEL.ADSL.SNR.MIN}'
                  name: 'ZYXEL: Low the DSL line noise margins in Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID}'
                  event_name: 'ZYXEL: Low the DSL line noise margins in Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID} (<{$ZYXEL.ADSL.SNR.MIN}dB for 5m)'
                  priority: WARNING
                  description: 'Signal-to-noise margin (SNR Margin) which is the difference between the actual SNR and the SNR required to sync at a specific speed'
                  tags:
                    - tag: scope
                      value: capacity
            - uuid: f6d71feb40954a88a2fa5ebe35af25cb
              name: 'Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID}: ATUR attenuation'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.10.94.1.1.3.1.5.{#SNMPINDEX}]'
              key: 'zyxel.ies6000.net.adsl.atur.atn[{#SNMPINDEX}]'
              value_type: FLOAT
              units: dB
              description: |
                MIB: ADSL-LINE-MIB
                Measured difference in the total power transmitted by
                the peer ATU and the total power received by this ATU.
                The Info Atur fields show data acquired from the ATUR (ADSL Termination Unit - Remote), in this case the subscriber's ADSL modem or router, during negotiation/provisioning message interchanges.
              preprocessing:
                - type: MULTIPLIER
                  parameters:
                    - '0.1'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
              trigger_prototypes:
                - uuid: 2ef5b800bb4148ce82bed8c4bf977a35
                  expression: 'min(/ZYXEL IES-6000 by SNMP/zyxel.ies6000.net.adsl.atur.atn[{#SNMPINDEX}],5m)>{$ZYXEL.ADSL.ATN.MAX}'
                  name: 'ZYXEL: High the DSL line attenuation in Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID}'
                  event_name: 'ZYXEL: High the DSL line attenuation in Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID} (>{$ZYXEL.ADSL.ATN.MAX}dB for 5m)'
                  priority: WARNING
                  description: 'The reductions in amplitude of the downstream and upstream DSL signals.'
                  tags:
                    - tag: scope
                      value: capacity
            - uuid: c4d523e2ef9c4d7d901383e19876af80
              name: 'Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID}: ATUR output power'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.10.94.1.1.3.1.7.{#SNMPINDEX}]'
              key: 'zyxel.ies6000.net.adsl.atur.outpwr[{#SNMPINDEX}]'
              value_type: FLOAT
              units: dB
              description: |
                MIB: ADSL-LINE-MIB
                Measured total output power transmitted by this ATU.
                The Info Atur fields show data acquired from the ATUR (ADSL Termination Unit - Remote), in this case the subscriber's ADSL modem or router, during negotiation/provisioning message interchanges.
              preprocessing:
                - type: MULTIPLIER
                  parameters:
                    - '0.1'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: ad834d61ca834dd987784180211320f7
              name: 'Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID}: ATUR noise margin'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.10.94.1.1.3.1.4.{#SNMPINDEX}]'
              key: 'zyxel.ies6000.net.adsl.atur.snrmgn[{#SNMPINDEX}]'
              value_type: FLOAT
              units: dB
              description: |
                MIB: ADSL-LINE-MIB
                Noise Margin as seen by this ATU with respect to its
                received signal in tenth dB.
                The Info Atur fields show data acquired from the ATUR (ADSL Termination Unit - Remote), in this case the subscriber's ADSL modem or router, during negotiation/provisioning message interchanges.
              preprocessing:
                - type: MULTIPLIER
                  parameters:
                    - '0.1'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
              trigger_prototypes:
                - uuid: ba6eb4b3b6904b5dac4c057d3f6f3c17
                  expression: 'min(/ZYXEL IES-6000 by SNMP/zyxel.ies6000.net.adsl.atur.snrmgn[{#SNMPINDEX}],5m)<{$ZYXEL.ADSL.SNR.MIN}'
                  name: 'ZYXEL: Low the DSL line noise margins in Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID}'
                  event_name: 'ZYXEL: Low the DSL line noise margins in Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID} (<{$ZYXEL.ADSL.SNR.MIN}dB for 5m)'
                  priority: WARNING
                  description: 'Signal-to-noise margin (SNR Margin) which is the difference between the actual SNR and the SNR required to sync at a specific speed'
                  tags:
                    - tag: scope
                      value: capacity
            - uuid: 2349bae6bb864a4f8c6c8d9b0087503f
              name: 'Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID}: Interface description'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.31.1.1.1.18.{#SNMPINDEX}]'
              key: 'zyxel.ies6000.net.adsl.descr[{#SNMPINDEX}]'
              value_type: CHAR
              description: |
                MIB: IF-MIB
                A textual string containing information about the interface
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: fd6e0cff15834d9ea5d5f5f570608abb
              name: 'Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID}: Incoming broadcast packages'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.31.1.1.1.9.{#SNMPINDEX}]'
              key: 'zyxel.ies6000.net.adsl.in.broadcastpkts[{#SNMPINDEX}]'
              units: packets/s
              description: |
                MIB: IF-MIB
                The number of packets, delivered by this sub-layer to a
                higher (sub-)layer, which were addressed to a broadcast
                address at this sub-layer.
              preprocessing:
                - type: CHANGE_PER_SECOND
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: eff728cc8d824bb98a840e07c0c370ed
              name: 'Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID}: Incoming multicast packages'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.31.1.1.1.8.{#SNMPINDEX}]'
              key: 'zyxel.ies6000.net.adsl.in.multicastpkts[{#SNMPINDEX}]'
              units: packets/s
              description: |
                MIB: IF-MIB
                The number of packets, delivered by this sub-layer to a
                higher (sub-)layer, which were addressed to a multicast
                address at this sub-layer.  For a MAC layer protocol, this
                includes both Group and Functional addresses.
              preprocessing:
                - type: CHANGE_PER_SECOND
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: f689c73f2aae4b4aa1688c584c88a562
              name: 'Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID}: Incoming traffic'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.31.1.1.1.6.{#SNMPINDEX}]'
              key: 'zyxel.ies6000.net.adsl.in.traffic[{#SNMPINDEX}]'
              units: bps
              description: |
                MIB: IF-MIB
                The total number of octets received on the interface,
                including framing characters.
              preprocessing:
                - type: MULTIPLIER
                  parameters:
                    - '8'
                - type: CHANGE_PER_SECOND
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: 26a0ded897e745208787710bca306658
              name: 'Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID}: Incoming unicast packages'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.31.1.1.1.7.{#SNMPINDEX}]'
              key: 'zyxel.ies6000.net.adsl.in.ucastpkts[{#SNMPINDEX}]'
              units: packets/s
              description: |
                MIB: IF-MIB
                The number of packets, delivered by this sub-layer to a
                higher (sub-)layer, which were not addressed to a multicast
                or broadcast address at this sub-layer
              preprocessing:
                - type: CHANGE_PER_SECOND
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: 8d0583741866478cb77f21e4e8e982ec
              name: 'Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID}: Interface name'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.31.1.1.1.1.{#SNMPINDEX}]'
              key: 'zyxel.ies6000.net.adsl.name[{#SNMPINDEX}]'
              value_type: CHAR
              description: |
                MIB: IF-MIB
                A textual string containing information about the interface
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: ba66aeea219840929dfbc7b8cb61b2ab
              name: 'Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID}: Operational status'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.2.2.1.8.{#SNMPINDEX}]'
              key: 'zyxel.ies6000.net.adsl.operstatus[{#SNMPINDEX}]'
              description: |
                MIB: IF-MIB
                The current operational state of the interface.
                The testing(3) state indicates that no operational
                packets can be passed.
              valuemap:
                name: 'ZYXEL IES-6000 port operational status'
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
              trigger_prototypes:
                - uuid: 3fbe4b16a94648089df78829ee7e683f
                  expression: 'last(/ZYXEL IES-6000 by SNMP/zyxel.ies6000.net.adsl.operstatus[{#SNMPINDEX}])=2 and last(/ZYXEL IES-6000 by SNMP/zyxel.ies6000.net.adsl.operstatus[{#SNMPINDEX}],#1)<>last(/ZYXEL IES-6000 by SNMP/zyxel.ies6000.net.adsl.operstatus[{#SNMPINDEX}],#2)'
                  recovery_mode: RECOVERY_EXPRESSION
                  recovery_expression: 'last(/ZYXEL IES-6000 by SNMP/zyxel.ies6000.net.adsl.operstatus[{#SNMPINDEX}])<>2'
                  name: 'ZYXEL: Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID}: Link down'
                  opdata: 'Current state: {ITEM.LASTVALUE1}'
                  priority: AVERAGE
                  description: |
                    This trigger expression works as follows:
                    1. It can be triggered if the operations status is down.
                    2. `{$IFCONTROL:"{#IFNAME}"}=1` - a user can redefine context macro to value - 0. That marks this interface as not important. No new trigger will be fired if this interface is down.
                    3. `{TEMPLATE_NAME:METRIC.diff()}=1` - the trigger fires only if the operational status was up to (1) sometime before (so, do not fire for the 'eternal off' interfaces.)
                    
                    WARNING: if closed manually - it will not fire again on the next poll, because of .diff.
                  manual_close: 'YES'
                  tags:
                    - tag: scope
                      value: notice
            - uuid: d4911b93b2084ca5b4e1c5a91bbb50af
              name: 'Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID}: Outgoing broadcast packages'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.31.1.1.1.13.{#SNMPINDEX}]'
              key: 'zyxel.ies6000.net.adsl.out.broadcastpkts[{#SNMPINDEX}]'
              units: packets/s
              description: |
                MIB: IF-MIB
                The total number of packets that higher-level protocols
                requested be transmitted, and which were addressed to a
                broadcast address at this sub-layer, including those that
                were discarded or not sent.
              preprocessing:
                - type: CHANGE_PER_SECOND
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: d2d5d679e4974b3099111cb79506cbab
              name: 'Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID}: Outgoing multicast packages'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.31.1.1.1.12.{#SNMPINDEX}]'
              key: 'zyxel.ies6000.net.adsl.out.multicastpkts[{#SNMPINDEX}]'
              units: packets/s
              description: |
                MIB: IF-MIB
                The total number of packets that higher-level protocols
                requested be transmitted, and which were addressed to a
                multicast address at this sub-layer, including those that
                were discarded or not sent.  For a MAC layer protocol, this
                includes both Group and Functional addresses.
              preprocessing:
                - type: CHANGE_PER_SECOND
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: 982554d0208a422d94b53a55ca566239
              name: 'Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID}: Outgoing traffic'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.31.1.1.1.10.{#SNMPINDEX}]'
              key: 'zyxel.ies6000.net.adsl.out.traffic[{#SNMPINDEX}]'
              units: bps
              description: |
                MIB: IF-MIB
                The total number of octets transmitted out of the
                interface, including framing characters.  This object is a
                64-bit version of ifOutOctets.
              preprocessing:
                - type: MULTIPLIER
                  parameters:
                    - '8'
                - type: CHANGE_PER_SECOND
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: 49c3f935e21248b69ea351e1210cc62d
              name: 'Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID}: Outgoing unicast packages'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.31.1.1.1.11.{#SNMPINDEX}]'
              key: 'zyxel.ies6000.net.adsl.out.ucastpkts[{#SNMPINDEX}]'
              units: packets/s
              description: |
                MIB: IF-MIB
                The total number of packets that higher-level protocols
                requested be transmitted, and which were not addressed to a
                multicast or broadcast address at this sub-layer, including
                those that were discarded or not sent.
              preprocessing:
                - type: CHANGE_PER_SECOND
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
          graph_prototypes:
            - uuid: e8a72d0fe2d745ffbffae11b379297e4
              name: 'ZYXEL IES-6000: Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID}: Packets traffic'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'ZYXEL IES-6000 by SNMP'
                    key: 'zyxel.ies6000.net.adsl.in.ucastpkts[{#SNMPINDEX}]'
                - sortorder: '1'
                  color: F63100
                  item:
                    host: 'ZYXEL IES-6000 by SNMP'
                    key: 'zyxel.ies6000.net.adsl.out.ucastpkts[{#SNMPINDEX}]'
                - sortorder: '2'
                  color: 00611C
                  item:
                    host: 'ZYXEL IES-6000 by SNMP'
                    key: 'zyxel.ies6000.net.adsl.in.multicastpkts[{#SNMPINDEX}]'
                - sortorder: '3'
                  color: F7941D
                  item:
                    host: 'ZYXEL IES-6000 by SNMP'
                    key: 'zyxel.ies6000.net.adsl.out.multicastpkts[{#SNMPINDEX}]'
                - sortorder: '4'
                  color: FC6EA3
                  item:
                    host: 'ZYXEL IES-6000 by SNMP'
                    key: 'zyxel.ies6000.net.adsl.in.broadcastpkts[{#SNMPINDEX}]'
                - sortorder: '5'
                  color: 6C59DC
                  item:
                    host: 'ZYXEL IES-6000 by SNMP'
                    key: 'zyxel.ies6000.net.adsl.out.broadcastpkts[{#SNMPINDEX}]'
            - uuid: 60c44917db2045c19efd64718a9f37cf
              name: 'ZYXEL IES-6000: Slot {#ZYXEL.SLOT.ID} Port {#ZYXEL.PORTID}: Traffic'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'ZYXEL IES-6000 by SNMP'
                    key: 'zyxel.ies6000.net.adsl.in.traffic[{#SNMPINDEX}]'
                - sortorder: '1'
                  color: F63100
                  item:
                    host: 'ZYXEL IES-6000 by SNMP'
                    key: 'zyxel.ies6000.net.adsl.out.traffic[{#SNMPINDEX}]'
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  var inArray = JSON.parse(value);
                  var outArr = []
                  inArray.forEach(function (item, i, arr) {
                  	item['{#ZYXEL.SLOT.ID}'] = Math.floor(item['{#SNMPINDEX}'] / 100);
                  	item['{#ZYXEL.PORTID}'] = item['{#SNMPINDEX}'] % 100;
                  	outArr.push(item)
                  });
                  return JSON.stringify(outArr);
          overrides:
            - name: 'Don''t create triggers for matching interface'
              step: '1'
              filter:
                conditions:
                  - macro: '{#ZYXEL.IF.NAME}'
                    value: '{$ZYXEL.LLD.FILTER.IF.CONTROL.MATCHES}'
                    operator: NOT_MATCHES_REGEX
              operations:
                - operationobject: TRIGGER_PROTOTYPE
                  operator: REGEXP
                  value: '.*'
                  discover: NO_DISCOVER
        - uuid: 8f9073a53cee4e6fb8c36feda5185900
          name: 'Ethernet interface discovery'
          type: SNMP_AGENT
          snmp_oid: 'discovery[{#ZYXEL.IF.NAME},1.3.6.1.2.1.31.1.1.1.1,{#ZYXEL.IF.LINKSTATUS},1.3.6.1.2.1.2.2.1.8,{#ZYXEL.IF.DESC},1.3.6.1.2.1.31.1.1.1.18]'
          key: zyxel.ies6000.net.if.discovery
          delay: 1h
          filter:
            evaltype: AND
            conditions:
              - macro: '{#ZYXEL.IF.DESC}'
                value: '{$ZYXEL.LLD.FILTER.IF.DESC.MATCHES}'
              - macro: '{#ZYXEL.IF.DESC}'
                value: '{$ZYXEL.LLD.FILTER.IF.DESC.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
              - macro: '{#ZYXEL.IF.LINKSTATUS}'
                value: '{$ZYXEL.LLD.FILTER.IF.LINKSTATUS.MATCHES}'
              - macro: '{#ZYXEL.IF.LINKSTATUS}'
                value: '{$ZYXEL.LLD.FILTER.IF.LINKSTATUS.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
              - macro: '{#ZYXEL.IF.NAME}'
                value: enet
          item_prototypes:
            - uuid: c96f6a48c03f4a92a5a75a6e6d603079
              name: 'Port {#SNMPINDEX}: Administrative status'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.2.2.1.7.{#SNMPINDEX}]'
              key: 'zyxel.ies6000.net.if.adminstatus[{#SNMPINDEX}]'
              description: |
                MIB: IF-MIB
                The desired state of the interface.  The
                testing(3) state indicates that no operational
                packets can be passed.
              valuemap:
                name: 'ZYXEL IES-6000 port admin status'
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: a70d2041768945a6906ab0cbe0f518ae
              name: 'Port {#SNMPINDEX}: Interface description'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.31.1.1.1.18.{#SNMPINDEX}]'
              key: 'zyxel.ies6000.net.if.descr[{#SNMPINDEX}]'
              value_type: CHAR
              description: |
                MIB: IF-MIB
                A textual string containing information about the interface
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: cee8836a0e00466fbe72a5de85007a49
              name: 'Port {#SNMPINDEX}: Link speed'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.31.1.1.1.15.{#SNMPINDEX}]'
              key: 'zyxel.ies6000.net.if.highspeed[{#SNMPINDEX}]'
              units: bps
              description: |
                MIB: IF-MIB
                An estimate of the interface's current bandwidth in bits per second
              preprocessing:
                - type: MULTIPLIER
                  parameters:
                    - '1000000'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: a37e15f8480e47bf8b8f542e65df0a80
              name: 'Port {#SNMPINDEX}: Incoming broadcast packages'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.31.1.1.1.9.{#SNMPINDEX}]'
              key: 'zyxel.ies6000.net.if.in.broadcastpkts[{#SNMPINDEX}]'
              units: packets/s
              description: |
                MIB: IF-MIB
                The number of packets, delivered by this sub-layer to a
                higher (sub-)layer, which were addressed to a broadcast
                address at this sub-layer.
              preprocessing:
                - type: CHANGE_PER_SECOND
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: c3c7164096c845b599267186f66aa8ee
              name: 'Port {#SNMPINDEX}: Incoming multicast packages'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.31.1.1.1.8.{#SNMPINDEX}]'
              key: 'zyxel.ies6000.net.if.in.multicastpkts[{#SNMPINDEX}]'
              units: packets/s
              description: |
                MIB: IF-MIB
                The number of packets, delivered by this sub-layer to a
                higher (sub-)layer, which were addressed to a multicast
                address at this sub-layer.  For a MAC layer protocol, this
                includes both Group and Functional addresses.
              preprocessing:
                - type: CHANGE_PER_SECOND
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: 03aeeb2bb9c9454ebd91714fff1eb713
              name: 'Port {#SNMPINDEX}: Incoming traffic'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.31.1.1.1.6.{#SNMPINDEX}]'
              key: 'zyxel.ies6000.net.if.in.traffic[{#SNMPINDEX}]'
              units: bps
              description: |
                MIB: IF-MIB
                The total number of octets received on the interface,
                including framing characters.
              preprocessing:
                - type: MULTIPLIER
                  parameters:
                    - '8'
                - type: CHANGE_PER_SECOND
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: c2b9296b58bf4617b86348c82f88b1c2
              name: 'Port {#SNMPINDEX}: Incoming unicast packages'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.31.1.1.1.7.{#SNMPINDEX}]'
              key: 'zyxel.ies6000.net.if.in.ucastpkts[{#SNMPINDEX}]'
              units: packets/s
              description: |
                MIB: IF-MIB
                The number of packets, delivered by this sub-layer to a
                higher (sub-)layer, which were not addressed to a multicast
                or broadcast address at this sub-layer
              preprocessing:
                - type: CHANGE_PER_SECOND
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: 2dc6ed1aacb84706bccd26c9c4e1e944
              name: 'Port {#SNMPINDEX}: Incoming utilization'
              type: CALCULATED
              key: 'zyxel.ies6000.net.if.in.util[{#SNMPINDEX}]'
              value_type: FLOAT
              units: '%'
              params: 'last(//zyxel.ies6000.net.if.in.traffic[{#SNMPINDEX}]) * (last(//zyxel.ies6000.net.if.highspeed[{#SNMPINDEX}]) <> 0) /( last(//zyxel.ies6000.net.if.highspeed[{#SNMPINDEX}]) + (last(//zyxel.ies6000.net.if.highspeed[{#SNMPINDEX}]) = 0) ) * 100'
              description: 'Interface utilization percentage'
              preprocessing:
                - type: IN_RANGE
                  parameters:
                    - '0'
                    - '100'
                  error_handler: DISCARD_VALUE
                - type: JAVASCRIPT
                  parameters:
                    - 'return +parseFloat(value).toFixed(0);'
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: c4a8c8d0b51d496cbae4089ffee1e531
              name: 'Port {#SNMPINDEX}: Interface name'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.31.1.1.1.1.{#SNMPINDEX}]'
              key: 'zyxel.ies6000.net.if.name[{#SNMPINDEX}]'
              value_type: CHAR
              description: |
                MIB: IF-MIB
                A textual string containing information about the interface
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: 00c015d42840420c9878ef84177c8d42
              name: 'Port {#SNMPINDEX}: Operational status'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.2.2.1.8.{#SNMPINDEX}]'
              key: 'zyxel.ies6000.net.if.operstatus[{#SNMPINDEX}]'
              description: |
                MIB: IF-MIB
                The current operational state of the interface.
                The testing(3) state indicates that no operational
                packets can be passed.
              valuemap:
                name: 'ZYXEL IES-6000 port operational status'
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
              trigger_prototypes:
                - uuid: a9aac7e6c66a4a69a77f8c165f9a9d5c
                  expression: 'last(/ZYXEL IES-6000 by SNMP/zyxel.ies6000.net.if.operstatus[{#SNMPINDEX}])=2 and (last(/ZYXEL IES-6000 by SNMP/zyxel.ies6000.net.if.operstatus[{#SNMPINDEX}],#1)<>last(/ZYXEL IES-6000 by SNMP/zyxel.ies6000.net.if.operstatus[{#SNMPINDEX}],#2))=1'
                  recovery_mode: RECOVERY_EXPRESSION
                  recovery_expression: 'last(/ZYXEL IES-6000 by SNMP/zyxel.ies6000.net.if.operstatus[{#SNMPINDEX}])<>2'
                  name: 'ZYXEL: Port {#SNMPINDEX}: Link down'
                  opdata: 'Current state: {ITEM.LASTVALUE1}'
                  priority: AVERAGE
                  description: |
                    This trigger expression works as follows:
                    1. It can be triggered if the operations status is down.
                    2. `{$IFCONTROL:"{#IFNAME}"}=1` - a user can redefine context macro to value - 0. That marks this interface as not important. No new trigger will be fired if this interface is down.
                    3. `{TEMPLATE_NAME:METRIC.diff()}=1` - the trigger fires only if the operational status was up to (1) sometime before (so, do not fire for the 'eternal off' interfaces.)
                    
                    WARNING: if closed manually - it will not fire again on the next poll, because of .diff.
                  manual_close: 'YES'
                  tags:
                    - tag: scope
                      value: notice
            - uuid: ff5b7d95366d47c68589c65b4b0dcb15
              name: 'Port {#SNMPINDEX}: Outgoing broadcast packages'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.31.1.1.1.13.{#SNMPINDEX}]'
              key: 'zyxel.ies6000.net.if.out.broadcastpkts[{#SNMPINDEX}]'
              units: packets/s
              description: |
                MIB: IF-MIB
                The total number of packets that higher-level protocols
                requested be transmitted, and which were addressed to a
                broadcast address at this sub-layer, including those that
                were discarded or not sent.
              preprocessing:
                - type: CHANGE_PER_SECOND
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: e88787c50f654d5295d03b55d94810bf
              name: 'Port {#SNMPINDEX}: Outgoing multicast packages'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.31.1.1.1.12.{#SNMPINDEX}]'
              key: 'zyxel.ies6000.net.if.out.multicastpkts[{#SNMPINDEX}]'
              units: packets/s
              description: |
                MIB: IF-MIB
                The total number of packets that higher-level protocols
                requested be transmitted, and which were addressed to a
                multicast address at this sub-layer, including those that
                were discarded or not sent.  For a MAC layer protocol, this
                includes both Group and Functional addresses.
              preprocessing:
                - type: CHANGE_PER_SECOND
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: ac2959db86d44152b4a87294ee817dd7
              name: 'Port {#SNMPINDEX}: Outgoing traffic'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.31.1.1.1.10.{#SNMPINDEX}]'
              key: 'zyxel.ies6000.net.if.out.traffic[{#SNMPINDEX}]'
              units: bps
              description: |
                MIB: IF-MIB
                The total number of octets transmitted out of the
                interface, including framing characters.  This object is a
                64-bit version of ifOutOctets.
              preprocessing:
                - type: MULTIPLIER
                  parameters:
                    - '8'
                - type: CHANGE_PER_SECOND
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: c11fc8f0eacc42e5a6ca2443bdca60ce
              name: 'Port {#SNMPINDEX}: Outgoing unicast packages'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.31.1.1.1.11.{#SNMPINDEX}]'
              key: 'zyxel.ies6000.net.if.out.ucastpkts[{#SNMPINDEX}]'
              units: packets/s
              description: |
                MIB: IF-MIB
                The total number of packets that higher-level protocols
                requested be transmitted, and which were not addressed to a
                multicast or broadcast address at this sub-layer, including
                those that were discarded or not sent.
              preprocessing:
                - type: CHANGE_PER_SECOND
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: 6ef41c7cc0074674b43d583a8fa36868
              name: 'Port {#SNMPINDEX}: Outgoing utilization'
              type: CALCULATED
              key: 'zyxel.ies6000.net.if.out.util[{#SNMPINDEX}]'
              value_type: FLOAT
              units: '%'
              params: 'last(//zyxel.ies6000.net.if.out.traffic[{#SNMPINDEX}]) * (last(//zyxel.ies6000.net.if.highspeed[{#SNMPINDEX}]) <> 0) /( last(//zyxel.ies6000.net.if.highspeed[{#SNMPINDEX}]) + (last(//zyxel.ies6000.net.if.highspeed[{#SNMPINDEX}]) = 0) ) * 100'
              description: 'Interface utilization percentage'
              preprocessing:
                - type: IN_RANGE
                  parameters:
                    - '0'
                    - '100'
                  error_handler: DISCARD_VALUE
                - type: JAVASCRIPT
                  parameters:
                    - 'return +parseFloat(value).toFixed(0);'
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
          graph_prototypes:
            - uuid: 006679b6dfd64b65ad13de41be74783d
              name: 'ZYXEL IES-6000: Port {#SNMPINDEX}: Packets traffic'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'ZYXEL IES-6000 by SNMP'
                    key: 'zyxel.ies6000.net.if.in.ucastpkts[{#SNMPINDEX}]'
                - sortorder: '1'
                  color: F63100
                  item:
                    host: 'ZYXEL IES-6000 by SNMP'
                    key: 'zyxel.ies6000.net.if.out.ucastpkts[{#SNMPINDEX}]'
                - sortorder: '2'
                  color: 00611C
                  item:
                    host: 'ZYXEL IES-6000 by SNMP'
                    key: 'zyxel.ies6000.net.if.in.multicastpkts[{#SNMPINDEX}]'
                - sortorder: '3'
                  color: F7941D
                  item:
                    host: 'ZYXEL IES-6000 by SNMP'
                    key: 'zyxel.ies6000.net.if.out.multicastpkts[{#SNMPINDEX}]'
                - sortorder: '4'
                  color: FC6EA3
                  item:
                    host: 'ZYXEL IES-6000 by SNMP'
                    key: 'zyxel.ies6000.net.if.in.broadcastpkts[{#SNMPINDEX}]'
                - sortorder: '5'
                  color: 6C59DC
                  item:
                    host: 'ZYXEL IES-6000 by SNMP'
                    key: 'zyxel.ies6000.net.if.out.broadcastpkts[{#SNMPINDEX}]'
            - uuid: 6c545945185743b2929edf1b81fe0872
              name: 'ZYXEL IES-6000: Port {#SNMPINDEX}: Traffic'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'ZYXEL IES-6000 by SNMP'
                    key: 'zyxel.ies6000.net.if.in.traffic[{#SNMPINDEX}]'
                - sortorder: '1'
                  color: F63100
                  item:
                    host: 'ZYXEL IES-6000 by SNMP'
                    key: 'zyxel.ies6000.net.if.out.traffic[{#SNMPINDEX}]'
            - uuid: b7085154d7694b9aba49b56bc412d458
              name: 'ZYXEL IES-6000: Port {#SNMPINDEX}: Utilization'
              ymin_type_1: FIXED
              ymax_type_1: FIXED
              graph_items:
                - color: 199C0D
                  item:
                    host: 'ZYXEL IES-6000 by SNMP'
                    key: 'zyxel.ies6000.net.if.out.util[{#SNMPINDEX}]'
                - sortorder: '1'
                  color: F63100
                  item:
                    host: 'ZYXEL IES-6000 by SNMP'
                    key: 'zyxel.ies6000.net.if.in.util[{#SNMPINDEX}]'
          overrides:
            - name: 'Don''t create triggers for matching interface'
              step: '1'
              filter:
                conditions:
                  - macro: '{#ZYXEL.IF.NAME}'
                    value: '{$ZYXEL.LLD.FILTER.IF.CONTROL.MATCHES}'
                    operator: NOT_MATCHES_REGEX
              operations:
                - operationobject: TRIGGER_PROTOTYPE
                  operator: REGEXP
                  value: '.*'
                  discover: NO_DISCOVER
        - uuid: 10a176c3da924a95939cd35c0d0be862
          name: 'Slot discovery'
          type: SNMP_AGENT
          snmp_oid: 'discovery[{#ZYXEL.SLOTSTATUS},1.3.6.1.4.1.890.1.5.13.5.6.3.1.7,{#ZYXEL.SLOT.ID},1.3.6.1.4.1.890.1.5.13.5.6.3.1.1]'
          key: zyxel.ies6000.slot.discovery
          delay: 1h
          filter:
            evaltype: AND
            conditions:
              - macro: '{#ZYXEL.SLOTSTATUS}'
                value: '{$ZYXEL.LLD.FILTER.SLOT.STATUS.MATCHES}'
              - macro: '{#ZYXEL.SLOTSTATUS}'
                value: '{$ZYXEL.LLD.FILTER.SLOT.STATUS.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          description: 'The table which contains the slot information in a chassis.'
          item_prototypes:
            - uuid: 7be6d40418f94284902c742fef1ada43
              name: 'Slot {#ZYXEL.SLOT.ID}: Alarm status'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.4.1.890.1.5.13.5.6.3.1.8.{#SNMPINDEX}]'
              key: 'zyxel.ies6000.slot.alarm[{#SNMPINDEX}]'
              value_type: CHAR
              description: |
                MIB: ZYXEL-IES5000-MIB
                This variable indicates the alarm status of the module.
                It is a bit map represented a sum, therefore, it can represent
                multiple defects simultaneously. The moduleNoDefect should be set
                if and only if no other flag is set.
                The various bit positions are:
                1   moduleNoDefect
                2   moduleOverHeat
                3   moduleFanRpmLow
                4   moduleVoltageLow
                5   moduleThermalSensorFailure
                6   modulePullOut
                7   powerDC48VAFailure
                8   powerDC48VBFailure
                9   extAlarmInputTrigger
                10   moduleDown
                11   mscSwitchOverOK
                12   networkTopologyChange
                13   macSpoof
                14   cpuHigh
                15   memoryUsageHigh
                16   packetBufferUsageHigh
                17   loopguardOccurence
              preprocessing:
                - type: JAVASCRIPT
                  parameters:
                    - |
                      var valueArray = [
                      	'moduleNoDefect',
                      	'moduleOverHeat',
                      	'moduleFanRpmLow',
                      	'moduleVoltageLow',
                      	'moduleThermalSensorFailure',
                      	'modulePullOut',
                      	'powerDC48VAFailure',
                      	'powerDC48VBFailure',
                      	'extAlarmInputTrigger',
                      	'moduleDown',
                      	'mscSwitchOverOK',
                      	'networkTopologyChange',
                      	'macSpoof',
                      	'cpuHigh',
                      	'memoryUsageHigh',
                      	'packetBufferUsageHigh',
                      	'loopguardOccurence'
                      ];
                      var base2 = parseInt(value).toString(2);
                      var outArray = [];
                      for (var i = 0; i < base2.length; ++i) {
                      	if (base2[base2.length - 1 - i] === '1') outArray.push(valueArray[i]);
                      }
                      return outArray.join();
              tags:
                - tag: component
                  value: line-card
                - tag: interface
                  value: 'slot-{#ZYXEL.SLOT.ID}'
              trigger_prototypes:
                - uuid: c3f610ab856e42c7bb6460f552779e12
                  expression: 'find(/ZYXEL IES-6000 by SNMP/zyxel.ies6000.slot.alarm[{#SNMPINDEX}],,"like","moduleNoDefect")=0'
                  name: 'ZYXEL: Slot {#ZYXEL.SLOT.ID} alarm'
                  priority: AVERAGE
                  description: 'The slot reported an error.'
                  tags:
                    - tag: scope
                      value: notice
            - uuid: 6ce4b55490ed425b8fbc1ad337071730
              name: 'Slot {#ZYXEL.SLOT.ID}: DSL modem code version'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.4.1.890.1.5.13.5.6.3.1.6.{#SNMPINDEX}]'
              key: 'zyxel.ies6000.slot.cv.ver[{#SNMPINDEX}]'
              delay: 1h
              value_type: CHAR
              description: |
                MIB: ZYXEL-IES5000-MIB
                The DSL modem code version of the plug-in card.
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              tags:
                - tag: component
                  value: firmware
                - tag: component
                  value: line-card
                - tag: interface
                  value: 'slot-{#ZYXEL.SLOT.ID}'
              trigger_prototypes:
                - uuid: c62327e51d27445b893e80bf77c9696c
                  expression: 'last(/ZYXEL IES-6000 by SNMP/zyxel.ies6000.slot.cv.ver[{#SNMPINDEX}],#1)<>last(/ZYXEL IES-6000 by SNMP/zyxel.ies6000.slot.cv.ver[{#SNMPINDEX}],#2) and length(last(/ZYXEL IES-6000 by SNMP/zyxel.ies6000.slot.cv.ver[{#SNMPINDEX}]))>0'
                  name: 'ZYXEL: Slot {#ZYXEL.SLOT.ID}: DSL modem code has changed'
                  opdata: 'Current value: {ITEM.LASTVALUE1}'
                  priority: INFO
                  description: 'Firmware version has changed. Acknowledge to close the problem manually.'
                  manual_close: 'YES'
                  tags:
                    - tag: scope
                      value: notice
            - uuid: 780fdca5ba10495d8ae1dfec6a655d4a
              name: 'Slot {#ZYXEL.SLOT.ID}: Description'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.4.1.890.1.5.13.5.6.3.1.3.{#SNMPINDEX}]'
              key: 'zyxel.ies6000.slot.desc[{#SNMPINDEX}]'
              value_type: CHAR
              description: |
                MIB: ZYXEL-IES5000-MIB
                The descriptions of the plug-in card.
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              tags:
                - tag: component
                  value: line-card
                - tag: interface
                  value: 'slot-{#ZYXEL.SLOT.ID}'
            - uuid: a0dc5b9a8968401a832dfd76cda474f1
              name: 'Slot {#ZYXEL.SLOT.ID}: Driver version'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.4.1.890.1.5.13.5.6.3.1.5.{#SNMPINDEX}]'
              key: 'zyxel.ies6000.slot.dv.ver[{#SNMPINDEX}]'
              delay: 1h
              value_type: CHAR
              description: |
                MIB: ZYXEL-IES5000-MIB
                The DSL driver of the plug-in card.
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              tags:
                - tag: component
                  value: firmware
                - tag: component
                  value: line-card
                - tag: interface
                  value: 'slot-{#ZYXEL.SLOT.ID}'
              trigger_prototypes:
                - uuid: 63a4bdc73f8c49a7abb914f47e162dec
                  expression: 'last(/ZYXEL IES-6000 by SNMP/zyxel.ies6000.slot.dv.ver[{#SNMPINDEX}],#1)<>last(/ZYXEL IES-6000 by SNMP/zyxel.ies6000.slot.dv.ver[{#SNMPINDEX}],#2) and length(last(/ZYXEL IES-6000 by SNMP/zyxel.ies6000.slot.dv.ver[{#SNMPINDEX}]))>0'
                  name: 'ZYXEL: Slot {#ZYXEL.SLOT.ID}: Driver has changed'
                  opdata: 'Current value: {ITEM.LASTVALUE1}'
                  priority: INFO
                  description: 'Firmware version has changed. Acknowledge to close the problem manually.'
                  manual_close: 'YES'
                  tags:
                    - tag: scope
                      value: notice
            - uuid: e74a7678743c4739b98160a9cf3d516b
              name: 'Slot {#ZYXEL.SLOT.ID}: Firmware version'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.4.1.890.1.5.13.5.6.3.1.4.{#SNMPINDEX}]'
              key: 'zyxel.ies6000.slot.fw.ver[{#SNMPINDEX}]'
              delay: 1h
              value_type: CHAR
              description: |
                MIB: ZYXEL-IES5000-MIB
                The firmware version of the plug-in card.
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              tags:
                - tag: component
                  value: firmware
                - tag: component
                  value: line-card
                - tag: interface
                  value: 'slot-{#ZYXEL.SLOT.ID}'
              trigger_prototypes:
                - uuid: 7a2ef454d9624fd78416d2e1345be9a5
                  expression: 'last(/ZYXEL IES-6000 by SNMP/zyxel.ies6000.slot.fw.ver[{#SNMPINDEX}],#1)<>last(/ZYXEL IES-6000 by SNMP/zyxel.ies6000.slot.fw.ver[{#SNMPINDEX}],#2) and length(last(/ZYXEL IES-6000 by SNMP/zyxel.ies6000.slot.fw.ver[{#SNMPINDEX}]))>0'
                  name: 'ZYXEL: Slot {#ZYXEL.SLOT.ID}: Firmware has changed'
                  opdata: 'Current value: {ITEM.LASTVALUE1}'
                  priority: INFO
                  description: 'Firmware version has changed. Acknowledge to close the problem manually.'
                  manual_close: 'YES'
                  tags:
                    - tag: scope
                      value: notice
            - uuid: 96ee73d987be4576b6b40f21d43ebbac
              name: 'Slot {#ZYXEL.SLOT.ID}: Hardware version'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.4.1.890.1.5.13.5.6.3.1.10.{#SNMPINDEX}]'
              key: 'zyxel.ies6000.slot.hw.ver[{#SNMPINDEX}]'
              delay: 1h
              value_type: CHAR
              description: |
                MIB: ZYXEL-IES5000-MIB
                The hardware version of the plug-in card.
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              tags:
                - tag: component
                  value: firmware
                - tag: component
                  value: line-card
                - tag: interface
                  value: 'slot-{#ZYXEL.SLOT.ID}'
              trigger_prototypes:
                - uuid: 537f28be56984664822b574a2064453b
                  expression: 'last(/ZYXEL IES-6000 by SNMP/zyxel.ies6000.slot.hw.ver[{#SNMPINDEX}],#1)<>last(/ZYXEL IES-6000 by SNMP/zyxel.ies6000.slot.hw.ver[{#SNMPINDEX}],#2) and length(last(/ZYXEL IES-6000 by SNMP/zyxel.ies6000.slot.hw.ver[{#SNMPINDEX}]))>0'
                  name: 'ZYXEL: Slot {#ZYXEL.SLOT.ID}: Hardware version has changed'
                  opdata: 'Current value: {ITEM.LASTVALUE1}'
                  priority: INFO
                  description: 'Firmware version has changed. Acknowledge to close the problem manually.'
                  manual_close: 'YES'
                  tags:
                    - tag: scope
                      value: notice
            - uuid: aa0c1799930a46d9a658f26bf3549a18
              name: 'Slot {#ZYXEL.SLOT.ID}: MAC address 1'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.4.1.890.1.5.13.5.6.3.1.12.{#SNMPINDEX}]'
              key: 'zyxel.ies6000.slot.mac1[{#SNMPINDEX}]'
              value_type: CHAR
              description: |
                MIB: ZYXEL-IES5000-MIB
                The MAC Address of the plug-in card.
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              tags:
                - tag: component
                  value: line-card
                - tag: interface
                  value: 'slot-{#ZYXEL.SLOT.ID}'
            - uuid: 6fdbc67b2612400c9e8372b310ca496e
              name: 'Slot {#ZYXEL.SLOT.ID}: MAC address 2'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.4.1.890.1.5.13.5.6.3.1.13.{#SNMPINDEX}]'
              key: 'zyxel.ies6000.slot.mac2[{#SNMPINDEX}]'
              value_type: CHAR
              description: |
                MIB: ZYXEL-IES5000-MIB
                The MAC Address of the plug-in card.
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              tags:
                - tag: component
                  value: line-card
                - tag: interface
                  value: 'slot-{#ZYXEL.SLOT.ID}'
            - uuid: 5edbf1b21ca5436a9522f5dcfe80b61d
              name: 'Slot {#ZYXEL.SLOT.ID}: Serial number'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.4.1.890.1.5.13.5.6.3.1.9.{#SNMPINDEX}]'
              key: 'zyxel.ies6000.slot.serial[{#SNMPINDEX}]'
              value_type: CHAR
              description: |
                MIB: ZYXEL-IES5000-MIB
                The serial number of the plug-in card.
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              tags:
                - tag: component
                  value: line-card
                - tag: interface
                  value: 'slot-{#ZYXEL.SLOT.ID}'
              trigger_prototypes:
                - uuid: 3fbbcffe1c46497d89fe0d987a5f6eff
                  expression: 'last(/ZYXEL IES-6000 by SNMP/zyxel.ies6000.slot.serial[{#SNMPINDEX}],#1)<>last(/ZYXEL IES-6000 by SNMP/zyxel.ies6000.slot.serial[{#SNMPINDEX}],#2) and length(last(/ZYXEL IES-6000 by SNMP/zyxel.ies6000.slot.serial[{#SNMPINDEX}]))>0'
                  name: 'ZYXEL: Slot {#ZYXEL.SLOT.ID} has been replaced'
                  event_name: 'ZYXEL: Slot {#ZYXEL.SLOT.ID} has been replaced (new serial number received)'
                  priority: INFO
                  description: 'Slot {#ZYXEL.SLOT.ID} serial number has changed. Acknowledge to close the problem manually.'
                  manual_close: 'YES'
                  tags:
                    - tag: scope
                      value: notice
            - uuid: 5eeedb8e70764975872bd6dc6bc10821
              name: 'Slot {#ZYXEL.SLOT.ID}: Status'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.4.1.890.1.5.13.5.6.3.1.7.{#SNMPINDEX}]'
              key: 'zyxel.ies6000.slot.status[{#SNMPINDEX}]'
              description: |
                MIB: ZYXEL-IES5000-MIB
                The module state of the plug-in card.
              valuemap:
                name: 'ZYXEL IES-6000 module status'
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              tags:
                - tag: component
                  value: line-card
                - tag: interface
                  value: 'slot-{#ZYXEL.SLOT.ID}'
            - uuid: ea78751ce7954aa5b84caf9bdfcfeefd
              name: 'Slot {#ZYXEL.SLOT.ID}: Type'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.4.1.890.1.5.13.5.6.3.1.2.{#SNMPINDEX}]'
              key: 'zyxel.ies6000.slot.type[{#SNMPINDEX}]'
              description: |
                MIB: ZYXEL-IES5000-MIB
                Card type of the plug-in card.
              valuemap:
                name: 'ZYXEL IES-6000 module type'
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              tags:
                - tag: component
                  value: line-card
                - tag: interface
                  value: 'slot-{#ZYXEL.SLOT.ID}'
            - uuid: 37de3e96e8d8420192e6aae7a56ff9ef
              name: 'Slot {#ZYXEL.SLOT.ID}: Uptime'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.4.1.890.1.5.13.5.6.3.1.11.{#SNMPINDEX}]'
              key: 'zyxel.ies6000.slot.uptime[{#SNMPINDEX}]'
              units: s
              description: |
                MIB: ZYXEL-IES5000-MIB
                The time (in seconds) since the plug-in card was last re-initialized.
              tags:
                - tag: component
                  value: line-card
                - tag: interface
                  value: 'slot-{#ZYXEL.SLOT.ID}'
              trigger_prototypes:
                - uuid: 50e43c41d0e241238b65da25c12d1616
                  expression: 'last(/ZYXEL IES-6000 by SNMP/zyxel.ies6000.slot.uptime[{#SNMPINDEX}])<10m'
                  name: 'ZYXEL: Slot {#ZYXEL.SLOT.ID} has been restarted'
                  event_name: 'ZYXEL: Slot {#ZYXEL.SLOT.ID} has been restarted (uptime < 10m)'
                  priority: INFO
                  description: 'Uptime is less than 10 minutes.'
                  manual_close: 'YES'
                  tags:
                    - tag: scope
                      value: notice
        - uuid: 65972390ff734a088e984ac6531833c6
          name: 'Temperature discovery'
          type: SNMP_AGENT
          snmp_oid: 'discovery[{#ZYXEL.TEMP.THRESH.LOW},1.3.6.1.4.1.890.1.5.13.5.11.3.3.1.7,{#ZYXEL.TEMP.THRESH.HIGH},1.3.6.1.4.1.890.1.5.13.5.11.3.3.1.5]'
          key: zyxel.ies6000.temp.discovery
          delay: 1h
          description: 'An entry in tempTable.'
          item_prototypes:
            - uuid: 352f409f553f4805854690b51d83b061
              name: 'Slot {#ZYXEL.SLOT.ID}: Temperature "{#ZYXEL.TEMP.ID}"'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.4.1.890.1.5.13.5.11.3.3.1.2.{#SNMPINDEX}]'
              key: 'zyxel.ies6000.temp[{#SNMPINDEX}]'
              units: '!°C'
              description: |
                MIB: ZYXEL-IES5000-MIB
                The current temperature measured at this sensor
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              tags:
                - tag: component
                  value: sensor
                - tag: component
                  value: temperature
              trigger_prototypes:
                - uuid: c517b703b5084e9b8053fb139e3350ae
                  expression: 'last(/ZYXEL IES-6000 by SNMP/zyxel.ies6000.temp[{#SNMPINDEX}])>{#ZYXEL.TEMP.THRESH.HIGH} or last(/ZYXEL IES-6000 by SNMP/zyxel.ies6000.temp[{#SNMPINDEX}])<{#ZYXEL.TEMP.THRESH.LOW}'
                  name: 'ZYXEL: Temperature Slot {#ZYXEL.SLOT.ID} Sensor: {#ZYXEL.TEMP.ID} is in critical state'
                  opdata: 'Current state: {ITEM.LASTVALUE1}'
                  priority: AVERAGE
                  description: 'Please check the temperature'
                  tags:
                    - tag: scope
                      value: notice
          graph_prototypes:
            - uuid: 8e885ce1061b4400abce9eaad1271ea1
              name: 'ZYXEL IES-6000: "Temperature Slot {#ZYXEL.SLOT.ID} Sensor: {#ZYXEL.TEMP.ID}'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'ZYXEL IES-6000 by SNMP'
                    key: 'zyxel.ies6000.temp[{#SNMPINDEX}]'
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  var inArray = JSON.parse(value);
                  var outArr = [];
                  inArray.forEach(function (item, i, arr) {
                  	item['{#ZYXEL.SLOT.ID}'] = item['{#SNMPINDEX}'].split('.')[1];
                  	item['{#ZYXEL.TEMP.ID}'] = item['{#SNMPINDEX}'].split('.')[2];
                  	outArr.push(item);
                  });
                  return JSON.stringify(outArr);
        - uuid: 86ee5ab94e9a49dca526ce6e3d9c95fa
          name: 'Voltage discovery'
          type: SNMP_AGENT
          snmp_oid: 'discovery[{#ZYXEL.VOLT.THRESH.HIGH},1.3.6.1.4.1.890.1.5.13.5.11.3.2.1.8,{#ZYXEL.VOLT.THRESH.LOW},1.3.6.1.4.1.890.1.5.13.5.11.3.2.1.6,{#ZYXEL.VOLT.NOMINAL},1.3.6.1.4.1.890.1.5.13.5.11.3.2.1.5]'
          key: zyxel.ies6000.volt.discovery
          delay: 1h
          description: 'An entry in voltageTable.'
          item_prototypes:
            - uuid: 36940f27f78248d48ed8caf34fc15721
              name: 'Slot {#ZYXEL.SLOT.ID}: Nominal "{#ZYXEL.VOLT.NOMINAL}"'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.4.1.890.1.5.13.5.11.3.2.1.2.{#SNMPINDEX}]'
              key: 'zyxel.ies6000.volt[{#SNMPINDEX}]'
              value_type: FLOAT
              units: V
              description: |
                MIB: ZYXEL-IES5000-MIB
                The current voltage reading.
              preprocessing:
                - type: MULTIPLIER
                  parameters:
                    - '0.001'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              tags:
                - tag: component
                  value: sensor
                - tag: component
                  value: voltage
              trigger_prototypes:
                - uuid: 14c98fc8b4864a3c87062510a079d948
                  expression: 'last(/ZYXEL IES-6000 by SNMP/zyxel.ies6000.volt[{#SNMPINDEX}])<{#ZYXEL.VOLT.THRESH.LOW} or last(/ZYXEL IES-6000 by SNMP/zyxel.ies6000.volt[{#SNMPINDEX}])>{#ZYXEL.VOLT.THRESH.HIGH}'
                  name: 'ZYXEL: Voltage Slot {#ZYXEL.SLOT.ID} {#ZYXEL.VOLT.NOMINAL} is in critical state'
                  opdata: 'Current state: {ITEM.LASTVALUE1}'
                  priority: AVERAGE
                  description: 'Please check the power supply'
                  tags:
                    - tag: scope
                      value: notice
          graph_prototypes:
            - uuid: d7f01a58a08a4403818242a907152f78
              name: 'ZYXEL IES-6000: Slot {#ZYXEL.SLOT.ID}: Nominal "{#ZYXEL.VOLT.NOMINAL}"'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'ZYXEL IES-6000 by SNMP'
                    key: 'zyxel.ies6000.volt[{#SNMPINDEX}]'
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  var inArray = JSON.parse(value);
                  var outArr = []
                  inArray.forEach(function (item, i, arr) {
                  	item['{#ZYXEL.SLOT.ID}'] = item['{#SNMPINDEX}'].split('.')[1];
                  	item['{#ZYXEL.SENSOR.ID}'] = item['{#SNMPINDEX}'].split('.')[2];
                  	item["{#ZYXEL.VOLT.NOMINAL}"] = "+" + item["{#ZYXEL.VOLT.NOMINAL}"] / 1000 + "V";
                  	item["{#ZYXEL.VOLT.THRESH.LOW}"] /= 1000;
                  	item["{#ZYXEL.VOLT.THRESH.HIGH}"] /= 1000;
                  	outArr.push(item)
                  });
                  return JSON.stringify(outArr);
      tags:
        - tag: class
          value: network
        - tag: target
          value: dslam
        - tag: target
          value: ies-6000
        - tag: target
          value: zyxel
      macros:
        - macro: '{$SNMP.TIMEOUT}'
          value: 5m
          description: 'The time interval for SNMP agent availability trigger expression.'
          config:
            type: TEXT
            priority: '2'
            section_name: Thresholds
            label: 'Time interval'
            description: 'The time interval for SNMP agent availability trigger expression.'
        - macro: '{$ZYXEL.ADSL.ATN.MAX}'
          value: '40'
          description: 'Type the maximum signal attenuation'
          config:
            type: TEXT
            priority: '4'
            section_name: Thresholds
            label: 'Max signal attenuation'
            description: 'Type the maximum signal attenuation'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$ZYXEL.ADSL.SNR.MIN}'
          value: '8'
          description: 'Type the minimum signal to noise margin (0-31 dB)'
          config:
            type: TEXT
            priority: '3'
            section_name: Thresholds
            label: 'Min signal-to-noise margin (0-31 dB)'
            description: 'Type the minimum signal to noise margin (0-31 dB)'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$ZYXEL.LLD.FILTER.IF.CONTROL.MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'Triggers will be created only for interfaces whose description contains the value of this macro'
          config:
            type: TEXT
            priority: '1'
            section_name: Filters
            label: 'Filter for interface control (include)'
            description: 'Triggers will be created only for interfaces whose description contains the value of this macro'
        - macro: '{$ZYXEL.LLD.FILTER.IF.DESC.MATCHES}'
          value: '.*'
          description: 'Filter by discoverable interface names.'
          config:
            type: TEXT
            priority: '5'
            section_name: Filters
            label: 'Filter for interface description (include)'
            description: 'Filter by discoverable interface names.'
        - macro: '{$ZYXEL.LLD.FILTER.IF.DESC.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'Filter to exclude discovered interfaces by name.'
          config:
            type: TEXT
            priority: '6'
            section_name: Filters
            label: 'Filter for interface description (exclude)'
            description: 'Filter to exclude discovered interfaces by name.'
        - macro: '{$ZYXEL.LLD.FILTER.IF.LINKSTATUS.MATCHES}'
          value: '.*'
          description: 'Filter of discoverable link types.'
          config:
            type: TEXT
            priority: '9'
            section_name: Filters
            label: 'Filter for interface link status (include)'
            description: 'Filter of discoverable link types.'
        - macro: '{$ZYXEL.LLD.FILTER.IF.LINKSTATUS.NOT_MATCHES}'
          value: '2'
          description: 'Filter to exclude discovered by link types.'
          config:
            type: TEXT
            priority: '10'
            section_name: Filters
            label: 'Filter for interface link status (exclude)'
            description: 'Filter to exclude discovered by link types.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$ZYXEL.LLD.FILTER.SLOT.STATUS.MATCHES}'
          value: '.*'
          description: 'Filter by discoverable slot status.'
          config:
            type: TEXT
            priority: '7'
            section_name: Filters
            label: 'Filter for slot status (include)'
            description: 'Filter by discoverable slot status.'
        - macro: '{$ZYXEL.LLD.FILTER.SLOT.STATUS.NOT_MATCHES}'
          value: '1'
          description: 'Filter to exclude discovered slots by status.'
          config:
            type: TEXT
            priority: '8'
            section_name: Filters
            label: 'Filter for slot status (exclude)'
            description: 'Filter to exclude discovered slots by status.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
      dashboards:
        - uuid: 38c74d46e279422f9e612d93596f37ad
          name: 'Network interfaces'
          pages:
            - widgets:
                - type: graphprototype
                  width: '72'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'ZYXEL IES-6000 by SNMP'
                        name: 'ZYXEL IES-6000: Port {#SNMPINDEX}: Traffic'
                    - type: STRING
                      name: reference
                      value: AAAAA
                    - type: INTEGER
                      name: rows
                      value: '5'
      valuemaps:
        - uuid: 5247e9e5efcd4b29b864e336619eafcf
          name: 'SNMP available'
          mappings:
            - value: '0'
              newvalue: 'not available'
            - value: '1'
              newvalue: available
            - value: '2'
              newvalue: unknown
        - uuid: 0236177f088340ff8ce5adb9361b8df8
          name: 'ZYXEL IES-6000 module status'
          mappings:
            - value: '1'
              newvalue: Empty
            - value: '2'
              newvalue: Up
            - value: '3'
              newvalue: Down
            - value: '4'
              newvalue: Testing
            - value: '5'
              newvalue: Standby
        - uuid: 7ad4e124b8184fb8abc454c70c67e309
          name: 'ZYXEL IES-6000 module type'
          mappings:
            - value: '1'
              newvalue: unknown
            - value: '101'
              newvalue: msc1000G
            - value: '102'
              newvalue: alc1248G_51
            - value: '103'
              newvalue: alc1248G_53
            - value: '104'
              newvalue: slc1248G_22
            - value: '105'
              newvalue: vlc1224G_41
            - value: '106'
              newvalue: msc1024G
            - value: '107'
              newvalue: alc1272G_51
            - value: '108'
              newvalue: vop1248G_61_SIP
            - value: '109'
              newvalue: msc1000GA
            - value: '110'
              newvalue: vlc1324G_51
            - value: '111'
              newvalue: msc1224G
            - value: '112'
              newvalue: vop1248G_61_H248
            - value: '113'
              newvalue: vlc1348G_51
            - value: '114'
              newvalue: elc1220G_55
            - value: '115'
              newvalue: msc1024GA
            - value: '116'
              newvalue: vlc1324G_53
            - value: '117'
              newvalue: ima1408G_81
            - value: '118'
              newvalue: vlc1424G_56
            - value: '119'
              newvalue: slc1348G_22
            - value: '120'
              newvalue: vlc1348G_53
            - value: '121'
              newvalue: alc1372G_51
            - value: '122'
              newvalue: msc1024GB
            - value: '123'
              newvalue: msc1224GB
            - value: '124'
              newvalue: vop1372G_61_H248
        - uuid: b20f50ac559f45369de16c04f5ccf523
          name: 'ZYXEL IES-6000 port admin status'
          mappings:
            - value: '1'
              newvalue: Up
            - value: '2'
              newvalue: Down
            - value: '3'
              newvalue: Testing
        - uuid: 2f3b061e1d6f46a3b8216b2398fc2896
          name: 'ZYXEL IES-6000 port operational status'
          mappings:
            - value: '1'
              newvalue: Up
            - value: '2'
              newvalue: Down
            - value: '3'
              newvalue: Testing
            - value: '4'
              newvalue: Unknown
            - value: '5'
              newvalue: Dormant
            - value: '6'
              newvalue: NotPresent
            - value: '7'
              newvalue: lowerLayerDown
    - uuid: 8e6d7067cd094e56a52db999b3199edc
      template: 'ZYXEL IES1248-51 by SNMP'
      name: 'ZYXEL IES1248-51 by SNMP'
      description: |
        ZYXEL IES1248-51
        
        MIBs used:
        RFC1213-MIB
        HOST-RESOURCES-MIB
        ADSL-LINE-MIB
        ZYXEL-IESCOMMON-MIB
        IF-MIB
        
        Known Issues:
        
          Description: Incorrect handling of SNMP bulk requests. Disable the use of bulk requests in the SNMP interface settings.
          Version: all versions firmware
          Device: ZYXEL IES1248-51
        
        You can discuss this template or leave feedback on our forum https://www.zabbix.com/forum/zabbix-suggestions-and-feedback/422668-discussion-thread-for-official-zabbix-templates-for-zyxel
        
        Generated by official Zabbix template tool "Templator"
      wizard_ready: 'YES'
      readme: |
        ## Overview
        
        http://origin-eu.zyxel.com/products_services/ies_1248_51v.shtml?t=p
        
        ### Known Issues
        
        Description: Incorrect handling of SNMP bulk requests. Disable the use of bulk requests in the SNMP interface settings.
        Version: all versions firmware
        Device: ZYXEL IES1248-51
      vendor:
        name: Zabbix
        version: 8.0-2
      groups:
        - name: 'Templates/Network devices'
      items:
        - uuid: 03cf90df51e0466c8b31744ce820276f
          name: 'SNMP agent availability'
          type: INTERNAL
          key: 'zabbix[host,snmp,available]'
          valuemap:
            name: 'SNMP available'
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          tags:
            - tag: component
              value: network
          triggers:
            - uuid: 40466f29b8e54dc88cb49e818fc48281
              expression: 'max(/ZYXEL IES1248-51 by SNMP/zabbix[host,snmp,available],{$SNMP.TIMEOUT})=0'
              name: 'ZYXEL: No SNMP data collection'
              opdata: 'Current state: {ITEM.LASTVALUE1}'
              priority: WARNING
              description: 'SNMP is not available for polling. Please check device connectivity and SNMP settings.'
              tags:
                - tag: scope
                  value: availability
        - uuid: a01b8490f3b94ac5ab500d67171cfe1a
          name: Contact
          type: SNMP_AGENT
          snmp_oid: 'get[1.3.6.1.2.1.1.4.0]'
          key: zyxel.ies1248.contact
          delay: 1h
          value_type: CHAR
          description: |
            MIB: RFC1213-MIB
            The textual identification of the contact person
            for this managed node, together with information
            on how to contact this person.
          inventory_link: CONTACT
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
          tags:
            - tag: component
              value: inventory
        - uuid: 56974ccbede04e9eb966951ac3c88250
          name: 'ZyNOS F/W Version'
          type: SNMP_AGENT
          snmp_oid: 'get[1.3.6.1.4.1.890.1.5.13.1.1.3.1.4.0.0]'
          key: zyxel.ies1248.fwversion
          delay: 1h
          value_type: CHAR
          description: 'MIB: ZYXEL-IESCOMMON-MIB'
          inventory_link: SOFTWARE_FULL
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
          tags:
            - tag: component
              value: inventory
          triggers:
            - uuid: b64e891456674457ab4abf994b097277
              expression: 'last(/ZYXEL IES1248-51 by SNMP/zyxel.ies1248.fwversion,#1)<>last(/ZYXEL IES1248-51 by SNMP/zyxel.ies1248.fwversion,#2) and length(last(/ZYXEL IES1248-51 by SNMP/zyxel.ies1248.fwversion))>0'
              name: 'ZYXEL: Firmware has changed'
              opdata: 'Current value: {ITEM.LASTVALUE1}'
              priority: INFO
              description: 'Firmware version has changed. Acknowledge to close the problem manually.'
              manual_close: 'YES'
              tags:
                - tag: scope
                  value: notice
        - uuid: 4b55d1aaee3b441bab6edaaf738065e4
          name: 'Uptime (hardware)'
          type: SNMP_AGENT
          snmp_oid: 'get[1.3.6.1.2.1.25.1.1.0]'
          key: zyxel.ies1248.hw.uptime
          delay: 30s
          trends: '0'
          units: uptime
          description: |
            MIB: HOST-RESOURCES-MIB
            The amount of time since this host was last initialized.
            Note that this is different from sysUpTime in the SNMPv2-MIB
            [RFC1907] because sysUpTime is the uptime of the
            network management portion of the system.
          preprocessing:
            - type: CHECK_NOT_SUPPORTED
              parameters:
                - '-1'
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
            - type: MULTIPLIER
              parameters:
                - '0.01'
          tags:
            - tag: component
              value: system
        - uuid: 600e6a8b9dd549b69f64f1a536bce7de
          name: Location
          type: SNMP_AGENT
          snmp_oid: 'get[1.3.6.1.2.1.1.6.0]'
          key: zyxel.ies1248.location
          delay: 1h
          value_type: CHAR
          description: |
            MIB: RFC1213-MIB
            The physical location of this node (e.g.,
            `telephone closet, 3rd floor').
          inventory_link: LOCATION
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
          tags:
            - tag: component
              value: inventory
        - uuid: ad09c90a951a4c41b935a70f58f5c26a
          name: 'MAC address'
          type: SNMP_AGENT
          snmp_oid: 'get[1.3.6.1.2.1.2.2.1.6.1]'
          key: zyxel.ies1248.mac
          delay: 1h
          value_type: CHAR
          description: |
            MIB: IF-MIB
            The interface's address at the protocol layer
            immediately `below' the network layer in the
            protocol stack.  For interfaces which do not have
            such an address (e.g., a serial line), this object
            should contain an octet string of zero length.
          inventory_link: MACADDRESS_A
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
          tags:
            - tag: component
              value: inventory
        - uuid: 427ef42e55ca498db16d078ed41e7ad9
          name: 'Hardware model name'
          type: SNMP_AGENT
          snmp_oid: 'get[1.3.6.1.2.1.1.1.0]'
          key: zyxel.ies1248.model
          delay: 1h
          value_type: CHAR
          description: |
            MIB: RFC1213-MIB
            A textual description of the entity.  This value
            should include the full name and version
            identification of the system's hardware type,
            software operating-system, and networking
            software.  It is mandatory that this only contain
            printable ASCII characters.
          inventory_link: MODEL
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
          tags:
            - tag: component
              value: inventory
          triggers:
            - uuid: 21b638f9f1154b6bb78a652d8e54c1c2
              expression: 'last(/ZYXEL IES1248-51 by SNMP/zyxel.ies1248.model)<>"IES1248-51"'
              name: 'ZYXEL: Template does not match hardware'
              priority: INFO
              description: 'This template is for Zyxel IES1248-51, but connected to {ITEM.VALUE}'
              tags:
                - tag: scope
                  value: notice
        - uuid: 8c6546b670d4455aa1234c35bb033ac7
          name: 'Host name'
          type: SNMP_AGENT
          snmp_oid: 'get[1.3.6.1.2.1.1.5.0]'
          key: zyxel.ies1248.name
          delay: 1h
          value_type: CHAR
          description: |
            MIB: RFC1213-MIB
            An administratively-assigned name for this
            managed node.  By convention, this is the node's
            fully-qualified domain name.
          inventory_link: NAME
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
          tags:
            - tag: component
              value: inventory
        - uuid: ba41848140394ac29fe9b77e77627f20
          name: 'Uptime (network)'
          type: SNMP_AGENT
          snmp_oid: 'get[1.3.6.1.2.1.1.3.0]'
          key: zyxel.ies1248.net.uptime
          delay: 30s
          trends: '0'
          units: uptime
          description: |
            MIB: RFC1213-MIB
            The time (in hundredths of a second) since the
            network management portion of the system was last
            re-initialized.
          preprocessing:
            - type: MULTIPLIER
              parameters:
                - '0.01'
          tags:
            - tag: component
              value: system
        - uuid: 0d30380bb9a24bd1939d16287d5d0711
          name: 'Hardware serial number'
          type: SNMP_AGENT
          snmp_oid: 'get[1.3.6.1.4.1.890.1.5.13.1.1.2.1.3.0]'
          key: zyxel.ies1248.serialnumber
          delay: 1h
          value_type: CHAR
          description: |
            MIB: ZYXEL-IESCOMMON-MIB
            Serial number
          inventory_link: SERIALNO_A
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
          tags:
            - tag: component
              value: inventory
          triggers:
            - uuid: 2f2972169c164053a8d439b0e572b0c6
              expression: 'last(/ZYXEL IES1248-51 by SNMP/zyxel.ies1248.serialnumber,#1)<>last(/ZYXEL IES1248-51 by SNMP/zyxel.ies1248.serialnumber,#2) and length(last(/ZYXEL IES1248-51 by SNMP/zyxel.ies1248.serialnumber))>0'
              name: 'ZYXEL: Device has been replaced'
              event_name: 'ZYXEL: Device has been replaced (new serial number received)'
              priority: INFO
              description: 'Device serial number has changed. Acknowledge to close the problem manually.'
              manual_close: 'YES'
              tags:
                - tag: scope
                  value: notice
        - uuid: bafdca2040ba44be911fd1e5a09f3298
          name: 'Alarm status'
          type: SNMP_AGENT
          snmp_oid: 'get[1.3.6.1.4.1.890.1.5.13.1.1.3.1.8.0.0]'
          key: zyxel.ies1248.slot.alarm
          value_type: CHAR
          description: |
            MIB: ZYXEL-IESCOMMON-MIB
            This variable indicates the alarm status of the module.
            It is a bit map represented a sum, therefore, it can represent
            multiple defects simultaneously. The moduleNoDefect should be set
            if and only if no other flag is set.
            The various bit positions are:
            1   moduleNoDefect
            2   moduleOverHeat
            3   moduleFanRpmLow
            4   moduleVoltageLow
            5   moduleThermalSensorFailure
            6   modulePullOut
            7   powerDC48VAFailure
            8   powerDC48VBFailure
            9   extAlarmInputTrigger
            10   moduleDown
            11   mscSwitchOverOK
            12   networkTopologyChange
            13   macSpoof
            14   cpuHigh
            15   memoryUsageHigh
            16   packetBufferUsageHigh
            17   loopguardOccurence
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  var valueArray = [
                  	'moduleNoDefect',
                  	'moduleOverHeat',
                  	'moduleFanRpmLow',
                  	'moduleVoltageLow',
                  	'moduleThermalSensorFailure',
                  	'modulePullOut',
                  	'powerDC48VAFailure',
                  	'powerDC48VBFailure',
                  	'extAlarmInputTrigger',
                  	'moduleDown',
                  	'mscSwitchOverOK',
                  	'networkTopologyChange',
                  	'macSpoof',
                  	'cpuHigh',
                  	'memoryUsageHigh',
                  	'packetBufferUsageHigh',
                  	'loopguardOccurence'
                  ];
                  var base2 = parseInt(value).toString(2);
                  var outArray = [];
                  for (var i = 0; i < base2.length; ++i) {
                  	if (base2[base2.length - 1 - i] === '1') outArray.push(valueArray[i]);
                  }
                  return outArray.join();
          tags:
            - tag: component
              value: line-card
            - tag: interface
              value: 'slot-{#ZYXEL.SLOT.ID}'
          triggers:
            - uuid: 6b1b1b27241f42229e8b159320371356
              expression: 'find(/ZYXEL IES1248-51 by SNMP/zyxel.ies1248.slot.alarm,,"like","moduleNoDefect")=0'
              name: 'ZYXEL: Port {#SNMPINDEX} alarm'
              priority: AVERAGE
              description: 'The slot reported an error.'
              tags:
                - tag: scope
                  value: notice
      discovery_rules:
        - uuid: 9ffacb42c2fe4abd9e8d10e4b8803fc2
          name: 'Fan discovery'
          type: SNMP_AGENT
          snmp_oid: 'discovery[{#ZYXEL.FANRPM.THRESH.LOW},1.3.6.1.4.1.890.1.5.13.1.2.1.1.5]'
          key: zyxel.ies1248.fan.discovery
          delay: 1h
          description: 'An entry in fanRpmTable.'
          item_prototypes:
            - uuid: d420958f89f04467b5aa4d41c565160b
              name: 'Fan #{#SNMPINDEX}'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.4.1.890.1.5.13.1.2.1.1.2.{#SNMPINDEX}]'
              key: 'zyxel.ies1248.fan[{#SNMPINDEX}]'
              units: '!rpm'
              description: |
                MIB: ZYXEL-IESCOMMON-MIB
                Current speed in Revolutions Per Minute (RPM) on the fan.
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              tags:
                - tag: component
                  value: fan
                - tag: component
                  value: sensor
              trigger_prototypes:
                - uuid: 86f18f4e598443ab9e0ec30554d78e1a
                  expression: 'last(/ZYXEL IES1248-51 by SNMP/zyxel.ies1248.fan[{#SNMPINDEX}])<{#ZYXEL.FANRPM.THRESH.LOW}'
                  name: 'ZYXEL: FAN{#SNMPINDEX} is in critical state'
                  opdata: 'Current state: {ITEM.LASTVALUE1}'
                  priority: AVERAGE
                  description: 'Please check the fan unit'
                  tags:
                    - tag: scope
                      value: notice
          graph_prototypes:
            - uuid: f8d2136dab70403a98da660bcf4c02a2
              name: 'ZYXEL IES1248-51: Fan #{#SNMPINDEX}'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'ZYXEL IES1248-51 by SNMP'
                    key: 'zyxel.ies1248.fan[{#SNMPINDEX}]'
        - uuid: 47dc5ba65f25444c961b7684d65bbc07
          name: 'ADSL interface discovery'
          type: SNMP_AGENT
          snmp_oid: 'discovery[{#ZYXEL.IF.NAME},1.3.6.1.2.1.2.2.1.2,{#ZYXEL.IF.LINKSTATUS},1.3.6.1.2.1.2.2.1.8]'
          key: zyxel.ies1248.net.adsl.discovery
          delay: 1h
          filter:
            evaltype: AND
            conditions:
              - macro: '{#ZYXEL.IF.LINKSTATUS}'
                value: '{$ZYXEL.LLD.FILTER.IF.LINKSTATUS.MATCHES}'
              - macro: '{#ZYXEL.IF.LINKSTATUS}'
                value: '{$ZYXEL.LLD.FILTER.IF.LINKSTATUS.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
              - macro: '{#ZYXEL.IF.NAME}'
                value: adsl
          item_prototypes:
            - uuid: ca789e47cbfc4ee080a25e7003e92fad
              name: 'Port {#SNMPINDEX}: Administrative status'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.2.2.1.7.{#SNMPINDEX}]'
              key: 'zyxel.ies1248.net.adsl.adminstatus[{#SNMPINDEX}]'
              description: |
                MIB: IF-MIB
                The desired state of the interface.  The
                testing(3) state indicates that no operational
                packets can be passed.
              valuemap:
                name: 'ZYXEL IES1248-51 port admin status'
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: 7c13234155f343bc90bf1584a7f0fb3f
              name: 'Port {#SNMPINDEX}: ATUC attenuation'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.10.94.1.1.2.1.5.{#SNMPINDEX}]'
              key: 'zyxel.ies1248.net.adsl.atuc.atn[{#SNMPINDEX}]'
              value_type: FLOAT
              units: dB
              description: |
                MIB: ADSL-LINE-MIB
                Measured difference in the total power transmitted by
                the peer ATU and the total power received by this ATU.
                The Info Atuc fields show data acquired from the ATUC (ADSL Termination Unit - Central), in this case ZYXEL IES1248-51, during negotiation/provisioning message interchanges.
              preprocessing:
                - type: MULTIPLIER
                  parameters:
                    - '0.1'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
              trigger_prototypes:
                - uuid: 23e50c0031c1457596b1366a40606ef9
                  expression: 'min(/ZYXEL IES1248-51 by SNMP/zyxel.ies1248.net.adsl.atuc.atn[{#SNMPINDEX}],5m)>{$ZYXEL.ADSL.ATN.MAX}'
                  name: 'ZYXEL: High the DSL line attenuation in Port {#SNMPINDEX}'
                  event_name: 'ZYXEL: High the DSL line attenuation in Port {#SNMPINDEX} (>{$ZYXEL.ADSL.ATN.MAX}dB for 5m)'
                  priority: WARNING
                  description: 'The reductions in amplitude of the downstream and upstream DSL signals.'
                  tags:
                    - tag: scope
                      value: capacity
            - uuid: 524bf397c9a640c48716fa20e4c45034
              name: 'Port {#SNMPINDEX}: ATUC output power'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.10.94.1.1.2.1.7.{#SNMPINDEX}]'
              key: 'zyxel.ies1248.net.adsl.atuc.outpwr[{#SNMPINDEX}]'
              value_type: FLOAT
              units: dB
              description: |
                MIB: ADSL-LINE-MIB
                Measured total output power transmitted by this ATU.
                The Info Atuc fields show data acquired from the ATUC (ADSL Termination Unit - Central), in this case ZYXEL IES1248-51, during negotiation/provisioning message interchanges.
              preprocessing:
                - type: MULTIPLIER
                  parameters:
                    - '0.1'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: ed1768b17f0f434392c5cbc91ddd5222
              name: 'Port {#SNMPINDEX}: ATUC noise margin'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.10.94.1.1.2.1.4.{#SNMPINDEX}]'
              key: 'zyxel.ies1248.net.adsl.atuc.snrmgn[{#SNMPINDEX}]'
              value_type: FLOAT
              units: dB
              description: |
                MIB: ADSL-LINE-MIB
                Noise Margin as seen by this ATU with respect to its
                received signal in tenth dB.
                The Info Atuc fields show data acquired from the ATUC (ADSL Termination Unit - Central), in this case ZYXEL IES1248-51, during negotiation/provisioning message interchanges.
              preprocessing:
                - type: MULTIPLIER
                  parameters:
                    - '0.1'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
              trigger_prototypes:
                - uuid: 23bbc44b2f114afe99a8175a2b7f0ddd
                  expression: 'min(/ZYXEL IES1248-51 by SNMP/zyxel.ies1248.net.adsl.atuc.snrmgn[{#SNMPINDEX}],5m)<{$ZYXEL.ADSL.SNR.MIN}'
                  name: 'ZYXEL: Low the DSL line noise margins in Port {#SNMPINDEX}'
                  event_name: 'ZYXEL: Low the DSL line noise margins in Port {#SNMPINDEX} (<{$ZYXEL.ADSL.SNR.MIN}dB for 5m)'
                  priority: WARNING
                  description: 'Signal-to-noise margin (SNR Margin) which is the difference between the actual SNR and the SNR required to sync at a specific speed'
                  tags:
                    - tag: scope
                      value: capacity
            - uuid: 0dd3a9f10abb4a8a92f627228c9fbb52
              name: 'Port {#SNMPINDEX}: ATUR attenuation'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.10.94.1.1.3.1.5.{#SNMPINDEX}]'
              key: 'zyxel.ies1248.net.adsl.atur.atn[{#SNMPINDEX}]'
              value_type: FLOAT
              units: dB
              description: |
                MIB: ADSL-LINE-MIB
                Measured difference in the total power transmitted by
                the peer ATU and the total power received by this ATU.
                The Info Atur fields show data acquired from the ATUR (ADSL Termination Unit - Remote), in this case the subscriber's ADSL modem or router, during negotiation/provisioning message interchanges.
              preprocessing:
                - type: MULTIPLIER
                  parameters:
                    - '0.1'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
              trigger_prototypes:
                - uuid: 2132fed26fe54a7daa017b7264c37f1c
                  expression: 'min(/ZYXEL IES1248-51 by SNMP/zyxel.ies1248.net.adsl.atur.atn[{#SNMPINDEX}],5m)>{$ZYXEL.ADSL.ATN.MAX}'
                  name: 'ZYXEL: High the DSL line attenuation in Port {#SNMPINDEX}'
                  event_name: 'ZYXEL: High the DSL line attenuation in Port {#SNMPINDEX} (>{$ZYXEL.ADSL.ATN.MAX}dB for 5m)'
                  priority: WARNING
                  description: 'The reductions in amplitude of the downstream and upstream DSL signals.'
                  tags:
                    - tag: scope
                      value: capacity
            - uuid: 54c5b104d96945eca7cf402a2e910f90
              name: 'Port {#SNMPINDEX}: ATUR output power'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.10.94.1.1.3.1.7.{#SNMPINDEX}]'
              key: 'zyxel.ies1248.net.adsl.atur.outpwr[{#SNMPINDEX}]'
              value_type: FLOAT
              units: dB
              description: |
                MIB: ADSL-LINE-MIB
                Measured total output power transmitted by this ATU.
                The Info Atur fields show data acquired from the ATUR (ADSL Termination Unit - Remote), in this case the subscriber's ADSL modem or router, during negotiation/provisioning message interchanges.
              preprocessing:
                - type: MULTIPLIER
                  parameters:
                    - '0.1'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: 9744b18d3eec4bd2954ec7ea29e341fd
              name: 'Port {#SNMPINDEX}: ATUR noise margin'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.10.94.1.1.3.1.4.{#SNMPINDEX}]'
              key: 'zyxel.ies1248.net.adsl.atur.snrmgn[{#SNMPINDEX}]'
              value_type: FLOAT
              units: dB
              description: |
                MIB: ADSL-LINE-MIB
                Noise Margin as seen by this ATU with respect to its
                received signal in tenth dB.
                The Info Atur fields show data acquired from the ATUR (ADSL Termination Unit - Remote), in this case the subscriber's ADSL modem or router, during negotiation/provisioning message interchanges.
              preprocessing:
                - type: MULTIPLIER
                  parameters:
                    - '0.1'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
              trigger_prototypes:
                - uuid: 2d8f752b376f4c10bc8efbd39c8f45a9
                  expression: 'min(/ZYXEL IES1248-51 by SNMP/zyxel.ies1248.net.adsl.atur.snrmgn[{#SNMPINDEX}],5m)<{$ZYXEL.ADSL.SNR.MIN}'
                  name: 'ZYXEL: Low the DSL line noise margins in Port {#SNMPINDEX}'
                  event_name: 'ZYXEL: Low the DSL line noise margins in Port {#SNMPINDEX} (<{$ZYXEL.ADSL.SNR.MIN}dB for 5m)'
                  priority: WARNING
                  description: 'Signal-to-noise margin (SNR Margin) which is the difference between the actual SNR and the SNR required to sync at a specific speed'
                  tags:
                    - tag: scope
                      value: capacity
            - uuid: b7f622f72f98417cab3954717d311080
              name: 'Port {#SNMPINDEX}: Incoming traffic'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.2.2.1.10.{#SNMPINDEX}]'
              key: 'zyxel.ies1248.net.adsl.in.traffic[{#SNMPINDEX}]'
              units: bps
              description: |
                MIB: IF-MIB
                The total number of octets received on the interface,
                including framing characters.
              preprocessing:
                - type: MULTIPLIER
                  parameters:
                    - '8'
                - type: CHANGE_PER_SECOND
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: bff933861d744ee5a3229c2c6b1dc4c0
              name: 'Port {#SNMPINDEX}: Interface name'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.2.2.1.2.{#SNMPINDEX}]'
              key: 'zyxel.ies1248.net.adsl.name[{#SNMPINDEX}]'
              value_type: CHAR
              description: |
                MIB: IF-MIB
                A textual string containing information about the interface
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: 25c07c59e30e42b191162fa40066c8b8
              name: 'Port {#SNMPINDEX}: Operational status'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.2.2.1.8.{#SNMPINDEX}]'
              key: 'zyxel.ies1248.net.adsl.operstatus[{#SNMPINDEX}]'
              description: |
                MIB: IF-MIB
                The current operational state of the interface.
                The testing(3) state indicates that no operational
                packets can be passed.
              valuemap:
                name: 'ZYXEL IES1248-51 port operational status'
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
              trigger_prototypes:
                - uuid: 93a58c14939d4c3491646171910fe5ad
                  expression: 'last(/ZYXEL IES1248-51 by SNMP/zyxel.ies1248.net.adsl.operstatus[{#SNMPINDEX}])=2 and last(/ZYXEL IES1248-51 by SNMP/zyxel.ies1248.net.adsl.operstatus[{#SNMPINDEX}],#1)<>last(/ZYXEL IES1248-51 by SNMP/zyxel.ies1248.net.adsl.operstatus[{#SNMPINDEX}],#2)'
                  recovery_mode: RECOVERY_EXPRESSION
                  recovery_expression: 'last(/ZYXEL IES1248-51 by SNMP/zyxel.ies1248.net.adsl.operstatus[{#SNMPINDEX}])<>2'
                  name: 'ZYXEL: Port {#SNMPINDEX}: Link down'
                  opdata: 'Current state: {ITEM.LASTVALUE1}'
                  priority: AVERAGE
                  description: |
                    This trigger expression works as follows:
                    1. It can be triggered if the operations status is down.
                    2. `{$IFCONTROL:"{#IFNAME}"}=1` - a user can redefine context macro to value - 0. That marks this interface as not important. No new trigger will be fired if this interface is down.
                    3. `{TEMPLATE_NAME:METRIC.diff()}=1` - the trigger fires only if the operational status was up to (1) sometime before (so, do not fire for the 'eternal off' interfaces.)
                    
                    WARNING: if closed manually - it will not fire again on the next poll, because of .diff.
                  manual_close: 'YES'
                  tags:
                    - tag: scope
                      value: notice
            - uuid: 6df1c990c9dc49caa151dfc989d055b9
              name: 'Port {#SNMPINDEX}: Outgoing traffic'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.2.2.1.16.{#SNMPINDEX}]'
              key: 'zyxel.ies1248.net.adsl.out.traffic[{#SNMPINDEX}]'
              units: bps
              description: |
                MIB: IF-MIB
                The total number of octets transmitted out of the
                interface, including framing characters.  This object is a
                64-bit version of ifOutOctets.
              preprocessing:
                - type: MULTIPLIER
                  parameters:
                    - '8'
                - type: CHANGE_PER_SECOND
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
          graph_prototypes:
            - uuid: 7c9c5ff332394b97a311225de08b6bc6
              name: 'ZYXEL IES1248-51: ADSL port {#SNMPINDEX}: Traffic'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'ZYXEL IES1248-51 by SNMP'
                    key: 'zyxel.ies1248.net.adsl.in.traffic[{#SNMPINDEX}]'
                - sortorder: '1'
                  color: F63100
                  item:
                    host: 'ZYXEL IES1248-51 by SNMP'
                    key: 'zyxel.ies1248.net.adsl.out.traffic[{#SNMPINDEX}]'
          overrides:
            - name: 'Don''t create triggers for matching interface'
              step: '1'
              filter:
                conditions:
                  - macro: '{#ZYXEL.IF.NAME}'
                    value: '{$ZYXEL.LLD.FILTER.IF.CONTROL.MATCHES}'
                    operator: NOT_MATCHES_REGEX
              operations:
                - operationobject: TRIGGER_PROTOTYPE
                  operator: REGEXP
                  value: '.*'
                  discover: NO_DISCOVER
        - uuid: 4b32903336ad4c9e826cfd65a89a8960
          name: 'Ethernet interface discovery'
          type: SNMP_AGENT
          snmp_oid: 'discovery[{#ZYXEL.IF.NAME},1.3.6.1.2.1.2.2.1.2,{#ZYXEL.IF.LINKSTATUS},1.3.6.1.2.1.2.2.1.8]'
          key: zyxel.ies1248.net.if.discovery
          delay: 1h
          filter:
            evaltype: AND
            conditions:
              - macro: '{#ZYXEL.IF.LINKSTATUS}'
                value: '{$ZYXEL.LLD.FILTER.IF.LINKSTATUS.MATCHES}'
              - macro: '{#ZYXEL.IF.LINKSTATUS}'
                value: '{$ZYXEL.LLD.FILTER.IF.LINKSTATUS.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
              - macro: '{#ZYXEL.IF.NAME}'
                value: enet
          item_prototypes:
            - uuid: 8d402a2674084fdb9d26bc5caeafc34f
              name: 'Port {#ZYXEL.IF.NAME}: Administrative status'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.2.2.1.7.{#SNMPINDEX}]'
              key: 'zyxel.ies1248.net.if.adminstatus[{#SNMPINDEX}]'
              description: |
                MIB: IF-MIB
                The desired state of the interface.  The
                testing(3) state indicates that no operational
                packets can be passed.
              valuemap:
                name: 'ZYXEL IES1248-51 port admin status'
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: de5cf230831840cc985b63ba58d05059
              name: 'Port {#ZYXEL.IF.NAME}: Incoming traffic'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.2.2.1.10.{#SNMPINDEX}]'
              key: 'zyxel.ies1248.net.if.in.traffic[{#SNMPINDEX}]'
              units: bps
              description: |
                MIB: IF-MIB
                The total number of octets received on the interface,
                including framing characters.
              preprocessing:
                - type: MULTIPLIER
                  parameters:
                    - '8'
                - type: CHANGE_PER_SECOND
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: eeb4236d4ebe4cb396413f13d1fa669b
              name: 'Port {#SNMPINDEX}: Interface name'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.2.2.1.2.{#SNMPINDEX}]'
              key: 'zyxel.ies1248.net.if.name[{#SNMPINDEX}]'
              value_type: CHAR
              description: |
                MIB: IF-MIB
                A textual string containing information about the interface
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
            - uuid: cd0bbc3c587a47e6a2a2307343a377b7
              name: 'Port {#ZYXEL.IF.NAME}: Operational status'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.2.2.1.8.{#SNMPINDEX}]'
              key: 'zyxel.ies1248.net.if.operstatus[{#SNMPINDEX}]'
              description: |
                MIB: IF-MIB
                The current operational state of the interface.
                The testing(3) state indicates that no operational
                packets can be passed.
              valuemap:
                name: 'ZYXEL IES1248-51 port operational status'
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
              trigger_prototypes:
                - uuid: 8d90a989c82a4890a3a1a0b8eeb53462
                  expression: 'last(/ZYXEL IES1248-51 by SNMP/zyxel.ies1248.net.if.operstatus[{#SNMPINDEX}])=2 and last(/ZYXEL IES1248-51 by SNMP/zyxel.ies1248.net.if.operstatus[{#SNMPINDEX}],#1)<>last(/ZYXEL IES1248-51 by SNMP/zyxel.ies1248.net.if.operstatus[{#SNMPINDEX}],#2)'
                  recovery_mode: RECOVERY_EXPRESSION
                  recovery_expression: 'last(/ZYXEL IES1248-51 by SNMP/zyxel.ies1248.net.if.operstatus[{#SNMPINDEX}])<>2'
                  name: 'ZYXEL: Port {#ZYXEL.IF.NAME}: Link down'
                  opdata: 'Current state: {ITEM.LASTVALUE1}'
                  priority: AVERAGE
                  description: |
                    This trigger expression works as follows:
                    1. It can be triggered if the operations status is down.
                    2. `{$IFCONTROL:"{#IFNAME}"}=1` - a user can redefine context macro to value - 0. That marks this interface as not important. No new trigger will be fired if this interface is down.
                    3. `{TEMPLATE_NAME:METRIC.diff()}=1` - the trigger fires only if the operational status was up to (1) sometime before (so, do not fire for the 'eternal off' interfaces.)
                    
                    WARNING: if closed manually - it will not fire again on the next poll, because of .diff.
                  manual_close: 'YES'
                  tags:
                    - tag: scope
                      value: notice
            - uuid: 2e39a01f6315444cb3ae47836945b514
              name: 'Port {#ZYXEL.IF.NAME}: Outgoing traffic'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.2.1.31.1.1.1.10.{#SNMPINDEX}]'
              key: 'zyxel.ies1248.net.if.out.traffic[{#SNMPINDEX}]'
              units: bps
              description: |
                MIB: IF-MIB
                The total number of octets transmitted out of the
                interface, including framing characters.  This object is a
                64-bit version of ifOutOctets.
              preprocessing:
                - type: MULTIPLIER
                  parameters:
                    - '8'
                - type: CHANGE_PER_SECOND
              tags:
                - tag: component
                  value: network
                - tag: description
                  value: '{#ZYXEL.IF.NAME}'
                - tag: interface
                  value: '{#SNMPINDEX}'
          graph_prototypes:
            - uuid: 1988adb1e96b423a8df3c55ea2f63d47
              name: 'ZYXEL IES1248-51: Ethernet port {#SNMPINDEX}: Traffic'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'ZYXEL IES1248-51 by SNMP'
                    key: 'zyxel.ies1248.net.if.in.traffic[{#SNMPINDEX}]'
                - sortorder: '1'
                  color: F63100
                  item:
                    host: 'ZYXEL IES1248-51 by SNMP'
                    key: 'zyxel.ies1248.net.if.out.traffic[{#SNMPINDEX}]'
          overrides:
            - name: 'Trigger disabled'
              step: '1'
              filter:
                conditions:
                  - macro: '{#ZYXEL.IF.NAME}'
                    value: '.*'
              operations:
                - operationobject: TRIGGER_PROTOTYPE
                  operator: REGEXP
                  value: '.*'
                  discover: NO_DISCOVER
            - name: 'Trigger enabled'
              step: '2'
              filter:
                conditions:
                  - macro: '{#ZYXEL.IF.NAME}'
                    value: '{$ZYXEL.LLD.FILTER.IF.CONTROL.MATCHES}'
              operations:
                - operationobject: TRIGGER_PROTOTYPE
                  operator: REGEXP
                  value: '.*'
                  discover: DISCOVER
        - uuid: f8e1575174f9414e9ddf1459a420b2d6
          name: 'Temperature discovery'
          type: SNMP_AGENT
          snmp_oid: 'discovery[{#ZYXEL.TEMP.ID},1.3.6.1.4.1.890.1.5.13.1.2.3.1.1,{#ZYXEL.TEMP.THRESH.HIGH},1.3.6.1.4.1.890.1.5.13.1.2.3.1.5]'
          key: zyxel.ies1248.temp.discovery
          delay: 1h
          description: 'An entry in tempTable.'
          item_prototypes:
            - uuid: 3049c6b2d6024949bbb240c9104418e6
              name: 'Temperature "{#ZYXEL.TEMP.ID}"'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.4.1.890.1.5.13.1.2.3.1.2.{#SNMPINDEX}]'
              key: 'zyxel.ies1248.temp[{#SNMPINDEX}]'
              units: '!°C'
              description: |
                MIB: ZYXEL-IESCOMMON-MIB
                The current temperature measured at this sensor
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              tags:
                - tag: component
                  value: sensor
                - tag: component
                  value: temperature
              trigger_prototypes:
                - uuid: f0d7f5282c784224b0cd5f76d3c2ad90
                  expression: 'last(/ZYXEL IES1248-51 by SNMP/zyxel.ies1248.temp[{#SNMPINDEX}])>{#ZYXEL.TEMP.THRESH.HIGH}'
                  name: 'ZYXEL: Temperature {#ZYXEL.TEMP.ID} is in critical state'
                  opdata: 'Current state: {ITEM.LASTVALUE1}'
                  priority: AVERAGE
                  description: 'Please check the temperature'
                  tags:
                    - tag: scope
                      value: notice
          graph_prototypes:
            - uuid: a5ec11a8936746c492fcf2e4462c7ca7
              name: 'ZYXEL IES1248-51: "Temperature {#ZYXEL.TEMP.ID}'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'ZYXEL IES1248-51 by SNMP'
                    key: 'zyxel.ies1248.temp[{#SNMPINDEX}]'
        - uuid: a2df63bd07f24277acf36e7a3854bd81
          name: 'Voltage discovery'
          type: SNMP_AGENT
          snmp_oid: 'discovery[{#ZYXEL.VOLT.THRESH.LOW},1.3.6.1.4.1.890.1.5.13.1.2.2.1.6,{#ZYXEL.VOLT.NOMINAL},1.3.6.1.4.1.890.1.5.13.1.2.2.1.5]'
          key: zyxel.ies1248.volt.discovery
          delay: 1h
          description: 'An entry in voltageTable.'
          item_prototypes:
            - uuid: 747034dc53c34554ad141a70dd5905f0
              name: 'Nominal "{#ZYXEL.VOLT.NOMINAL}"'
              type: SNMP_AGENT
              snmp_oid: 'get[1.3.6.1.4.1.890.1.5.13.1.2.2.1.2.{#SNMPINDEX}]'
              key: 'zyxel.ies1248.volt[{#SNMPINDEX}]'
              value_type: FLOAT
              units: V
              description: |
                MIB: ZYXEL-IESCOMMON-MIB
                The current voltage reading.
              preprocessing:
                - type: MULTIPLIER
                  parameters:
                    - '0.001'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              tags:
                - tag: component
                  value: sensor
                - tag: component
                  value: voltage
              trigger_prototypes:
                - uuid: 9815420fe46c45ce8731b9688b4a543e
                  expression: 'last(/ZYXEL IES1248-51 by SNMP/zyxel.ies1248.volt[{#SNMPINDEX}])<{#ZYXEL.VOLT.THRESH.LOW}'
                  name: 'ZYXEL: Voltage {#ZYXEL.VOLT.NOMINAL} is in critical state'
                  opdata: 'Current state: {ITEM.LASTVALUE1}'
                  priority: AVERAGE
                  description: 'Please check the power supply'
                  tags:
                    - tag: scope
                      value: notice
          graph_prototypes:
            - uuid: ebbc2726558c4504aa6bd22844d0bc83
              name: 'ZYXEL IES1248-51: Nominal "{#ZYXEL.VOLT.NOMINAL}"'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'ZYXEL IES1248-51 by SNMP'
                    key: 'zyxel.ies1248.volt[{#SNMPINDEX}]'
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  var inArray = JSON.parse(value);
                  var outArr = []
                  inArray.forEach(function (item, i, arr) {
                  	item['{#ZYXEL.SLOT.ID}'] = item['{#SNMPINDEX}'].split('.')[1];
                  	item['{#ZYXEL.SENSOR.ID}'] = item['{#SNMPINDEX}'].split('.')[2];
                  	item["{#ZYXEL.VOLT.NOMINAL}"] = "+" + item["{#ZYXEL.VOLT.NOMINAL}"] / 1000 + "V";
                  	item["{#ZYXEL.VOLT.THRESH.LOW}"] /= 1000;
                  	item["{#ZYXEL.VOLT.THRESH.HIGH}"] /= 1000;
                  	outArr.push(item)
                  });
                  return JSON.stringify(outArr);
      tags:
        - tag: class
          value: network
        - tag: target
          value: aam1248-51
        - tag: target
          value: dslam
        - tag: target
          value: zyxel
      macros:
        - macro: '{$SNMP.TIMEOUT}'
          value: 5m
          description: 'The time interval for SNMP agent availability trigger expression.'
          config:
            type: TEXT
            priority: '2'
            section_name: Other
            label: 'Time interval'
            description: 'The time interval for SNMP agent availability trigger expression.'
        - macro: '{$ZYXEL.ADSL.ATN.MAX}'
          value: '40'
          description: 'Type the maximum signal attenuation'
          config:
            type: TEXT
            priority: '4'
            section_name: Thresholds
            label: 'Max signal attenuation'
            description: 'Type the maximum signal attenuation'
        - macro: '{$ZYXEL.ADSL.SNR.MIN}'
          value: '8'
          description: 'Type the minimum signal to noise margin (0-31 dB)'
          config:
            type: TEXT
            priority: '3'
            section_name: Thresholds
            label: 'Min signal-to-noise margin (0-31 dB)'
            description: 'Type the minimum signal to noise margin (0-31 dB)'
        - macro: '{$ZYXEL.LLD.FILTER.IF.CONTROL.MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'Triggers will be created only for interfaces whose description contains the value of this macro'
          config:
            type: TEXT
            priority: '1'
            section_name: Filters
            label: 'Filter for interface control (include)'
            description: 'Triggers will be created only for interfaces whose description contains the value of this macro'
        - macro: '{$ZYXEL.LLD.FILTER.IF.LINKSTATUS.MATCHES}'
          value: '.*'
          description: 'Filter of discoverable link types.'
          config:
            type: TEXT
            priority: '5'
            section_name: Filters
            label: 'Filter for interface link status (include)'
            description: 'Filter of discoverable link types.'
        - macro: '{$ZYXEL.LLD.FILTER.IF.LINKSTATUS.NOT_MATCHES}'
          value: '2'
          description: 'Filter to exclude discovered by link types.'
          config:
            type: TEXT
            priority: '6'
            section_name: Filters
            label: 'Filter for interface link status (exclude)'
            description: 'Filter to exclude discovered by link types.'
      dashboards:
        - uuid: aa5d1f3c1e8248eeb605bec4183d95ed
          name: 'Network interfaces'
          pages:
            - widgets:
                - type: graphprototype
                  width: '72'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'ZYXEL IES1248-51 by SNMP'
                        name: 'ZYXEL IES1248-51: Ethernet port {#SNMPINDEX}: Traffic'
                    - type: STRING
                      name: reference
                      value: AAAAA
                    - type: INTEGER
                      name: rows
                      value: '5'
      valuemaps:
        - uuid: 34ea860866f24498927b73f4ce438837
          name: 'SNMP available'
          mappings:
            - value: '0'
              newvalue: 'not available'
            - value: '1'
              newvalue: available
            - value: '2'
              newvalue: unknown
        - uuid: b933d3a98256457d906de8f7da377bac
          name: 'ZYXEL IES1248-51 port admin status'
          mappings:
            - value: '1'
              newvalue: Up
            - value: '2'
              newvalue: Down
            - value: '3'
              newvalue: Testing
        - uuid: e780cc91765849a0ace3d2eb2e4824a0
          name: 'ZYXEL IES1248-51 port operational status'
          mappings:
            - value: '1'
              newvalue: Up
            - value: '2'
              newvalue: Down
            - value: '3'
              newvalue: Testing
            - value: '4'
              newvalue: Unknown
            - value: '5'
              newvalue: Dormant
            - value: '6'
              newvalue: NotPresent
            - value: '7'
              newvalue: lowerLayerDown
  triggers:
    - uuid: 803947a6de9340ed8596510dcbbeacac
      expression: 'last(/ClickHouse by HTTP/clickhouse.ping)=0 or last(/ClickHouse by HTTP/net.tcp.service[{$CLICKHOUSE.SCHEME},"{$CLICKHOUSE.HOST}","{$CLICKHOUSE.PORT}"]) = 0'
      name: 'ClickHouse: Service is down'
      priority: AVERAGE
      manual_close: 'YES'
      dependencies:
        - name: 'ClickHouse: Port {$CLICKHOUSE.PORT} is unavailable'
          expression: 'last(/ClickHouse by HTTP/net.tcp.service[{$CLICKHOUSE.SCHEME},"{$CLICKHOUSE.HOST}","{$CLICKHOUSE.PORT}"])=0'
      tags:
        - tag: scope
          value: availability
    - uuid: 9e1a0b7f49844d1db525d00d5f1060f0
      expression: 'min(/HashiCorp Consul Node by HTTP/consul.process_open_fds,5m)/last(/HashiCorp Consul Node by HTTP/consul.process_max_fds)*100>{$CONSUL.OPEN.FDS.MAX.WARN}'
      name: 'HashiCorp Consul Node: Current number of open files is too high'
      event_name: 'HashiCorp Consul Node: Current number of open files is too high (over {$CONSUL.OPEN.FDS.MAX.WARN}% for 5m)'
      priority: WARNING
      description: '"Heavy file descriptor usage (i.e., near the process’s file descriptor limit) indicates a potential file descriptor exhaustion issue."'
      tags:
        - tag: scope
          value: capacity
    - uuid: fa21b02aebe143b192a20cd9403a68d0
      expression: 'last(/Linux by Zabbix agent active/proc.num)/last(/Linux by Zabbix agent active/kernel.maxproc)*100>80'
      name: 'Linux: Getting closer to process limit'
      event_name: 'Linux: Getting closer to process limit (over 80% used)'
      opdata: '{ITEM.LASTVALUE1} active, {ITEM.LASTVALUE2} limit.'
      priority: WARNING
      tags:
        - tag: scope
          value: performance
    - uuid: 722692e0703e4609852439a9b751826d
      expression: 'max(/Linux by Zabbix agent active/system.swap.size[,pfree],5m)<{$SWAP.PFREE.MIN.WARN} and last(/Linux by Zabbix agent active/system.swap.size[,total])>0'
      name: 'Linux: High swap space usage'
      event_name: 'Linux: High swap space usage (less than {$SWAP.PFREE.MIN.WARN}% free)'
      opdata: 'Free: {ITEM.LASTVALUE1}, total: {ITEM.LASTVALUE2}'
      priority: WARNING
      description: 'If there is no swap configured, this trigger is ignored.'
      dependencies:
        - name: 'Linux: High memory utilization'
          expression: 'min(/Linux by Zabbix agent active/vm.memory.utilization,5m)>{$MEMORY.UTIL.MAX}'
        - name: 'Linux: Lack of available memory'
          expression: 'max(/Linux by Zabbix agent active/vm.memory.size[available],5m)<{$MEMORY.AVAILABLE.MIN} and last(/Linux by Zabbix agent active/vm.memory.size[total])>0'
      tags:
        - tag: scope
          value: capacity
    - uuid: b3f51f3c63024d209fd01e17293127a6
      expression: 'max(/Linux by Zabbix agent active/vm.memory.size[available],5m)<{$MEMORY.AVAILABLE.MIN} and last(/Linux by Zabbix agent active/vm.memory.size[total])>0'
      name: 'Linux: Lack of available memory'
      event_name: 'Linux: Lack of available memory (<{$MEMORY.AVAILABLE.MIN} of {ITEM.VALUE2})'
      opdata: 'Available: {ITEM.LASTVALUE1}, total: {ITEM.LASTVALUE2}'
      priority: AVERAGE
      description: 'The system is running out of memory.'
      tags:
        - tag: scope
          value: capacity
        - tag: scope
          value: performance
    - uuid: 72825a0c706043429ed1ff6656763052
      expression: |
        min(/Linux by Zabbix agent active/system.cpu.load[all,avg1],5m)/last(/Linux by Zabbix agent active/system.cpu.num)>{$LOAD_AVG_PER_CPU.MAX.WARN}
        and last(/Linux by Zabbix agent active/system.cpu.load[all,avg5])>0
        and last(/Linux by Zabbix agent active/system.cpu.load[all,avg15])>0
      name: 'Linux: Load average is too high'
      event_name: 'Linux: Load average is too high (per CPU load over {$LOAD_AVG_PER_CPU.MAX.WARN} for 5m)'
      opdata: 'Load averages(1m 5m 15m): ({ITEM.LASTVALUE1} {ITEM.LASTVALUE3} {ITEM.LASTVALUE4}), # of CPUs: {ITEM.LASTVALUE2}'
      priority: AVERAGE
      description: 'The load average per CPU is too high. The system may be slow to respond.'
      tags:
        - tag: scope
          value: capacity
        - tag: scope
          value: performance
    - uuid: 667856dcaad04a108cb0a5150e825a50
      expression: |
        (last(/Mellanox by SNMP/system.hw.uptime[hrSystemUptime.0])>0 and last(/Mellanox by SNMP/system.hw.uptime[hrSystemUptime.0])<10m)
        or (last(/Mellanox by SNMP/system.hw.uptime[hrSystemUptime.0])=0 and last(/Mellanox by SNMP/system.net.uptime[sysUpTime.0])<10m)
      name: 'Mellanox: Host has been restarted'
      event_name: 'Mellanox: {HOST.NAME} has been restarted (uptime < 10m)'
      priority: WARNING
      description: 'Uptime is less than 10 minutes.'
      manual_close: 'YES'
      dependencies:
        - name: 'Mellanox: No SNMP data collection'
          expression: 'max(/Mellanox by SNMP/zabbix[host,snmp,available],{$SNMP.TIMEOUT})=0'
      tags:
        - tag: scope
          value: notice
    - uuid: 384393bb344e497382ea10e7fce7fcb3
      expression: 'min(/Windows by Zabbix agent active/perf_counter_en["\System\Processor Queue Length"],5m) - last(/Windows by Zabbix agent active/wmi.get[root/cimv2,"Select NumberOfLogicalProcessors from Win32_ComputerSystem"]) * 2 > {$CPU.QUEUE.CRIT.MAX}'
      name: 'Windows: CPU queue length is too high'
      event_name: 'Windows: CPU queue length is too high (over {$CPU.QUEUE.CRIT.MAX} for 5m)'
      priority: WARNING
      description: 'The CPU Queue Length in the last 5 minutes exceeds `{$CPU.QUEUE.CRIT.MAX}`. According to actual observations, PQL should not exceed the number of cores * 2. To fine-tune the conditions, use the macro `{$CPU.QUEUE.CRIT.MAX }`.'
      dependencies:
        - name: 'Windows: High CPU utilization'
          expression: 'min(/Windows by Zabbix agent active/system.cpu.util,5m)>{$CPU.UTIL.CRIT}'
      tags:
        - tag: scope
          value: performance
    - uuid: ac93631f79584e2d9909f4bb2f12c866
      expression: 'max(/Windows by Zabbix agent active/system.swap.pfree,5m)<{$SWAP.PFREE.MIN.WARN} and last(/Windows by Zabbix agent active/system.swap.size[,total])>0'
      name: 'Windows: High swap space usage'
      event_name: 'Windows: High swap space usage (less than {$SWAP.PFREE.MIN.WARN}% free)'
      opdata: 'Free: {ITEM.LASTVALUE1}, total: {ITEM.LASTVALUE2}'
      priority: WARNING
      description: 'This trigger is ignored, if there is no swap configured'
      dependencies:
        - name: 'Windows: High memory utilization'
          expression: 'min(/Windows by Zabbix agent active/vm.memory.util,5m)>{$MEMORY.UTIL.MAX}'
      tags:
        - tag: scope
          value: performance
    - uuid: d618295a763f42cd9063fad5cd600c34
      expression: '(last(/ZYXEL IES-500x by SNMP/zyxel.ies500x.hw.uptime)>0 and last(/ZYXEL IES-500x by SNMP/zyxel.ies500x.hw.uptime)<10m) or (last(/ZYXEL IES-500x by SNMP/zyxel.ies500x.hw.uptime)=0 and last(/ZYXEL IES-500x by SNMP/zyxel.ies500x.net.uptime)<10m)'
      name: 'ZYXEL: Host has been restarted'
      event_name: 'ZYXEL: {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: 7a52520cc3dc4350bd7aa14260899f1c
      expression: '(last(/ZYXEL IES-6000 by SNMP/zyxel.ies6000.hw.uptime)>0 and last(/ZYXEL IES-6000 by SNMP/zyxel.ies6000.hw.uptime)<10m) or (last(/ZYXEL IES-6000 by SNMP/zyxel.ies6000.hw.uptime)=0 and last(/ZYXEL IES-6000 by SNMP/zyxel.ies6000.net.uptime)<10m)'
      name: 'ZYXEL: Host has been restarted'
      event_name: 'ZYXEL: {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: bbccceac3dc24b9ab76a820fe5be4788
      expression: '(last(/ZYXEL IES1248-51 by SNMP/zyxel.ies1248.hw.uptime)>0 and last(/ZYXEL IES1248-51 by SNMP/zyxel.ies1248.hw.uptime)<10m) or (last(/ZYXEL IES1248-51 by SNMP/zyxel.ies1248.hw.uptime)=0 and last(/ZYXEL IES1248-51 by SNMP/zyxel.ies1248.net.uptime)<10m)'
      name: 'ZYXEL: Host has been restarted'
      event_name: 'ZYXEL: {HOST.NAME} has been restarted (uptime < 10m)'
      priority: INFO
      description: 'Uptime is less than 10 minutes.'
      manual_close: 'YES'
      tags:
        - tag: scope
          value: notice
  graphs:
    - uuid: fc2f8de59c874876addb08ec633338d4
      name: 'ClickHouse: Current activity'
      graph_items:
        - drawtype: BOLD_LINE
          color: 199C0D
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.query.current
        - sortorder: '1'
          drawtype: BOLD_LINE
          color: F63100
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.merge.current
    - uuid: b1b66d510e424965b7e82b902e0f2e58
      name: 'ClickHouse: Current connections'
      graph_items:
        - drawtype: BOLD_LINE
          color: 199C0D
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.connections.tcp
        - sortorder: '1'
          drawtype: BOLD_LINE
          color: F63100
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.connections.http
        - sortorder: '2'
          drawtype: BOLD_LINE
          color: 00611C
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.connections.mysql
        - sortorder: '3'
          drawtype: BOLD_LINE
          color: F7941D
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.connections.interserver
        - sortorder: '4'
          drawtype: BOLD_LINE
          color: FC6EA3
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.connections.distribute
    - uuid: 59935d9f612f468b97288d9a0dc62b26
      name: 'ClickHouse: Distributed'
      graph_items:
        - color: 199C0D
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.distributed.files.retry.rate
        - sortorder: '1'
          color: F63100
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.distributed.files.fail.rate
        - sortorder: '2'
          drawtype: BOLD_LINE
          color: 00611C
          yaxisside: RIGHT
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.distributed.files
    - uuid: edd18c769edd442cba00adf97ae4192a
      name: 'ClickHouse: Insert/Merge bytes rate'
      graph_items:
        - drawtype: BOLD_LINE
          color: 199C0D
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.inserted_bytes.rate
        - sortorder: '1'
          drawtype: BOLD_LINE
          color: F63100
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.merge_bytes.rate
    - uuid: 0fd813049e7449b69366021ffa0d3ec7
      name: 'ClickHouse: Insert/Merge rows rate'
      graph_items:
        - drawtype: BOLD_LINE
          color: 199C0D
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.inserted_rows.rate
        - sortorder: '1'
          drawtype: BOLD_LINE
          color: F63100
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.merge_rows.rate
    - uuid: 5a688818d4fa44f687aa8415abddc7c0
      name: 'ClickHouse: Memory Usage'
      graph_items:
        - color: 199C0D
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.memory.tracking.merges
        - sortorder: '1'
          color: F63100
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.memory.tracking.schedule.pool
        - sortorder: '2'
          color: 00611C
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.memory.tracking.background.moves
        - sortorder: '3'
          color: F7941D
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.memory.tracking.background
        - sortorder: '4'
          color: FC6EA3
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.memory.tracking
    - uuid: ba22cf13ef6f46299651d15fb860016d
      name: 'ClickHouse: Memory Utilization'
      graph_items:
        - drawtype: GRADIENT_LINE
          color: 199C0D
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.jemalloc.allocated
        - sortorder: '1'
          drawtype: GRADIENT_LINE
          color: F63100
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.jemalloc.resident
        - sortorder: '2'
          drawtype: GRADIENT_LINE
          color: 00611C
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.jemalloc.mapped
    - uuid: 9593c61ecdfa4c83ab9421ed85a82f36
      name: 'ClickHouse: Queries rate'
      graph_items:
        - drawtype: BOLD_LINE
          color: 199C0D
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.query.rate
        - sortorder: '1'
          drawtype: BOLD_LINE
          color: F63100
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.select_query.rate
        - sortorder: '2'
          drawtype: BOLD_LINE
          color: 00611C
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.insert_query.rate
    - uuid: eaa80cf006e84d26903cf1004a268a31
      name: 'ClickHouse: Syscalls in fly'
      graph_items:
        - drawtype: BOLD_LINE
          color: 199C0D
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.read
        - sortorder: '1'
          drawtype: BOLD_LINE
          color: F63100
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.write
    - uuid: eda00404a372434ea4f511c219bf3295
      name: 'ClickHouse: Uptime'
      graph_items:
        - color: 199C0D
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.uptime
    - uuid: c90d0b21105e42bd9f4399d77ba0a81a
      name: 'ClickHouse: Zookeeper exceptions rate'
      graph_items:
        - color: 199C0D
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.zookeeper.exceptions.rate
        - sortorder: '1'
          color: F63100
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.zookeeper.hw_exceptions.rate
        - sortorder: '2'
          color: 00611C
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.zookeeper.user_exceptions.rate
        - sortorder: '3'
          drawtype: BOLD_LINE
          color: F7941D
          yaxisside: RIGHT
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.zookeeper.watch
    - uuid: 2411147c0f4a425394a64fcd3dc231f0
      name: 'Consul: Catalog operations'
      graph_items:
        - color: 199C0D
          item:
            host: 'HashiCorp Consul Node by HTTP'
            key: consul.catalog.register.rate
        - sortorder: '1'
          color: F63100
          item:
            host: 'HashiCorp Consul Node by HTTP'
            key: consul.catalog.deregister.rate
    - uuid: 929c2527abaf447f9909003e6a43d799
      name: 'Consul: File descriptors'
      graph_items:
        - drawtype: GRADIENT_LINE
          color: 199C0D
          item:
            host: 'HashiCorp Consul Node by HTTP'
            key: consul.process_open_fds
        - sortorder: '1'
          drawtype: BOLD_LINE
          color: F63100
          item:
            host: 'HashiCorp Consul Node by HTTP'
            key: consul.process_max_fds
    - uuid: 6a987c1499f145ff8b68281f4fef3424
      name: 'Consul: Memory usage'
      graph_items:
        - color: 199C0D
          item:
            host: 'HashiCorp Consul Node by HTTP'
            key: consul.virtual_memory_bytes
        - sortorder: '1'
          color: F63100
          item:
            host: 'HashiCorp Consul Node by HTTP'
            key: consul.resident_memory_bytes
    - uuid: ba792478fe3140709a06a852560307fd
      name: 'Consul: Serf member operations'
      graph_items:
        - color: 199C0D
          item:
            host: 'HashiCorp Consul Node by HTTP'
            key: consul.serf.member.update.rate
        - sortorder: '1'
          color: F63100
          item:
            host: 'HashiCorp Consul Node by HTTP'
            key: consul.serf.member.left.rate
        - sortorder: '2'
          color: 00611C
          item:
            host: 'HashiCorp Consul Node by HTTP'
            key: consul.serf.member.join.rate
        - sortorder: '3'
          color: F7941D
          item:
            host: 'HashiCorp Consul Node by HTTP'
            key: consul.serf.member.failed.rate
        - sortorder: '4'
          color: FC6EA3
          item:
            host: 'HashiCorp Consul Node by HTTP'
            key: consul.serf.member.flap.rate
    - uuid: 2e4890b0db694721b1e903ecf01c612c
      name: 'Linux: CPU jumps'
      graph_items:
        - color: 199C0D
          item:
            host: 'Linux by Zabbix agent active'
            key: system.cpu.switches
        - sortorder: '1'
          color: F63100
          item:
            host: 'Linux by Zabbix agent active'
            key: system.cpu.intr
    - uuid: 27b4612871004ca282f7d91057150800
      name: 'Linux: CPU usage'
      type: STACKED
      ymin_type_1: FIXED
      ymax_type_1: FIXED
      graph_items:
        - color: 199C0D
          item:
            host: 'Linux by Zabbix agent active'
            key: 'system.cpu.util[,system]'
        - sortorder: '1'
          color: F63100
          item:
            host: 'Linux by Zabbix agent active'
            key: 'system.cpu.util[,user]'
        - sortorder: '2'
          color: 00611C
          item:
            host: 'Linux by Zabbix agent active'
            key: 'system.cpu.util[,nice]'
        - sortorder: '3'
          color: F7941D
          item:
            host: 'Linux by Zabbix agent active'
            key: 'system.cpu.util[,iowait]'
        - sortorder: '4'
          color: FC6EA3
          item:
            host: 'Linux by Zabbix agent active'
            key: 'system.cpu.util[,steal]'
        - sortorder: '5'
          color: 6C59DC
          item:
            host: 'Linux by Zabbix agent active'
            key: 'system.cpu.util[,interrupt]'
        - sortorder: '6'
          color: C7A72D
          item:
            host: 'Linux by Zabbix agent active'
            key: 'system.cpu.util[,softirq]'
        - sortorder: '7'
          color: BA2A5D
          item:
            host: 'Linux by Zabbix agent active'
            key: 'system.cpu.util[,guest]'
        - sortorder: '8'
          color: F230E0
          item:
            host: 'Linux by Zabbix agent active'
            key: 'system.cpu.util[,guest_nice]'
    - uuid: 3bebe4d0071441f4b95170fd0278a4dd
      name: 'Linux: CPU utilization'
      ymin_type_1: FIXED
      ymax_type_1: FIXED
      graph_items:
        - drawtype: GRADIENT_LINE
          color: 199C0D
          item:
            host: 'Linux by Zabbix agent active'
            key: system.cpu.util
    - uuid: a4d67a1cd253431faaedf888dad90e72
      name: 'Linux: Memory usage'
      ymin_type_1: FIXED
      graph_items:
        - drawtype: BOLD_LINE
          color: 199C0D
          item:
            host: 'Linux by Zabbix agent active'
            key: 'vm.memory.size[total]'
        - sortorder: '1'
          drawtype: GRADIENT_LINE
          color: F63100
          item:
            host: 'Linux by Zabbix agent active'
            key: 'vm.memory.size[available]'
    - uuid: 4aaf22daf96b4b29ad3a2e935f4e2d4c
      name: 'Linux: Memory utilization'
      ymin_type_1: FIXED
      ymax_type_1: FIXED
      graph_items:
        - drawtype: GRADIENT_LINE
          color: 199C0D
          item:
            host: 'Linux by Zabbix agent active'
            key: vm.memory.utilization
    - uuid: 60078a7b24494a41a3595650b113ee1d
      name: 'Linux: Processes'
      graph_items:
        - color: 199C0D
          item:
            host: 'Linux by Zabbix agent active'
            key: proc.num
        - sortorder: '1'
          color: F63100
          item:
            host: 'Linux by Zabbix agent active'
            key: 'proc.num[,,run]'
    - uuid: a70c0c13381a4fb68eaeb66226ffe2bb
      name: 'Linux: Swap usage'
      graph_items:
        - color: 199C0D
          item:
            host: 'Linux by Zabbix agent active'
            key: 'system.swap.size[,free]'
        - sortorder: '1'
          color: F63100
          item:
            host: 'Linux by Zabbix agent active'
            key: 'system.swap.size[,total]'
    - uuid: d47109e977ec4362a3f3bb5e7708b48a
      name: 'Linux: System load'
      ymin_type_1: FIXED
      graph_items:
        - color: 199C0D
          item:
            host: 'Linux by Zabbix agent active'
            key: 'system.cpu.load[all,avg1]'
        - sortorder: '1'
          color: F63100
          item:
            host: 'Linux by Zabbix agent active'
            key: 'system.cpu.load[all,avg5]'
        - sortorder: '2'
          color: 00611C
          item:
            host: 'Linux by Zabbix agent active'
            key: 'system.cpu.load[all,avg15]'
        - sortorder: '3'
          color: F7941D
          yaxisside: RIGHT
          item:
            host: 'Linux by Zabbix agent active'
            key: system.cpu.num
    - uuid: 89bf34a1c3db423caa4fbeae774fa9cf
      name: 'Mellanox: CPU utilization'
      ymin_type_1: FIXED
      ymax_type_1: FIXED
      graph_items:
        - drawtype: GRADIENT_LINE
          color: 199C0D
          item:
            host: 'Mellanox by SNMP'
            key: system.cpu.util
    - uuid: 0f8ec9f5313348bfbe3b11836f6011d6
      name: 'PostgreSQL bgwriter'
      ymin_type_1: FIXED
      graph_items:
        - color: 199C0D
          yaxisside: RIGHT
          item:
            host: 'PostgreSQL by Zabbix agent active'
            key: pgsql.bgwriter.buffers_alloc.rate
        - sortorder: '1'
          color: F63100
          yaxisside: RIGHT
          item:
            host: 'PostgreSQL by Zabbix agent active'
            key: pgsql.bgwriter.buffers_clean.rate
        - sortorder: '2'
          color: 00611C
          yaxisside: RIGHT
          item:
            host: 'PostgreSQL by Zabbix agent active'
            key: pgsql.bgwriter.buffers_backend.rate
        - sortorder: '3'
          color: F7941D
          yaxisside: RIGHT
          item:
            host: 'PostgreSQL by Zabbix agent active'
            key: pgsql.bgwriter.buffers_checkpoint.rate
        - sortorder: '4'
          color: FC6EA3
          item:
            host: 'PostgreSQL by Zabbix agent active'
            key: pgsql.bgwriter.maxwritten_clean.rate
        - sortorder: '5'
          color: 6C59DC
          item:
            host: 'PostgreSQL by Zabbix agent active'
            key: pgsql.bgwriter.buffers_backend_fsync.rate
    - uuid: c15a7590e6594541acb6327852af11fa
      name: 'PostgreSQL checkpoints'
      ymin_type_1: FIXED
      graph_items:
        - color: 199C0D
          item:
            host: 'PostgreSQL by Zabbix agent active'
            key: pgsql.bgwriter.checkpoints_timed.rate
        - sortorder: '1'
          color: F63100
          item:
            host: 'PostgreSQL by Zabbix agent active'
            key: pgsql.bgwriter.checkpoints_req.rate
        - sortorder: '2'
          color: 00611C
          yaxisside: RIGHT
          item:
            host: 'PostgreSQL by Zabbix agent active'
            key: pgsql.bgwriter.checkpoint_sync_time.rate
        - sortorder: '3'
          color: F7941D
          yaxisside: RIGHT
          item:
            host: 'PostgreSQL by Zabbix agent active'
            key: pgsql.bgwriter.checkpoint_write_time.rate
    - uuid: 6748cbe523f44028bc84899cf3c68881
      name: 'PostgreSQL connections'
      ymin_type_1: FIXED
      graph_items:
        - drawtype: GRADIENT_LINE
          color: 199C0D
          yaxisside: RIGHT
          item:
            host: 'PostgreSQL by Zabbix agent active'
            key: pgsql.connections.sum.total
        - sortorder: '1'
          color: F63100
          item:
            host: 'PostgreSQL by Zabbix agent active'
            key: pgsql.connections.sum.total_pct
        - sortorder: '2'
          color: 00611C
          yaxisside: RIGHT
          item:
            host: 'PostgreSQL by Zabbix agent active'
            key: pgsql.connections.sum.active
        - sortorder: '3'
          color: F7941D
          yaxisside: RIGHT
          item:
            host: 'PostgreSQL by Zabbix agent active'
            key: pgsql.connections.sum.idle
        - sortorder: '4'
          color: FC6EA3
          yaxisside: RIGHT
          item:
            host: 'PostgreSQL by Zabbix agent active'
            key: pgsql.connections.sum.idle_in_transaction
        - sortorder: '5'
          color: 6C59DC
          yaxisside: RIGHT
          item:
            host: 'PostgreSQL by Zabbix agent active'
            key: pgsql.connections.sum.prepared
        - sortorder: '6'
          color: C7A72D
          yaxisside: RIGHT
          item:
            host: 'PostgreSQL by Zabbix agent active'
            key: pgsql.connections.sum.waiting
    - uuid: 5705f8c49a6343b39e4a1a574f14b16d
      name: 'PostgreSQL ping'
      ymin_type_1: FIXED
      graph_items:
        - drawtype: GRADIENT_LINE
          color: 199C0D
          item:
            host: 'PostgreSQL by Zabbix agent active'
            key: 'pgsql.ping["{$PG.HOST}","{$PG.PORT}"]'
        - sortorder: '1'
          color: F63100
          yaxisside: RIGHT
          item:
            host: 'PostgreSQL by Zabbix agent active'
            key: 'pgsql.ping.time["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
    - uuid: 8687fc6723b8477ba4c909b4d348303c
      name: 'PostgreSQL replication lag'
      ymin_type_1: FIXED
      graph_items:
        - color: 199C0D
          item:
            host: 'PostgreSQL by Zabbix agent active'
            key: 'pgsql.replication.lag.sec["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
    - uuid: 245d91951a8048d1ad091cdcacb5bbeb
      name: 'PostgreSQL transactions'
      ymin_type_1: FIXED
      graph_items:
        - color: 199C0D
          yaxisside: RIGHT
          item:
            host: 'PostgreSQL by Zabbix agent active'
            key: pgsql.transactions.active
        - sortorder: '1'
          color: F63100
          yaxisside: RIGHT
          item:
            host: 'PostgreSQL by Zabbix agent active'
            key: pgsql.transactions.idle
        - sortorder: '2'
          color: 00611C
          yaxisside: RIGHT
          item:
            host: 'PostgreSQL by Zabbix agent active'
            key: pgsql.transactions.prepared
        - sortorder: '3'
          color: F7941D
          yaxisside: RIGHT
          item:
            host: 'PostgreSQL by Zabbix agent active'
            key: pgsql.transactions.waiting
    - uuid: dc9cd08e1f6a4e3594eef539b3d00df9
      name: 'PostgreSQL uptime'
      show_triggers: 'NO'
      ymin_type_1: FIXED
      graph_items:
        - color: 199C0D
          item:
            host: 'PostgreSQL by Zabbix agent active'
            key: 'pgsql.uptime["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
        - sortorder: '1'
          color: F63100
          yaxisside: RIGHT
          item:
            host: 'PostgreSQL by Zabbix agent active'
            key: 'pgsql.cache.hit["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]'
    - uuid: 1fd6ffdc171146d6b05d9891ab56312c
      name: 'PostgreSQL WAL'
      ymin_type_1: FIXED
      graph_items:
        - color: 199C0D
          item:
            host: 'PostgreSQL by Zabbix agent active'
            key: pgsql.wal.write
        - sortorder: '1'
          color: F63100
          yaxisside: RIGHT
          item:
            host: 'PostgreSQL by Zabbix agent active'
            key: pgsql.wal.count
    - uuid: 133a9930f45b448abbf35fe3a00d10c6
      name: 'Windows: CPU jumps'
      graph_items:
        - color: 199C0D
          item:
            host: 'Windows by Zabbix agent active'
            key: 'perf_counter_en["\System\Context Switches/sec"]'
        - sortorder: '1'
          color: F63100
          item:
            host: 'Windows by Zabbix agent active'
            key: 'perf_counter_en["\Processor Information(_total)\% Interrupt Time"]'
    - uuid: 2a650f6de7804835a9a02db021649fca
      name: 'Windows: CPU usage'
      type: STACKED
      ymin_type_1: FIXED
      ymax_type_1: FIXED
      graph_items:
        - color: 199C0D
          item:
            host: 'Windows by Zabbix agent active'
            key: 'perf_counter_en["\Processor Information(_total)\% User Time"]'
        - sortorder: '1'
          color: F63100
          item:
            host: 'Windows by Zabbix agent active'
            key: 'perf_counter_en["\Processor Information(_total)\% Privileged Time"]'
    - uuid: 0865f60b2cd845aea2f2daad93c3bf83
      name: 'Windows: CPU utilization'
      ymin_type_1: FIXED
      ymax_type_1: FIXED
      graph_items:
        - drawtype: GRADIENT_LINE
          color: 199C0D
          item:
            host: 'Windows by Zabbix agent active'
            key: system.cpu.util
    - uuid: f09c95d4637140c89a7b43165906db96
      name: 'Windows: Memory utilization'
      ymin_type_1: FIXED
      ymax_type_1: FIXED
      graph_items:
        - drawtype: GRADIENT_LINE
          color: 199C0D
          item:
            host: 'Windows by Zabbix agent active'
            key: vm.memory.util
    - uuid: 441075d89a7045c283a7da9dd74e2a1b
      name: 'Windows: Swap usage'
      graph_items:
        - color: 199C0D
          item:
            host: 'Windows by Zabbix agent active'
            key: system.swap.free
        - sortorder: '1'
          color: F63100
          item:
            host: 'Windows by Zabbix agent active'
            key: 'system.swap.size[,total]'
