Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-26830

Runtime error "Undefined array key "host_status" appears in the logs, if configuration.import updates the host and template with triggers

XMLWordPrintable

      Steps to reproduce:

      1. Import host and template using frontend -> zbx_export_hosts - host_status_error.yaml , zbx_export_templates - host_status_error.yaml
      2. Send api request configuration.import, which contains both template and host from #1:
      {
          "jsonrpc": "2.0",
          "method": "configuration.import",
          "params": {
              "format": "yaml",
              "rules": {
                  "triggers": {
                      "createMissing": true,
                      "updateExisting": true,
                      "deleteMissing": true 
                  }
              },
          "source": "zabbix_export:\n  version: '7.0'\n  template_groups:\n    - uuid: 7df96b18c230490a9a0a9e2307226338\n      name: Templates\n  host_groups:\n    - uuid: f2481361f99448eea617b7b1d4765566\n      name: 'Discovered hosts'\n    - uuid: 098f6bcd462143738ade4e832627b4f6\n      name: test\n  templates:\n    - uuid: cc207ac8cd2f4217ab8dce564e869b56\n      template: 'test temp'\n      name: 'test temp'\n      groups:\n        - name: Templates\n      items:\n        - uuid: d9ee339b8f9044f592a5b9a7b8c707b4\n          name: aaaa\n          key: agent.hostname\n          history: 90d\n          value_type: CHAR\n          trends: '0'\n          triggers:\n            - uuid: d5b79f7b69f948af9b19d5671de5154f\n              expression: 'last(/test temp/agent.hostname)<>0'\n              name: aaaa\n  hosts:\n    - host: test\n      name: test\n      groups:\n        - name: test\n      interfaces:\n        - interface_ref: if1\n      items:\n        - name: trap\n          type: TRAP\n          key: trap\n          delay: '0'\n          history: 90d\n          triggers:\n            - expression: last(/test/trap)<>0\n              name: 'Trigger trapper'\n              priority: WARNING\n              manual_close: 'YES'\n              tags:\n                - tag: testTag\n                  value: '{ITEM.VALUE}'\n      discovery_rules:\n        - name: discovery\n          type: TRAP\n          key: discovery\n          delay: '0'\n          lifetime: 30d\n          enabled_lifetime_type: DISABLE_NEVER\n          item_prototypes:\n            - name: 'item prototype {#ID}'\n              type: TRAP\n              key: 'trap[{#ID}]'\n              delay: '0'\n              trigger_prototypes:\n                - expression: 'last(/test/trap[{#ID}])<>0'\n                  name: 'trigger prototype {#ID}'\n                  manual_close: 'YES'\n          graph_prototypes:\n            - name: 'graph prototype {#ID}'\n              graph_items:\n                - color: 1A7C11\n                  item:\n                    host: test\n                    key: 'trap[{#ID}]'\n          host_prototypes:\n            - host: 'Host prototype {#ID}'\n              name: 'Host prototype {#ID}'\n              group_links:\n                - group:\n                    name: 'Discovered hosts'\n              group_prototypes:\n                - name: 'Host prototype {#ID}'\n      httptests:\n        - name: 'test web scenario'\n          steps:\n            - name: homepage\n              url: 'http://zabbix.com'\n      inventory_mode: DISABLED\n  graphs:\n    - name: 'test graph'\n      graph_items:\n        - sortorder: '1'\n          color: 1A7C11\n          item:\n            host: test\n            key: trap\n"
          },
      	"id": 1
      }
      

      3. Check logs

      Result:
      Error in the php log:

      Undefined array key "host_status" [api_jsonrpc.php:58 -> CJsonRpc->execute() -> CLocalApiClient->callMethod() -> CConfiguration->import() -> CConfigurationImport->import() -> CConfigurationImport->processTriggers() -> CTrigger->update() -> CTriggerGeneral->validateUpdate() -> CTriggerGeneral::validateUuid() -> CApiInputValidator::validate() -> CApiInputValidator::validateData() -> CApiInputValidator::validateObjects() -> CApiInputValidator::validateObject() -> CConfigFile->{closure}() in include/classes/validators/CApiInputValidator.php:1473]
      

      Expected:
      No errors should be present in the logs.

            zabbix.dev Zabbix Development Team
            ngogolevs Nikita Gogolevs
            Team C
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: