navbar search box

Marc Powell marc at ena.com
Thu Jun 8 20:13:50 CEST 2006



> -----Original Message-----
> From: nagios-devel-bounces at lists.sourceforge.net [mailto:nagios-devel-
> bounces at lists.sourceforge.net] On Behalf Of dtownrobbrown at gmail.com
> Sent: Thursday, June 08, 2006 12:56 PM
> To: nagios-devel at lists.sourceforge.net
> Subject: [Nagios-devel] navbar search box
> 
> Can anyone tell me how to make the navbarsearch box (Show Host on
> side.html) only return EXACT results for either host name or hostgroup
> name?
> For example:
> I have a hostgroup called xyz consisting of the following servers:
> serverxyz01
> serverxyz02
> serverxyz03
> If I type "xyz" into the search box, it returns serverxyz01 instead of
the
> hostgroup xyz.
> I assume it is just doing a "grep" style search and returning the
first
> host it finds.
> I would like it to operate like this:
> search hosts for exact match "xyz"
> if no exact match found in hosts, proceed to hostgroups,
servicegroups,
> etc. for exact name match.

Untested but in status.c, change line 253 from 

if((strstr(temp_host->name,host_name)==temp_host->name) ||
!strncasecmp(temp_host->name,host_name,strlen(host_name))){

to 

if(!strncasecmp(temp_host->name,host_name,strlen(host_name))){

That will eliminate the substring search.

--
Marc




More information about the Developers mailing list