Hi.
I run hostgroup.get(hostids=xxxxxx) and get single group but three are expected. Tried both zabbix API and python module ZabbixAPI.
But in GUI and SQL this host is in three groups.
I checked other hostids and even other zabbix servers and similar requests return more than 1 group.
Python ZabbixAPI:
print(zapi.hostgroup.get(hostids="29320"))
Output:
[{'groupid': '48', 'name': 'Group3', 'internal': '0', 'flags': '0'}]
Postman API payload:
{
"jsonrpc": "2.0",
"method": "hostgroup.get",
"params": {
"hostids":"29320"
},
"auth": "74aae8378f7032f0a8c8ddfffee3800",
"id": 1
}
Output:
{
"jsonrpc": "2.0",
"result": [
{
"groupid": "48",
"name": "Group3",
"internal": "0",
"flags": "0"
}
],
"id": 1
}
BUT
SQL:
SELECT hosts.hostid, hosts.host,hg.groupid, hstgrp.name
from public.hosts
JOIN public.hosts_groups hg ON hosts.hostid = hg.hostid
JOIN public.hstgrp hstgrp ON hstgrp.groupid = hg.groupid
WHERE hosts.hostid =29320;
Output:
29320 "PSXXXXXXX_PSS" 79 "Group1"
29320 "PSXXXXXXX_PSS" 82 "Group2"
29320 "PSXXXXXXX_PSS" 48 "Group3"
Zabbix 5.0.2
DB postgresql-server-12.1-2.module_el8.1.0+273+979c16e6.x86_64
CentOS Linux release 8.2.2004
Do I use API wrong?
Regards.
I run hostgroup.get(hostids=xxxxxx) and get single group but three are expected. Tried both zabbix API and python module ZabbixAPI.
But in GUI and SQL this host is in three groups.
I checked other hostids and even other zabbix servers and similar requests return more than 1 group.
Python ZabbixAPI:
print(zapi.hostgroup.get(hostids="29320"))
Output:
[{'groupid': '48', 'name': 'Group3', 'internal': '0', 'flags': '0'}]
Postman API payload:
{
"jsonrpc": "2.0",
"method": "hostgroup.get",
"params": {
"hostids":"29320"
},
"auth": "74aae8378f7032f0a8c8ddfffee3800",
"id": 1
}
Output:
{
"jsonrpc": "2.0",
"result": [
{
"groupid": "48",
"name": "Group3",
"internal": "0",
"flags": "0"
}
],
"id": 1
}
BUT
SQL:
SELECT hosts.hostid, hosts.host,hg.groupid, hstgrp.name
from public.hosts
JOIN public.hosts_groups hg ON hosts.hostid = hg.hostid
JOIN public.hstgrp hstgrp ON hstgrp.groupid = hg.groupid
WHERE hosts.hostid =29320;
Output:
29320 "PSXXXXXXX_PSS" 79 "Group1"
29320 "PSXXXXXXX_PSS" 82 "Group2"
29320 "PSXXXXXXX_PSS" 48 "Group3"
Zabbix 5.0.2
DB postgresql-server-12.1-2.module_el8.1.0+273+979c16e6.x86_64
CentOS Linux release 8.2.2004
Do I use API wrong?
Regards.
I just ran a random host ID and got all 4 groups back as it is supposed to (v4.4 here)
Comment