Thruk icon indicating copy to clipboard operation
Thruk copied to clipboard

Quick Search field - how to customize or change for my own search field?

Open PepeOnAChair opened this issue 1 year ago • 4 comments

Hello,

I'd like to customize the results which Thruk Quick Search is printing. For example, I'd like it to print only hosts and hostgroups. And also it is important to be able to search by host IP address as well. Is that possible somehow, please?

So far I'm using original Nagios web interface with my own customized search field, which would be fine if I can reuse in Thruk again. (for searching, it uses shell script which is parsing Nagios config files)

Thank you Pep.

PepeOnAChair avatar Aug 20 '22 14:08 PepeOnAChair

You can use prefixes to directly search for hosts by using ho: prefix or hg: for histgroups. se is for services and sg for servicegroups. It is also possible to enter an ip address and it will show the matching hosts. But not in the preview, only in the search results itself.

sni avatar Aug 20 '22 16:08 sni

Thank you.

I tried what you wrote and it works. But unfortunatelly it is not what I was looking for. For normal user (not like admins) it is too hard to put ho, hg, ... in front of every search. I`d like to customize search and make it default behaviour. I tried to change some values in "thruk-2.48.2.js" in "SEARCH" section. For example I tried tyo change "search_type" parameter for "host, hostgroup, ho, hg, ..." but is seems it does not do any change.

Also IP address search would be greater if user can see what was found in preview.

What would be the best place to put my own search field, please? (my own search field is based on "Enhanced Host Search", but I modified it a lot, as it is really simple to use, as searching can be based on bash script) https://exchange.nagios.org/directory/Addons/Frontends-(GUIs-and-CLIs)/Web-Interfaces/CGI-Modifications/Enhanced-Host-Search/details

Pep.

PepeOnAChair avatar Aug 22 '22 10:08 PepeOnAChair

Thruks side navigation can be fully customized and this includes the search as well. In the end you can put arbitrary html into the navigation and do whatever html/js/css can do. See http://thruk.org/documentation/menu.html#_insert-arbitrary-html

There is also the concept of SSI which allows you again to inject any kind of html/js/css to any page. See http://thruk.org/documentation/ssi.html

sni avatar Aug 22 '22 16:08 sni