[icinga-checkins] icinga.org: icinga-core/mbrooks/cgis: Revert removal of iterative check for partial_hosts in show_hostgroup_overview
git at icinga.org
git at icinga.org
Fri Jul 29 12:02:27 CEST 2011
Module: icinga-core
Branch: mbrooks/cgis
Commit: 75b90297ebc38d93fb19eef995f032f143637831
URL: https://git.icinga.org/?p=icinga-core.git;a=commit;h=75b90297ebc38d93fb19eef995f032f143637831
Author: Matthew J. Brooks <matthew at sonomatechpartners.com>
Date: Fri Jul 29 02:58:56 2011 -0700
Revert removal of iterative check for partial_hosts in show_hostgroup_overview
refs #1013
---
cgi/status.c | 35 +++++++++++++++++++++++++++++++++++
1 files changed, 35 insertions(+), 0 deletions(-)
diff --git a/cgi/status.c b/cgi/status.c
index 2b08703..a40ff43 100644
--- a/cgi/status.c
+++ b/cgi/status.c
@@ -3768,11 +3768,46 @@ void show_hostgroup_overview(hostgroup *hstgrp){
hoststatus *temp_hoststatus=NULL;
int odd=0;
int json_start=TRUE;
+ int partial_hosts=FALSE;
/* make sure the user is authorized to view this hostgroup */
if(show_partial_hostgroups==FALSE && is_authorized_for_hostgroup(hstgrp,¤t_authdata)==FALSE)
return;
+ /* if we're showing partial hostgroups, find out if there will be any hosts that belong to the hostgroup */
+ if(show_partial_hostgroups==TRUE) {
+ for(temp_member=hstgrp->members;temp_member!=NULL;temp_member=temp_member->next){
+
+ /* find the host... */
+ temp_host=find_host(temp_member->host_name);
+ if(temp_host==NULL)
+ continue;
+
+ /* only shown in partial hostgroups if user is authorized to view this host */
+ if (is_authorized_for_host(temp_host,¤t_authdata)==FALSE)
+ continue;
+
+ /* find the host status */
+ temp_hoststatus=find_hoststatus(temp_host->name);
+ if(temp_hoststatus==NULL)
+ continue;
+
+ /* make sure we will only be displaying hosts of the specified status levels */
+ if(!(host_status_types & temp_hoststatus->status))
+ continue;
+
+ /* make sure we will only be displaying hosts that have the desired properties */
+ if(passes_host_properties_filter(temp_hoststatus)==FALSE)
+ continue;
+
+ partial_hosts=TRUE;
+ }
+ }
+
+ /* if we're showing partial hostgroups, but there are no hosts to display, there's nothing to see here */
+ if(show_partial_hostgroups==TRUE && partial_hosts==FALSE)
+ return;
+
/* print json format */
if(content_type==JSON_CONTENT) {
printf("{ \"hostgroup_name\": \"%s\",\n",json_encode(hstgrp->group_name));
More information about the icinga-checkins
mailing list