-
Problem report
-
Resolution: Fixed
-
Trivial
-
3.2.7, 3.2.9
-
Sprint 20, Sprint 21, Sprint 22, Sprint 23, Sprint 56 (Sep 2019), Sprint 55 (Aug 2019), Sprint 54 (Jul 2019), Sprint 57 (Oct 2019)
-
3
Attribute inventory_mode can be used directly with API host.create and host.update, also described as direct attribute in Host object documentation, but it is not present if using host.get
The attribute is a part of the host inventory sub-object, if selectInventory is part of a host.get request, but that appears differently for different inventory_mode values.
Inventory modes:
- disabled - inventory attribute is empty array, inventory_mode is not present.
- manual - inventory attribute is object, inventory_mode is nested on contrary to documentation.
- automatic - inventory attribute is object, inventory_mode is nested on contrary to documentation.
As an API user I'd like to get inventory_mode attribute along with other host attributes when using host.get the same way I use it for host.create and host.update. Also if disabled, empty inventory object is more expected than current empty array.
Detailed examples follows.
Inventory mode disabled
Steps to reproduce:
- api call host.create providing inventory_mode parameter
host.create { "host": "host01", "groups": {"hostgroupid":"1"}, "interfaces": { "type": 1, "main": 1, "useip": 1, "ip": "192.168.3.1", "dns": "", "port": "10050" }, "inventory_mode": "-1" } - api call host.get don't give parameter back at all not even in inventory sub object
host.get { "filter": {"host": "host01"}, "selectInventory": true }
Result:
{
"jsonrpc": "2.0",
"result": [
{
"hostid": "10314",
"proxy_hostid": "0",
"host": "host01",
"status": "0",
...
"inventory": []
}
],
"id": 2
}
Expected:
{
"jsonrpc": "2.0",
"result": [
{
"hostid": "10314",
"proxy_hostid": "0",
"host": "host01",
"status": "0",
...
"inventory_mode": "-1",
"inventory": []
}
],
"id": 2
}
Inventory mode manual
Steps to reproduce:
- api call host.create providing inventory_mode parameter
host.create { "host": "host01", "groups": {"hostgroupid":"1"}, "interfaces": { "type": 1, "main": 1, "useip": 1, "ip": "192.168.3.1", "dns": "", "port": "10050" }, "inventory_mode": "0" } - api call host.get don't give parameter back directly, it's in inventory sub object
host.get { "filter": {"host": "host01"}, "selectInventory": true }
Result:
{
"jsonrpc": "2.0",
"result": [
{
"hostid": "10314",
"proxy_hostid": "0",
"host": "host01",
"status": "0",
...
"inventory": {
"hostid": "10314",
"inventory_mode": "0",
"type": "",
"type_full": "",
"name": "",
"alias": "",
"os": "",
...
}
}
],
"id": 2
}
Expected:
{
"jsonrpc": "2.0",
"result": [
{
"hostid": "10314",
"proxy_hostid": "0",
"host": "host01",
"status": "0",
...
"inventory_mode": "0",
"inventory": {
"hostid": "10314",
"type": "",
"type_full": "",
"name": "",
"alias": "",
"os": "",
...
}
}
],
"id": 3
}
Inventory mode automatic
Steps to reproduce:
- api call host.create providing inventory_mode parameter
host.create { "host": "host01", "groups": {"hostgroupid":"1"}, "interfaces": { "type": 1, "main": 1, "useip": 1, "ip": "192.168.3.1", "dns": "", "port": "10050" }, "inventory_mode": "1" } - api call host.get don't give parameter back directly, it's in inventory sub object
host.get { "filter": {"host": "host01"}, "selectInventory": true }
Result:
{
"jsonrpc": "2.0",
"result": [
{
"hostid": "10314",
"proxy_hostid": "0",
"host": "host01",
"status": "0",
...
"inventory": {
"hostid": "10314",
"inventory_mode": "1",
"type": "",
"type_full": "",
"name": "",
"alias": "",
"os": "",
...
}
}
],
"id": 2
}
Expected:
{
"jsonrpc": "2.0",
"result": [
{
"hostid": "10314",
"proxy_hostid": "0",
"host": "host01",
"status": "0",
...
"inventory_mode": "1",
"inventory": {
"hostid": "10314",
"type": "",
"type_full": "",
"name": "",
"alias": "",
"os": "",
...
}
}
],
"id": 3
}
- duplicates
-
ZBX-5807 Using inventory_mode in host.create and host.update
-
- Closed
-
- is duplicated by
-
ZBXNEXT-5342 Move inventory_mode to host object in host.get
-
- Closed
-
-
ZBX-16284 Configuration Export api call returns not consistent
-
- Closed
-
-
ZBX-16437 Host prototype inventory mode is not included in export file.
-
- Closed
-