zabbix_export:
  version: '7.0'
  template_groups:
    - uuid: 7df96b18c230490a9a0a9e2307226338
      name: Templates
  templates:
    - uuid: 4674a3e3d3cf4cb4983047766fd4ca64
      template: '-- External IP - ip-api.com'
      name: '-- External IP - ip-api.com'
      description: 'More information: https://ip-api.com/docs/api:json'
      groups:
        - name: Templates
      items:
        - uuid: 90be178e93a640268fe2662c03736694
          name: City
          type: DEPENDENT
          key: ipinfo.city
          delay: '0'
          history: 7d
          value_type: CHAR
          trends: '0'
          inventory_link: SITE_CITY
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.city
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1d
          master_item:
            key: 'web.page.get[ip-api.com/json]'
          tags:
            - tag: component
              value: ipinfo
        - uuid: 5c4b58d67ab5479697ac203a058b988a
          name: Country
          type: DEPENDENT
          key: ipinfo.country
          delay: '0'
          history: 7d
          value_type: CHAR
          trends: '0'
          inventory_link: SITE_COUNTRY
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.country
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1d
          master_item:
            key: 'web.page.get[ip-api.com/json]'
          tags:
            - tag: component
              value: ipinfo
        - uuid: 3d963a1a623c406bb7e3199f7d698285
          name: CountryCode
          type: DEPENDENT
          key: ipinfo.countryCode
          delay: '0'
          history: 7d
          value_type: CHAR
          trends: '0'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.countryCode
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1d
          master_item:
            key: 'web.page.get[ip-api.com/json]'
          tags:
            - tag: component
              value: ipinfo
        - uuid: 749b284c5aab496d875f141153e220b1
          name: IP
          type: DEPENDENT
          key: ipinfo.ip
          delay: '0'
          history: 7d
          value_type: CHAR
          trends: '0'
          inventory_link: HOST_ROUTER
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.query
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1d
          master_item:
            key: 'web.page.get[ip-api.com/json]'
          tags:
            - tag: component
              value: ipinfo
        - uuid: 90b0d1681048483081837b138038a121
          name: Isp
          type: DEPENDENT
          key: ipinfo.isp
          delay: '0'
          history: 7d
          value_type: CHAR
          trends: '0'
          inventory_link: LOCATION
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.isp
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1d
          master_item:
            key: 'web.page.get[ip-api.com/json]'
          tags:
            - tag: component
              value: ipinfo
        - uuid: 58fe312d38b743599080600405063fa1
          name: Lat
          type: DEPENDENT
          key: ipinfo.lat
          delay: '0'
          history: 7d
          value_type: CHAR
          trends: '0'
          inventory_link: LOCATION_LAT
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.lat
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1d
          master_item:
            key: 'web.page.get[ip-api.com/json]'
          tags:
            - tag: component
              value: ipinfo
        - uuid: 2d842b3704af40399e65fccb9f006775
          name: Lon
          type: DEPENDENT
          key: ipinfo.lon
          delay: '0'
          history: 7d
          value_type: CHAR
          trends: '0'
          inventory_link: LOCATION_LON
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.lon
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1d
          master_item:
            key: 'web.page.get[ip-api.com/json]'
          tags:
            - tag: component
              value: ipinfo
        - uuid: 2b3c6664f71f48969c7d8900a2909967
          name: Org
          type: DEPENDENT
          key: ipinfo.org
          delay: '0'
          history: 7d
          value_type: CHAR
          trends: '0'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.org
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1d
          master_item:
            key: 'web.page.get[ip-api.com/json]'
          tags:
            - tag: component
              value: ipinfo
        - uuid: d628460d14fc45258ec6ae9c12f9bdc2
          name: Postal
          type: DEPENDENT
          key: ipinfo.postal
          delay: '0'
          history: 7d
          value_type: CHAR
          trends: '0'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.zip
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1d
          master_item:
            key: 'web.page.get[ip-api.com/json]'
          tags:
            - tag: component
              value: ipinfo
        - uuid: 6e86a686ad51455291d1e7298f508de8
          name: Region
          type: DEPENDENT
          key: ipinfo.region
          delay: '0'
          history: 7d
          value_type: CHAR
          trends: '0'
          inventory_link: SITE_STATE
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.region
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1d
          master_item:
            key: 'web.page.get[ip-api.com/json]'
          tags:
            - tag: component
              value: ipinfo
        - uuid: 685f1ac018f74dedaa3b77626afd3f88
          name: RegionName
          type: DEPENDENT
          key: ipinfo.regionName
          delay: '0'
          history: 7d
          value_type: CHAR
          trends: '0'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.regionName
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1d
          master_item:
            key: 'web.page.get[ip-api.com/json]'
          tags:
            - tag: component
              value: ipinfo
        - uuid: 34ea9568e8614b9e9e3f44e722f1841d
          name: TimeZone
          type: DEPENDENT
          key: ipinfo.timezone
          delay: '0'
          history: 7d
          value_type: CHAR
          trends: '0'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.timezone
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1d
          master_item:
            key: 'web.page.get[ip-api.com/json]'
          tags:
            - tag: component
              value: ipinfo
        - uuid: 764b05acc65644b6bf2ff678460efd8a
          name: 'Get External IP'
          type: ZABBIX_ACTIVE
          key: 'web.page.get[ip-api.com/json]'
          delay: 15m
          history: 1h
          value_type: TEXT
          trends: '0'
          description: |
            system.run[curl -s -L http://ip-api.com/json 2> /dev/null]
            ou
            zabbix_get -s 127.0.0.1 -k "web.page.get[ip-api.com/json]"
          preprocessing:
            - type: REGEX
              parameters:
                - '({[\w\W]+?}$)'
                - \1
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          timeout: 30s
          tags:
            - tag: component
              value: ipinfo
            - tag: component
              value: raw
      tags:
        - tag: component
          value: ip-api.com
    - uuid: 8dce82b00d5d42ff8156d910f9a46989
      template: '-- Get Hostnamectl'
      name: '-- Get Hostnamectl'
      description: |
        Remotely execute the command:
        system.run[hostnamectl --json=pretty] and extracts some fields
      groups:
        - name: Templates
      items:
        - uuid: a280a209f38a4d7e90adf46a1c5672a4
          name: 'Hardware Model'
          type: DEPENDENT
          key: hostnamectl.HardwareModel
          delay: '0'
          history: 7d
          value_type: CHAR
          trends: '0'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.HardwareModel
              error_handler: DISCARD_VALUE
          master_item:
            key: 'system.run[hostnamectl --json=pretty 2>/dev/null]'
          tags:
            - tag: component
              value: hostnamectl
        - uuid: 9bf0b58694e64af09db31c66c5889d28
          name: 'Kernel Release'
          type: DEPENDENT
          key: hostnamectl.KernelRelease
          delay: '0'
          history: 7d
          value_type: CHAR
          trends: '0'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.KernelRelease
              error_handler: DISCARD_VALUE
          master_item:
            key: 'system.run[hostnamectl --json=pretty 2>/dev/null]'
          tags:
            - tag: component
              value: hostnamectl
        - uuid: 70f393a91c2943e9b7b77f0cbfe2ac2e
          name: 'Operating System Home URL'
          type: DEPENDENT
          key: hostnamectl.OperatingSystemHomeURL
          delay: '0'
          history: 7d
          value_type: CHAR
          trends: '0'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.OperatingSystemHomeURL
              error_handler: DISCARD_VALUE
          master_item:
            key: 'system.run[hostnamectl --json=pretty 2>/dev/null]'
          tags:
            - tag: component
              value: hostnamectl
        - uuid: 575083b44e0d4e26a524ca4eb52279b9
          name: 'Operating System'
          type: DEPENDENT
          key: hostnamectl.OperatingSystemPrettyName
          delay: '0'
          history: 7d
          value_type: CHAR
          trends: '0'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.OperatingSystemPrettyName
              error_handler: DISCARD_VALUE
          master_item:
            key: 'system.run[hostnamectl --json=pretty 2>/dev/null]'
          tags:
            - tag: component
              value: hostnamectl
        - uuid: ee55a7898e14492d89ae24eceb6bb498
          name: 'Get hostnamectl'
          type: ZABBIX_ACTIVE
          key: 'system.run[hostnamectl --json=pretty 2>/dev/null]'
          delay: 1h
          history: '0'
          value_type: TEXT
          trends: '0'
          description: 'Query or change system hostname.'
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
          tags:
            - tag: component
              value: hostnamectl
      tags:
        - tag: component
          value: hostnamectl
    - uuid: a86da3123da24f87b511ee396ed194d2
      template: '-- RaspBerry PI'
      name: '-- RaspBerry PI'
      description: 'Template RaspBerry PI'
      groups:
        - name: Templates
      items:
        - uuid: b8b4046c58c04b77958354f61351444d
          name: 'MAC ADDRESS'
          type: ZABBIX_ACTIVE
          key: 'system.hw.macaddr[eth*|enp*|wlan*,short]'
          history: 7d
          value_type: CHAR
          trends: '0'
          description: 'Find MACADDRESS'
          inventory_link: MACADDRESS_A
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 24h
          tags:
            - tag: component
              value: local
        - uuid: 6c52e12131e84617a065f6b2aa526f3b
          name: 'HDMI STATUS'
          type: ZABBIX_ACTIVE
          key: 'system.run["cat /sys/class/drm/card?-HDMI-A-[1-2]/status | tr ''\r\n'' '' ''"]'
          history: 7d
          value_type: CHAR
          trends: '0'
          description: 'Verify HDMI cable is conected'
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 24h
          tags:
            - tag: component
              value: local
          triggers:
            - uuid: 6f8f2ffb14264c7188ff227892cb25cb
              expression: 'find(/-- RaspBerry PI/system.run["cat /sys/class/drm/card?-HDMI-A-[1-2]/status | tr ''\r\n'' '' ''"],,"like","disconnected")=1'
              name: 'HDMI input not connected'
              priority: HIGH
              manual_close: 'YES'
        - uuid: 161ba847d02144dda87d61af1068f1fc
          name: 'RPI TEMPERATURE'
          type: ZABBIX_ACTIVE
          key: 'system.run["cat /sys/class/thermal/thermal_zone0/temp"]'
          history: 7d
          value_type: FLOAT
          trends: '0'
          units: ºC
          description: 'Show RPI''s Temperature with a command'
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 24h
            - type: MULTIPLIER
              parameters:
                - '0.001'
          tags:
            - tag: component
              value: local
          triggers:
            - uuid: c3caf3a3d11e4a84bd6605c81ab4e079
              expression: 'avg(/-- RaspBerry PI/system.run["cat /sys/class/thermal/thermal_zone0/temp"],#5)>{$TEMPERATURE_MAX}'
              name: 'Average Temperature is hight ({ITEM.LASTVALUE} > {$TEMPERATURE_MAX} ºC)'
              opdata: 'Current temperature {ITEM.LASTVALUE1}'
              priority: HIGH
              description: 'RPI Temperature is hight'
              manual_close: 'YES'
        - uuid: 939c295dee2246e5837057f717dd04ee
          name: CLOUDFLARED-VERSION
          type: ZABBIX_ACTIVE
          key: 'system.run["cloudflared --version 2>/dev/null | awk ''{ if ($2) print $3 }''"]'
          history: 7d
          value_type: CHAR
          trends: '0'
          description: 'Find cloudflared version'
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 24h
          tags:
            - tag: component
              value: local
        - uuid: e1590bd41fb8426392c5f5f6fd31183c
          name: FIRST_USER
          type: ZABBIX_ACTIVE
          key: 'system.run["getent passwd 1000 | awk -F''[:]'' ''{ print $1 }''"]'
          history: 7d
          value_type: CHAR
          trends: '0'
          description: 'Find First User Created'
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 24h
          tags:
            - tag: component
              value: local
        - uuid: 87920497511a4199ba969f66931eae8e
          name: 'LAN IP'
          type: ZABBIX_ACTIVE
          key: 'system.run["hostname -I | awk ''{ print $1 }''"]'
          history: 7d
          value_type: CHAR
          trends: '0'
          description: 'Find LAN IP'
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 24h
          tags:
            - tag: component
              value: local
        - uuid: 051473b8753c4ae5800991e8df2a8883
          name: RUSTDESK-VERSION
          type: ZABBIX_ACTIVE
          key: 'system.run["rustdesk --version 2>/dev/null || echo ''NOT found''"]'
          history: 7d
          value_type: CHAR
          trends: '0'
          description: 'Find rustdesk version'
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 24h
          tags:
            - tag: component
              value: local
        - uuid: 442929cab4fc47c1977d0bc856bfa073
          name: 'WIFI CONNECT'
          type: ZABBIX_ACTIVE
          key: 'system.run["sudo nmcli dev wifi show-password 2>/dev/null || echo ''NOT found''"]'
          history: 7d
          value_type: CHAR
          trends: '0'
          description: 'Find WIFI CONNECT AND PASSWORD'
          inventory_link: MACADDRESS_B
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 24h
          tags:
            - tag: component
              value: local
        - uuid: fde912b471b841119eb4ad4f094b6f5d
          name: RUSTDESK-ID
          type: ZABBIX_ACTIVE
          key: 'system.run["sudo rustdesk --get-id 2>/dev/null || echo ''NOT found''"]'
          history: 7d
          value_type: CHAR
          trends: '0'
          description: 'Find rustdek ID'
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 24h
          tags:
            - tag: component
              value: local
      macros:
        - macro: '{$AGENT.NODATA_TIMEOUT}'
          value: 10m
          description: 'No data timeout for active agents. Consider to keep it relatively high.'
        - macro: '{$TEMPERATURE_MAX}'
          value: '85'
          description: 'Max temperature of your Raspberry Pi'
    - uuid: 9904c3dbb30146e8a38e257375cb2f13
      template: '-- Web Monitoring'
      name: '-- Web Monitoring'
      description: |
        Template de Monitoramento de Serviços HTTP
        
        Lista de status codes: https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
      groups:
        - name: Templates
      httptests:
        - uuid: 9cef93b90c12443caca941dd7f9a5a10
          name: 'Website Availability'
          attempts: '3'
          agent: 'Zabbix do Tiozao - https://wiki.tiozaodolinux.com'
          steps:
            - name: 'Home Page'
              url: '{$WEB_DEFAULT_PROTOCOL}{HOST.HOST}:{$WEB_DEFAULT_PORT}'
              status_codes: '{$HTTP_STATUS_CODE_ACCEPT}'
          tags:
            - tag: component
              value: web
      tags:
        - tag: component
          value: monitoring
        - tag: component
          value: web
      macros:
        - macro: '{$HTTP_STATUS_CODE_ACCEPT}'
          value: '200,403'
          description: 'List of HTTP status codes accept'
        - macro: '{$MAX_FAILURES}'
          value: '2'
          description: 'Maximum number of consecutive failures'
        - macro: '{$MAX_RESPONSE_TIME}'
          value: '2.000'
          description: 'Values ​​in milliseconds'
        - macro: '{$TIME_PERIOD}'
          value: 5m
          description: 'Values ​​in minutes'
        - macro: '{$WEB_DEFAULT_PORT}'
          value: '80'
          description: 'Default port used'
        - macro: '{$WEB_DEFAULT_PROTOCOL}'
          value: 'http://'
          description: 'Default protocol used'
      valuemaps:
        - uuid: 6ea3fc2c58ce41e483e229ae69b18897
          name: Status
          mappings:
            - value: '0'
              newvalue: 'ON'
            - value: '1'
              newvalue: DOWN
  triggers:
    - uuid: 16bccfda06ce4f7a9cb1d6e3459035e2
      expression: 'avg(/-- Web Monitoring/web.test.time[Website Availability,Home Page,resp],{$TIME_PERIOD})>{$MAX_RESPONSE_TIME}'
      name: 'Accessing the website is slow'
      event_name: 'Website {HOST.HOST} is slow for {$TIME_PERIOD}'
      opdata: 'Problem: {ITEM.VALUE1} Now: {ITEM.LASTVALUE}'
      priority: WARNING
      description: 'Access to the website is slow'
      manual_close: 'YES'
      dependencies:
        - name: 'Accessing the website is VERY slow'
          expression: 'avg(/-- Web Monitoring/web.test.time[Website Availability,Home Page,resp],{$TIME_PERIOD})>3*{$MAX_RESPONSE_TIME}'
        - name: 'Access to the website FAILED'
          expression: 'sum(/-- Web Monitoring/web.test.fail[Website Availability],{$TIME_PERIOD})>={$MAX_FAILURES}'
    - uuid: 0b473201809b492eafd2d661034e1f13
      expression: 'avg(/-- Web Monitoring/web.test.time[Website Availability,Home Page,resp],{$TIME_PERIOD})>3*{$MAX_RESPONSE_TIME}'
      name: 'Accessing the website is VERY slow'
      event_name: 'Website {HOST.HOST} is VERY slow for {$TIME_PERIOD}'
      opdata: 'Problem: {ITEM.VALUE1} Now: {ITEM.LASTVALUE}'
      priority: AVERAGE
      description: 'Accessing the website is VERY slow'
      manual_close: 'YES'
      dependencies:
        - name: 'Access to the website FAILED'
          expression: 'sum(/-- Web Monitoring/web.test.fail[Website Availability],{$TIME_PERIOD})>={$MAX_FAILURES}'
    - uuid: c63b0624536f4e1abfe233116aab42d7
      expression: 'sum(/-- Web Monitoring/web.test.fail[Website Availability],{$TIME_PERIOD})>={$MAX_FAILURES}'
      name: 'Access to the website FAILED'
      event_name: 'Website {HOST.HOST} failed {$MAX_FAILURES} times in {$TIME_PERIOD}'
      priority: DISASTER
      description: 'Access to the website FAILED {$MAX_FAILURES} times'
      manual_close: 'YES'
