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

Not possible to delete inherited host prototype from host if a web scenario was added after discovery of a host by this prototype

XMLWordPrintable

    • S24-W40/41
    • 2

      Problem description: Imagine that there's a template has a host prototype that should link the discovered hosts to the same template. This template is linked to a host "test", a host is discovered by this prototype. Afterwards, a Web scenario is added to this template, and, therefore it appears on the discovered host and on the "test" host, and then the template is unlinked from host "test". After these actions it will not be possible to delete this host prototype from host "test" due to the following error:

       pg_query(): Query failed: ERROR: update or delete on table "hosts" violates foreign key constraint "c_httptest_2" on table "httptest"
      DETAIL: Key (hostid)=(10643) is still referenced from table "httptest". [host_prototypes.php:325 → CApiWrapper->__call() → CFrontendApiWrapper->callMethod() → CApiWrapper->callMethod() → CFrontendApiWrapper->callClientMethod() → CLocalApiClient->callMethod() → CHostPrototype->delete() → CHostPrototype::deleteForce() → DB::delete() → DBexecute() → pg_query() → CConfigFile->{closure}() in conf/zabbix.conf.php:87]
      Error in query [DELETE FROM hosts WHERE hostid='10643'] [ERROR: update or delete on table "hosts" violates foreign key constraint "c_httptest_2" on table "httptest"
      DETAIL: Key (hostid)=(10643) is still referenced from table "httptest".]
      SQL statement execution has failed "DELETE FROM hosts WHERE hostid='10643'"
      

      Steps to reproduce:

      1. Create a template with an LLD rule of type trapper
      2. Add a host prototype to this LLD rule that would link the discovered hosts to this created template
      3. Create a host and link the created template to it
      4. Execute the discovery rule.
      5. Make sure that host is discovered from the host prototype and that it is linked to the created template
      6. Add a web scenario to the template.
      7. Make sure that the web scenario is added both to the created host and to the discovered host
      8. Unlink template from the created host
      9. Attempt to delete the host prototype from the created host.

      Result: host prototype cannot be deleted due to the above mentioned error.
      Expected: host prototype should be successfully deleted.

      Example:

            zabbix.dev Zabbix Development Team
            solonkins Sergejs Olonkins
            Team C
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: