[ZBX-4392] Hostgroup wildcard searches fail Created: 2011 Nov 25  Updated: 2017 May 30  Resolved: 2011 Nov 25

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: API (A)
Affects Version/s: 1.8.9
Fix Version/s: None

Type: Incident report Priority: Minor
Reporter: Max Lock Assignee: Unassigned
Resolution: Cannot Reproduce Votes: 0
Labels: api, hostgroup, search
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

RHEL 5.5



 Description   

Hostgroup wildcard searches do not return any hostgroups, the following JSON request is correct as per the API documentation. I have also tried with a percent symbol as the wildcard character. api version is reported as 1.3

{"jsonrpc": "2.0", "method":"hostgroup.get","params": {"output": "extend", "search":

{"name": "Template*"}

,"searchWildcardsEnabled":1},"auth": "XXXXX", "id": 0}

Should return the Templates group, but returns an empty array. Removing the wildcard character, but leaving the searchWildcardsEnabled flag enabled returns all hostgroups with Template anywhere in the name.

It should be possible to search for 'Templ*' or 'Templ%' and have the Templates group returned. This is not currently the case.



 Comments   
Comment by Max Lock [ 2011 Nov 25 ]

Forgot to mention, my goal for this is to be able to match hostgroups that begin with 'Live' for example 'Live web hosts' and not 'web hosts Live'. Being able to specify regexes would be nirvana

Comment by Igor Danoshaites (Inactive) [ 2011 Nov 25 ]

Hi,

>my goal for this is to be able to match hostgroups that begin with 'Live' for example 'Live web hosts' and not 'web hosts Live'.

I just checked this in the latest revision from the 1.8 branch (rev #23507) and it is working in the way as you mentioned.

Using the following parameters {"output": "extend", "search":

{"name": "Live*"}

,"searchWildcardsEnabled":1} for the "hostgroup.get" API method you will get all hostgroups that begins with "Live" text, but will not get hostgroups that will have word "Live" somewhere in the middle or in the end of the name.

Generated at Sat May 11 06:18:11 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.