[ZBX-6465] API call incorrectly enables host inventory Created: 2013 Apr 05 Updated: 2017 May 30 Resolved: 2013 May 15 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | API (A) |
Affects Version/s: | 2.0.6rc1, 2.1.0 |
Fix Version/s: | 2.1.0 |
Type: | Incident report | Priority: | Minor |
Reporter: | Pavels Jelisejevs (Inactive) | Assignee: | Unassigned |
Resolution: | Fixed | Votes: | 0 |
Labels: | api, host, inventory | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified |
Description |
If host inventory is disabled for a host, the following API call will enable it. { } |
Comments |
Comment by Pavels Jelisejevs (Inactive) [ 2013 Apr 05 ] |
Might be related to |
Comment by Toms (Inactive) [ 2013 Apr 22 ] |
Fixed in development branch svn://svn.zabbix.com/branches/dev/ZBX-6465 |
Comment by Pavels Jelisejevs (Inactive) [ 2013 Apr 22 ] |
(1) If we set host inventory to disabled and try to set some inventory fields in a single request, the API should fail as well. { "jsonrpc": "2.0", "method": "host.update", "params": { "hostid": 10090, "inventory_mode": -1, "inventory": { "alias": "asd" } }, "id": 9, "auth": "19fdf1f869c41d5e324528205960d017" } tomtom RESOLVED in r35187 jelisejev Let's change the new error message to 'Inventory disabled for host "%s".' so it would reference a specific problem host. jelisejev After some discussion we decided to leave the message as is. CLOSED. |
Comment by Pavels Jelisejevs (Inactive) [ 2013 Apr 22 ] |
(2) In CHost.php: 1. line 1021: if you don't need $hostids to be a hash, it's best to use array_unique() to get rid of duplicates. tomtom RESOLVED in r35187 jelisejev CLOSED. |
Comment by Pavels Jelisejevs (Inactive) [ 2013 May 02 ] |
TESTED. |
Comment by Toms (Inactive) [ 2013 May 02 ] |
Fixed in 2.1.0 r35375 |
Comment by Alexander Vladishev [ 2013 May 02 ] |
(3) Тhere is an error when editing or importing host: Cannot set inventory fields for disabled inventory. Steps to reproduce (with a fresh zabbix database):
tomtom RESOLVED in r35409 sasha REOPENED
Cannot perform update statement on table "hosts" without values. [hosts.php:269 → CAPIObject->massUpdate() → CAPIObject->__call() → czbxrpc::call() → czbxrpc::callAPI() → call_user_func() → CHost->massUpdate() → DB::update() → DB::exception() in /home/sasha/zabbix-svn/branches/dev/ZBX-6465/frontends/php/include/classes/db/DB.php:518] tomtom RESOLVED in r35478 sasha CLOSED |
Comment by Pavels Jelisejevs (Inactive) [ 2013 May 03 ] |
(4) Please note this in the API changelog. tomtom RESOLVED in https://www.zabbix.com/documentation/2.2/manual/api/changes_2.0_-_2.2#host jelisejev CLOSED. |
Comment by Alexander Vladishev [ 2013 May 08 ] |
(5) Update of inventory fields causes undefined indexes API::Host()->update(array( 'hostid' => 10089, 'inventory' => array( 'contract_number' => '1234567890' ) ) Undefined index: inventory_mode [CAPIObject->update() → CAPIObject->__call() → czbxrpc::call() → czbxrpc::callAPI() → call_user_func() → CHost->update() → CHost->massUpdate() in /home/sasha/zabbix-svn/branches/dev/ZBX-6465/frontends/php/api/classes/CHost.php:1248] Undefined index: inventory_mode [CAPIObject->update() → CAPIObject->__call() → czbxrpc::call() → czbxrpc::callAPI() → call_user_func() → CHost->update() → CHost->massUpdate() in /home/sasha/zabbix-svn/branches/dev/ZBX-6465/frontends/php/api/classes/CHost.php:1262] Undefined index: inventory_mode [CAPIObject->update() → CAPIObject->__call() → czbxrpc::call() → czbxrpc::callAPI() → call_user_func() → CHost->update() → CHost->massUpdate() in /home/sasha/zabbix-svn/branches/dev/ZBX-6465/frontends/php/api/classes/CHost.php:1278] tomtom RESOLVED in r35524. This problem was present before fix. sasha CLOSED |
Comment by Alexander Vladishev [ 2013 May 08 ] |
(6) API call creates incorrect inventory record API::Host()->create(array( 'host' => 'host5', 'groups' => array( array('groupid' => 4) ), 'interfaces' => array( array( 'type' => 1, 'ip' => '127.0.0.1', 'dns' => '', 'useip' => 1, 'port' => '10050', 'main' => 1 ) ), 'inventory' => array( 'contract_number' => '1234567890' ), 'inventory_mode' => -1 )); INSERT INTO hosts (host,name,hostid) VALUES ('host6','host6','10090'); ... INSERT INTO host_inventory (hostid, contract_number, inventory_mode) VALUES (10090, '1234567890', -1); tomtom RESOLVED in r35527 sasha CLOSED |
Comment by Toms (Inactive) [ 2013 May 10 ] |
Fixed in 2.1.0 r35554 |
Comment by Eduards Samersovs (Inactive) [ 2013 May 14 ] |
(7) Simple host mass update without any change fires with validation error: Inventory disabled for host "Riga". [hosts.php:269 → CAPIObject->massUpdate() → CAPIObject->__call() → czbxrpc::call() → czbxrpc::callAPI() → call_user_func() → CHost->massUpdate() → CZBXAPI::exception() in /home/zabbix/www/trunk/frontends/php/api/classes/CHost.php:1275] tomtom RESOLVED in r35630. Please take a bit more care to language as I took "muss" as "must" not "mass" so making sentence irrational |
Comment by Eduards Samersovs (Inactive) [ 2013 May 15 ] |
Tested! |
Comment by Toms (Inactive) [ 2013 May 15 ] |
Fixed in 2.1.0 r35635 |