[Nagios-devel] Temporary searchgroup patch

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

[Nagios-devel] Temporary searchgroup patch

Post by Guest »

Nice! I was looking to get around to writing such a patch myself :)

----
Larry Low

-----Original Message-----
From: [email protected] [mailto:nagios-devel-bounc=
[email protected]] On Behalf Of Armin Wolfermann
Sent: Wednesday, July 02, 2008 6:34 AM
To: [email protected]
Subject: [Nagios-devel] Temporary searchgroup patch

Hi,

this patch changes the search function (via Show Host:) to show all
hosts with a common prefix in a temporary hostgroup. Maybe this is
useful for other nagios users as well.

Index: cgi/status.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/nagios/nagios/cgi/status.c,v
retrieving revision 1.75
diff -u -r1.75 status.c
--- cgi/status.c 23 Jun 2008 20:47:46 -0000 1.75
+++ cgi/status.c 2 Jul 2008 13:18:58 -0000
@@ -186,7 +186,7 @@
host *temp_host=3DNULL;
hostgroup *temp_hostgroup=3DNULL;
servicegroup *temp_servicegroup=3DNULL;
-
+
time(&current_time);

/* get the arguments passed in the URL */
@@ -241,45 +241,23 @@
get_authentication_information(&current_authdata);

/* if a navbar search was performed, find the host by name, address=
or partial name */
- if(navbar_search=3D=3DTRUE){
- if((temp_host=3Dfind_host(host_name))=3D=3DNULL){
- for(temp_host=3Dhost_list;temp_host!=3DNULL;temp_ho=
st=3Dtemp_host->next){
- if(is_authorized_for_host(temp_host,&curren=
t_authdata)=3D=3DFALSE)
- continue;
- if(!strcmp(host_name,temp_host->address)){
- free(host_name);
- host_name=3Dstrdup(temp_host->name)=
;
- break;
- }
- }
- if(temp_host=3D=3DNULL){
- for(temp_host=3Dhost_list;temp_host!=3DNULL=
;temp_host=3Dtemp_host->next){
- if(is_authorized_for_host(temp_host=
,&current_authdata)=3D=3DFALSE)
- continue;
- if((strstr(temp_host->name,host_nam=
e)=3D=3Dtemp_host->name) || !strncasecmp(temp_host->name,host_name,strlen(h=
ost_name))){
- free(host_name);
- host_name=3Dstrdup(temp_hos=
t->name);
- break;
- }
- }
- }
- }
- /* last effort, search hostgroups then servicegroup=
s */
- if(temp_host=3D=3DNULL){
- if((temp_hostgroup=3Dfind_hostgroup(host_na=
me))!=3DNULL){
- display_type=3DDISPLAY_HOSTGROUPS;
- show_all_hostgroups=3DFALSE;
- free(host_name);
- hostgroup_name=3Dstrdup(temp_hostgr=
oup->group_name);
- }
- else if((temp_servicegroup=3Dfind_servicegr=
oup(host_name))!=3DNULL){
- display_type=3DDISPLAY_SERVICEGROUP=
S;
- show_all_servicegroups=3DFALSE;
- free(host_name);
- servicegroup_name=3Dstrdup(temp_ser=
vicegroup->group_name);
- }
+ if(navbar_search=3D=3DTRUE) {
+ display_type =3D DISPLAY_HOSTGROUPS;
+ group_style_type =3D STYLE_DETAIL;
+ show_all_hostgroups =3D FALSE;
+ displa

...[email truncated]...


This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected] [mailto:nagios-devel-bounc
Locked