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

Error “Cannot update host: Undefined array key (CHostGeneral::updateHostHgSets)” when modifying the host groups of a host

XMLWordPrintable

    • 0.5

      Customer reports that upon attempt to replace a hostgroup on one particular host, they encounter the following error:

      Undefined array key "0a5b046d07f6f971b7776de682f57c5b9cdc8fa060db7ef59de82e721c8098f4" [zabbix.php:17 → require_once() → ZBase->run() → ZBase->processRequest() → CController->run() → CControllerHostUpdate->doAction() → CApiWrapper->__call() → CFrontendApiWrapper->callMethod() → CApiWrapper->callMethod() → CFrontendApiWrapper->callClientMethod() → CLocalApiClient->callMethod() → CHost->update() → CHost->updateForce() → CHostGeneral->updateHgSets() → CHostGeneral::updateHostHgSets() in include/classes/api/services/CHostGeneral.php:353]
      Trying to access array offset on value of type null [zabbix.php:17 → require_once() → ZBase->run() → ZBase->processRequest() → CController->run() → CControllerHostUpdate->doAction() → CApiWrapper->__call() → CFrontendApiWrapper->callMethod() → CApiWrapper->callMethod() → CFrontendApiWrapper->callClientMethod() → CLocalApiClient->callMethod() → CHost->update() → CHost->updateForce() → CHostGeneral->updateHgSets() → CHostGeneral::updateHostHgSets() in include/classes/api/services/CHostGeneral.php:353]
      

      Error happens when user attempts to replace the following hostgroup for host:

      mysql> SELECT * FROM hstgrp WHERE name like 'parentGroup1/parentGroup2/group1';
      +---------+--------------------------------------------------------------------+-------+----------------------------------+------+
      | groupid | name                                                               | flags | uuid                             | type |
      +---------+--------------------------------------------------------------------+-------+----------------------------------+------+
      |      27 | parentGroup1/parentGroup2/group1 |     0 | 0f837c23f39a49c4bf2100717972b92c |    0 |
      +---------+--------------------------------------------------------------------+-------+----------------------------------+------+
      

      With this hostgroup:

      mysql> SELECT * FROM hstgrp WHERE name like 'parentGroup1/parentGroup2/group2';
      +---------+------------------------------------------------------------------------+-------+----------------------------------+------+
      | groupid | name                                                                   | flags | uuid                             | type |
      +---------+------------------------------------------------------------------------+-------+----------------------------------+------+
      |     146 | parentGroup1/parentGroup2/group2 |     0 | 9cdff17c6abb4bddb585cc49f6e18e7e |    0 |
      +---------+------------------------------------------------------------------------+-------+----------------------------------+------+
      

      Here is additional information from queries requested as part of troubleshooting:

      mysql> SELECT hostid, name, uuid
      -> FROM hosts
      -> WHERE hostid = 14661;
      --------------------+-----+
      | hostid | name        | uuid |
      --------------------+-----+
      |  14661 | host1 |      |
      --------------------+-----+
      1 row in set (0.00 sec)
      
      mysql> SELECT * FROM host_hgset
      -> WHERE hostid = 14661;
      -----------------+
      | hostid | hgsetid |
      -----------------+
      |  14661 |      66 |
      -----------------+
      1 row in set (0.00 sec)
      
      mysql> SELECT * FROM hgset
      -> WHERE hgsetid IN (
      ->   SELECT hgsetid FROM host_hgset WHERE hostid = 14661
      -> );
      ---------------------------------------------------------------------------+
      | hgsetid | hash                                                             |
      ---------------------------------------------------------------------------+
      |      66 | 670671cd97404156226e507973f2ab8330d3022ca96e0c93bdbdb320c41adcaf |
      ---------------------------------------------------------------------------+
      1 row in set (0.01 sec)
      
      mysql> SELECT hgset_group.hgsetid, hgset_group.groupid, hstgrp.name AS group_name
      -> FROM hgset_group
      -> JOIN hstgrp ON hgset_group.groupid = hstgrp.groupid
      -> WHERE hgset_group.hgsetid IN (
      ->   SELECT hgsetid FROM host_hgset WHERE hostid = 14661
      -> );
      -----------------+-------------------------------------------------------------------+
      | hgsetid | groupid | group_name                                                         |
      -----------------+-------------------------------------------------------------------+
      |      66 |      27 | parentGroup1/parentGroup2/group1 |
      -----------------+-------------------------------------------------------------------+
      

      note all output is anonymized as per customer request.

            jfreibergs Janis Freibergs
            tbross Tomass Janis Bross
            Team C
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: