Hi,
I upgraded my Zabbix environment from 6.0.10 to 6.0.12 and I noticed one of my scripts stopped working. I troubleshooted the issue and it was caused by the 'excludeSearch' parameter when using the Zabbix API to get hosts (host.get). Zabbix seems to ignore the value of the 'excludeSearch' param and it always just returns hosts that match the value of my 'search' parameter. In other words, if I wants to exclude the value of a 'search' by setting the 'excludeSearch' to true, Zabbix just ignores that and it only returns whichever host that match the value of my 'search' parameter.
For instance, here is my payload for the call
With this payload, I would expect Zabbix to return all hosts whose name (visible name) does not contain the word ".local", but Zabbix does the opposite and it only shows me hosts whose visible name contains that word. Changing the value of 'excludeSearch' to 'true', 'false', true or false makes absolutely no difference and Zabbix just returns whatever matches my search. In other words, it is not possible to return hosts those search value is excluded, only included.
I tested this with multiple values and combinations, but Zabbix always returned whatever I had in the search parameter only. Now I have to get all hosts and then in code filter out the hosts whose visible name contain the word '.local', which is not too bad but it was better when I could have Zabbix exclude them from me using the 'search' and 'excludeSearch' parameters.
Could you guys confirm this bug? maybe it is a feature that was removed? if so, your documentation still lists that 'excludeSearch' parameter.
Thank you​
I upgraded my Zabbix environment from 6.0.10 to 6.0.12 and I noticed one of my scripts stopped working. I troubleshooted the issue and it was caused by the 'excludeSearch' parameter when using the Zabbix API to get hosts (host.get). Zabbix seems to ignore the value of the 'excludeSearch' param and it always just returns hosts that match the value of my 'search' parameter. In other words, if I wants to exclude the value of a 'search' by setting the 'excludeSearch' to true, Zabbix just ignores that and it only returns whichever host that match the value of my 'search' parameter.
For instance, here is my payload for the call
Code:
{
"jsonrpc": "2.0",
"method": "host.get",
"params": {
"limit":5,
"excludeSearch": true,
"output": [
"hostid",
"host",
"name"
],
"search": {
"name": ".local"
}
},
"id": 1,
"auth": "xyz"
}
I tested this with multiple values and combinations, but Zabbix always returned whatever I had in the search parameter only. Now I have to get all hosts and then in code filter out the hosts whose visible name contain the word '.local', which is not too bad but it was better when I could have Zabbix exclude them from me using the 'search' and 'excludeSearch' parameters.
Could you guys confirm this bug? maybe it is a feature that was removed? if so, your documentation still lists that 'excludeSearch' parameter.
Thank you​
Comment