zabbix_export:
  version: '7.0'
  template_groups:
    - uuid: 3d21850851714ca29b7d5e53ade5ed51
      name: Templates/Applications
  templates:
    - uuid: d1772446ba2e4ab388b4986044c65283
      template: 'Angie by Zabbix agent'
      name: 'Angie by Zabbix agent'
      description: |
        Get metrics from stub status module using Zabbix agent running on Linux
        https://angie.software/angie/docs/configuration/modules/http/http_stub_status/
        
        You can discuss this template or leave feedback on our forum https://www.zabbix.com/forum/zabbix-suggestions-and-feedback/384765-discussion-thread-for-official-zabbix-template-nginx
        
        Generated by official Zabbix template tool "Templator" 2.0.0
      groups:
        - name: Templates/Applications
      items:
        - uuid: 277f7802b7924f858da4315819879a00
          name: 'Angie: Connections accepted per second'
          type: DEPENDENT
          key: angie.connections.accepted.rate
          delay: '0'
          history: 7d
          value_type: FLOAT
          description: 'The total number of accepted client connections.'
          preprocessing:
            - type: REGEX
              parameters:
                - 'server accepts handled requests\s+([0-9]+) ([0-9]+) ([0-9]+)'
                - \1
            - type: CHANGE_PER_SECOND
              parameters:
                - ''
          master_item:
            key: 'web.page.get["{$ANGIE.STUB_STATUS.HOST}","{$ANGIE.STUB_STATUS.PATH}","{$ANGIE.STUB_STATUS.PORT}"]'
          tags:
            - tag: component
              value: connections
        - uuid: 894160c7247e46b1b7131367215a3280
          name: 'Angie: Connections active'
          type: DEPENDENT
          key: angie.connections.active
          delay: '0'
          history: 7d
          description: 'The current number of active client connections including waiting connections.'
          preprocessing:
            - type: REGEX
              parameters:
                - 'Active connections: ([0-9]+)'
                - \1
          master_item:
            key: 'web.page.get["{$ANGIE.STUB_STATUS.HOST}","{$ANGIE.STUB_STATUS.PATH}","{$ANGIE.STUB_STATUS.PORT}"]'
          tags:
            - tag: component
              value: connections
        - uuid: f7c9b5b6a5eb49ea9ad3a2846267ccb3
          name: 'Angie: Connections dropped per second'
          type: DEPENDENT
          key: angie.connections.dropped.rate
          delay: '0'
          history: 7d
          value_type: FLOAT
          description: 'The total number of dropped client connections.'
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  var a = value.match(/server accepts handled requests\s+([0-9]+) ([0-9]+) ([0-9]+)/)
                  if (a) {
                      return a[1]-a[2]
                  }
            - type: CHANGE_PER_SECOND
              parameters:
                - ''
          master_item:
            key: 'web.page.get["{$ANGIE.STUB_STATUS.HOST}","{$ANGIE.STUB_STATUS.PATH}","{$ANGIE.STUB_STATUS.PORT}"]'
          tags:
            - tag: component
              value: connections
          triggers:
            - uuid: 027b69766a9e45aa8085f00a8e7a792c
              expression: 'min(/Angie by Zabbix agent/angie.connections.dropped.rate,5m) > {$ANGIE.DROP_RATE.MAX.WARN}'
              name: 'Angie: High connections drop rate'
              event_name: 'Angie: High connections drop rate (more than {$ANGIE.DROP_RATE.MAX.WARN} for 5m)'
              opdata: 'Current rate: {ITEM.LASTVALUE1}'
              priority: WARNING
              description: 'The rate of dropping connections has been greater than {$ANGIE.DROP_RATE.MAX.WARN} for the last 5 minutes.'
              dependencies:
                - name: 'Angie: Process is not running'
                  expression: 'last(/Angie by Zabbix agent/proc.num[{$ANGIE.PROC_NAME}])=0'
                - name: 'Angie: Service is down'
                  expression: 'last(/Angie by Zabbix agent/net.tcp.service[http,"{$ANGIE.STUB_STATUS.HOST}","{$ANGIE.STUB_STATUS.PORT}"])=0'
              tags:
                - tag: scope
                  value: performance
        - uuid: 3e7ecc29782f4001948e98c319e156c1
          name: 'Angie: Connections handled per second'
          type: DEPENDENT
          key: angie.connections.handled.rate
          delay: '0'
          history: 7d
          value_type: FLOAT
          description: 'The total number of handled connections. Generally, the parameter value is the same as for the accepted connections, unless some resource limits have been reached (for example, the `worker_connections limit`).'
          preprocessing:
            - type: REGEX
              parameters:
                - 'server accepts handled requests\s+([0-9]+) ([0-9]+) ([0-9]+)'
                - \2
            - type: CHANGE_PER_SECOND
              parameters:
                - ''
          master_item:
            key: 'web.page.get["{$ANGIE.STUB_STATUS.HOST}","{$ANGIE.STUB_STATUS.PATH}","{$ANGIE.STUB_STATUS.PORT}"]'
          tags:
            - tag: component
              value: connections
        - uuid: 55523dab77004ec59836d14273b6ad39
          name: 'Angie: Connections reading'
          type: DEPENDENT
          key: angie.connections.reading
          delay: '0'
          history: 7d
          description: 'The current number of connections where Angie is reading the request header.'
          preprocessing:
            - type: REGEX
              parameters:
                - 'Reading: ([0-9]+) Writing: ([0-9]+) Waiting: ([0-9]+)'
                - \1
          master_item:
            key: 'web.page.get["{$ANGIE.STUB_STATUS.HOST}","{$ANGIE.STUB_STATUS.PATH}","{$ANGIE.STUB_STATUS.PORT}"]'
          tags:
            - tag: component
              value: connections
        - uuid: d1d30c4402fc419285a780d96af903ad
          name: 'Angie: Connections waiting'
          type: DEPENDENT
          key: angie.connections.waiting
          delay: '0'
          history: 7d
          description: 'The current number of idle client connections waiting for a request.'
          preprocessing:
            - type: REGEX
              parameters:
                - 'Reading: ([0-9]+) Writing: ([0-9]+) Waiting: ([0-9]+)'
                - \3
          master_item:
            key: 'web.page.get["{$ANGIE.STUB_STATUS.HOST}","{$ANGIE.STUB_STATUS.PATH}","{$ANGIE.STUB_STATUS.PORT}"]'
          tags:
            - tag: component
              value: connections
        - uuid: 30bca713880f4fb491aabf0d1fac171b
          name: 'Angie: Connections writing'
          type: DEPENDENT
          key: angie.connections.writing
          delay: '0'
          history: 7d
          description: 'The current number of connections where Angie is writing a response back to the client.'
          preprocessing:
            - type: REGEX
              parameters:
                - 'Reading: ([0-9]+) Writing: ([0-9]+) Waiting: ([0-9]+)'
                - \2
          master_item:
            key: 'web.page.get["{$ANGIE.STUB_STATUS.HOST}","{$ANGIE.STUB_STATUS.PATH}","{$ANGIE.STUB_STATUS.PORT}"]'
          tags:
            - tag: component
              value: connections
        - uuid: f1584cc3ec7a4daea83c1682edacb85e
          name: 'Angie: Requests total'
          type: DEPENDENT
          key: angie.requests.total
          delay: '0'
          history: 7d
          description: 'The total number of client requests.'
          preprocessing:
            - type: REGEX
              parameters:
                - 'server accepts handled requests\s+([0-9]+) ([0-9]+) ([0-9]+)'
                - \3
          master_item:
            key: 'web.page.get["{$ANGIE.STUB_STATUS.HOST}","{$ANGIE.STUB_STATUS.PATH}","{$ANGIE.STUB_STATUS.PORT}"]'
          tags:
            - tag: component
              value: requests
        - uuid: 2cc321a639df41f0b8e421c2e87a5c04
          name: 'Angie: Requests per second'
          type: DEPENDENT
          key: angie.requests.total.rate
          delay: '0'
          history: 7d
          value_type: FLOAT
          description: 'The total number of client requests.'
          preprocessing:
            - type: REGEX
              parameters:
                - 'server accepts handled requests\s+([0-9]+) ([0-9]+) ([0-9]+)'
                - \3
            - type: CHANGE_PER_SECOND
              parameters:
                - ''
          master_item:
            key: 'web.page.get["{$ANGIE.STUB_STATUS.HOST}","{$ANGIE.STUB_STATUS.PATH}","{$ANGIE.STUB_STATUS.PORT}"]'
          tags:
            - tag: component
              value: requests
        - uuid: f147fa62ece140368f2b39f89548aab1
          name: 'Angie: Version'
          type: DEPENDENT
          key: angie.version
          delay: '0'
          history: 7d
          value_type: CHAR
          trends: '0'
          preprocessing:
            - type: REGEX
              parameters:
                - 'Server: [Aa][Nn][Gg][Ii][Ee]\/(.+(?<!\r))'
                - \1
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1d
          master_item:
            key: 'web.page.get["{$ANGIE.STUB_STATUS.HOST}","{$ANGIE.STUB_STATUS.PATH}","{$ANGIE.STUB_STATUS.PORT}"]'
          tags:
            - tag: component
              value: application
          triggers:
            - uuid: 5d123d5c074b42b99ad34667b3db6437
              expression: 'last(/Angie by Zabbix agent/angie.version,#1)<>last(/Angie by Zabbix agent/angie.version,#2) and length(last(/Angie by Zabbix agent/angie.version))>0'
              name: 'Angie: Version has changed'
              event_name: 'Angie: Version has changed (new version: {ITEM.VALUE})'
              priority: INFO
              description: 'The Angie version has changed. Acknowledge to close the problem manually.'
              manual_close: 'YES'
              tags:
                - tag: scope
                  value: notice
        - uuid: 3764b4089f324662a98d330856d1b53e
          name: 'Angie: Service response time'
          key: 'net.tcp.service.perf[http,"{$ANGIE.STUB_STATUS.HOST}","{$ANGIE.STUB_STATUS.PORT}"]'
          history: 7d
          value_type: FLOAT
          units: s
          tags:
            - tag: component
              value: application
            - tag: component
              value: health
          triggers:
            - uuid: 4396aaeb572b4462a9e1388e115682e1
              expression: 'min(/Angie by Zabbix agent/net.tcp.service.perf[http,"{$ANGIE.STUB_STATUS.HOST}","{$ANGIE.STUB_STATUS.PORT}"],5m)>{$ANGIE.RESPONSE_TIME.MAX.WARN}'
              name: 'Angie: Service response time is too high'
              event_name: 'Angie: Service response time is too high (over {$ANGIE.RESPONSE_TIME.MAX.WARN}s for 5m)'
              priority: WARNING
              manual_close: 'YES'
              dependencies:
                - name: 'Angie: Process is not running'
                  expression: 'last(/Angie by Zabbix agent/proc.num[{$ANGIE.PROC_NAME}])=0'
                - name: 'Angie: Service is down'
                  expression: 'last(/Angie by Zabbix agent/net.tcp.service[http,"{$ANGIE.STUB_STATUS.HOST}","{$ANGIE.STUB_STATUS.PORT}"])=0'
              tags:
                - tag: scope
                  value: performance
        - uuid: 76e419b215dc4fdfb11453b686296adc
          name: 'Angie: Service status'
          key: 'net.tcp.service[http,"{$ANGIE.STUB_STATUS.HOST}","{$ANGIE.STUB_STATUS.PORT}"]'
          history: 7d
          valuemap:
            name: 'Service state'
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 10m
          tags:
            - tag: component
              value: application
            - tag: component
              value: health
          triggers:
            - uuid: a8e754badb2d4be9b90cc8b28671e57e
              expression: 'last(/Angie by Zabbix agent/net.tcp.service[http,"{$ANGIE.STUB_STATUS.HOST}","{$ANGIE.STUB_STATUS.PORT}"])=0'
              name: 'Angie: Service is down'
              priority: AVERAGE
              manual_close: 'YES'
              dependencies:
                - name: 'Angie: Process is not running'
                  expression: 'last(/Angie by Zabbix agent/proc.num[{$ANGIE.PROC_NAME}])=0'
              tags:
                - tag: scope
                  value: availability
        - uuid: 2a091bce0d8c4667b6ffda63f0a2d547
          name: 'Angie: CPU utilization'
          key: 'proc.cpu.util[{$ANGIE.PROC_NAME}]'
          history: 7d
          value_type: FLOAT
          units: '%'
          description: 'Process CPU utilization percentage.'
          tags:
            - tag: component
              value: cpu
        - uuid: 4fc78be968de4d85a59644309bc8509d
          name: 'Angie: Memory usage (rss)'
          key: 'proc.mem[{$ANGIE.PROC_NAME},,,,rss]'
          history: 7d
          units: B
          description: 'Resident set size memory used by process in bytes.'
          tags:
            - tag: component
              value: memory
        - uuid: 887819f212024275b069110580be5e5b
          name: 'Angie: Memory usage (vsize)'
          key: 'proc.mem[{$ANGIE.PROC_NAME},,,,vsize]'
          history: 7d
          units: B
          description: 'Virtual memory size used by process in bytes.'
          tags:
            - tag: component
              value: memory
        - uuid: fc8f3f5aef6f4430925a9ae77f6dfb94
          name: 'Angie: Number of running processes'
          key: 'proc.num[{$ANGIE.PROC_NAME}]'
          history: 7d
          description: 'Number of the Angie processes running.'
          tags:
            - tag: component
              value: system
          triggers:
            - uuid: 14e59506d6994a03804b8050c4b18fa6
              expression: 'last(/Angie by Zabbix agent/proc.num[{$ANGIE.PROC_NAME}])=0'
              name: 'Angie: Process is not running'
              priority: HIGH
              tags:
                - tag: scope
                  value: availability
        - uuid: c2cf56ea421940b78932a51e4dc72962
          name: 'Angie: Get stub status page'
          key: 'web.page.get["{$ANGIE.STUB_STATUS.HOST}","{$ANGIE.STUB_STATUS.PATH}","{$ANGIE.STUB_STATUS.PORT}"]'
          history: 1h
          value_type: TEXT
          trends: '0'
          description: |
            The following status information is provided:
            `Active connections` - the current number of active client connections including waiting connections.
            `Accepted` - the total number of accepted client connections.
            `Handled` - the total number of handled connections. Generally, the parameter value is the same as for the accepted connections, unless some resource limits have been reached (for example, the `worker_connections` limit).
            `Requests` - the total number of client requests.
            `Reading` - the current number of connections where Angie is reading the request header.
            `Writing` - the current number of connections where Angie is writing a response back to the client.
            `Waiting` - the current number of idle client connections waiting for a request.
            
            See also [Module ngx_http_stub_status_module](https://angie.software/angie/docs/configuration/modules/http/http_stub_status/).
          tags:
            - tag: component
              value: application
            - tag: component
              value: health
          triggers:
            - uuid: 042f2446c1f54adca7f6fbbd53029710
              expression: |
                find(/Angie by Zabbix agent/web.page.get["{$ANGIE.STUB_STATUS.HOST}","{$ANGIE.STUB_STATUS.PATH}","{$ANGIE.STUB_STATUS.PORT}"],,"like","HTTP/1.1 200")=0 or
                 nodata(/Angie by Zabbix agent/web.page.get["{$ANGIE.STUB_STATUS.HOST}","{$ANGIE.STUB_STATUS.PATH}","{$ANGIE.STUB_STATUS.PORT}"],30m)=1
              name: 'Angie: Failed to fetch stub status page'
              event_name: 'Angie: Failed to fetch stub status page (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: 'Angie: Process is not running'
                  expression: 'last(/Angie by Zabbix agent/proc.num[{$ANGIE.PROC_NAME}])=0'
                - name: 'Angie: Service is down'
                  expression: 'last(/Angie by Zabbix agent/net.tcp.service[http,"{$ANGIE.STUB_STATUS.HOST}","{$ANGIE.STUB_STATUS.PORT}"])=0'
              tags:
                - tag: scope
                  value: availability
      tags:
        - tag: class
          value: software
        - tag: target
          value: angie
      macros:
        - macro: '{$ANGIE.DROP_RATE.MAX.WARN}'
          value: '1'
          description: 'The critical rate of the dropped connections for a trigger expression.'
        - macro: '{$ANGIE.PROC_NAME}'
          value: angie-nodebug
          description: 'Имя процесса angie. Для FreeBSD обычно angie-nodebug для Linux - angie'
        - macro: '{$ANGIE.RESPONSE_TIME.MAX.WARN}'
          value: '10'
          description: 'The maximum response time of Angie expressed in seconds for a trigger expression.'
        - macro: '{$ANGIE.STUB_STATUS.HOST}'
          value: 127.0.0.1
          description: 'The hostname or IP address of the Angie host or Angie container of `astub_status`.'
        - macro: '{$ANGIE.STUB_STATUS.PATH}'
          value: basic_status
          description: 'The path of the `Angie stub_status` page.'
        - macro: '{$ANGIE.STUB_STATUS.PORT}'
          value: '80'
          description: 'The port of the `Angie stub_status` host or container.'
      dashboards:
        - uuid: c0506e7a108442369899bc213181e77c
          name: 'Angie performance'
          pages:
            - widgets:
                - type: graph
                  width: '36'
                  height: '5'
                  fields:
                    - type: GRAPH
                      name: graphid
                      value:
                        host: 'Angie by Zabbix agent'
                        name: 'Angie: Connections by state'
                    - type: STRING
                      name: reference
                      value: AAADX
                - type: graph
                  'y': '5'
                  width: '36'
                  height: '5'
                  fields:
                    - type: GRAPH
                      name: graphid
                      value:
                        host: 'Angie by Zabbix agent'
                        name: 'Angie: Connections per second'
                    - type: STRING
                      name: reference
                      value: AAADZ
                - type: graph
                  x: '36'
                  width: '36'
                  height: '5'
                  fields:
                    - type: GRAPH
                      name: graphid
                      value:
                        host: 'Angie by Zabbix agent'
                        name: 'Angie: Requests per second'
                    - type: STRING
                      name: reference
                      value: AAADY
      valuemaps:
        - uuid: 06d10458869c48d3bac65fc1980a9c50
          name: 'Service state'
          mappings:
            - value: '0'
              newvalue: Down
            - value: '1'
              newvalue: Up
  graphs:
    - uuid: efcd9f4f05bb4c00acee58ccbb8ce1e4
      name: 'Angie: Connections by state'
      graph_items:
        - drawtype: BOLD_LINE
          color: 199C0D
          item:
            host: 'Angie by Zabbix agent'
            key: angie.connections.active
        - sortorder: '1'
          color: F63100
          item:
            host: 'Angie by Zabbix agent'
            key: angie.connections.waiting
        - sortorder: '2'
          color: 00611C
          item:
            host: 'Angie by Zabbix agent'
            key: angie.connections.writing
        - sortorder: '3'
          color: F7941D
          item:
            host: 'Angie by Zabbix agent'
            key: angie.connections.reading
    - uuid: 297f4555121142c7b929a49f93580c6f
      name: 'Angie: Connections per second'
      graph_items:
        - color: 199C0D
          item:
            host: 'Angie by Zabbix agent'
            key: angie.connections.accepted.rate
        - sortorder: '1'
          color: F63100
          item:
            host: 'Angie by Zabbix agent'
            key: angie.connections.handled.rate
        - sortorder: '2'
          color: 00611C
          item:
            host: 'Angie by Zabbix agent'
            key: angie.connections.dropped.rate
    - uuid: 4e1d5c96b15e4b0fbd72eebbda17c627
      name: 'Angie: Memory usage'
      graph_items:
        - color: 199C0D
          item:
            host: 'Angie by Zabbix agent'
            key: 'proc.mem[{$ANGIE.PROC_NAME},,,,vsize]'
        - sortorder: '1'
          color: F63100
          item:
            host: 'Angie by Zabbix agent'
            key: 'proc.mem[{$ANGIE.PROC_NAME},,,,rss]'
    - uuid: 4c3a8a54599a4d658a51c4f031c9124f
      name: 'Angie: Requests per second'
      graph_items:
        - drawtype: GRADIENT_LINE
          color: 199C0D
          item:
            host: 'Angie by Zabbix agent'
            key: angie.requests.total.rate
