[icinga-checkins] icinga.org: icinga-api/master: * Group summary query fixes for config_type

git at icinga.org git at icinga.org
Thu Jan 20 10:11:23 CET 2011


Module: icinga-api
Branch: master
Commit: 8c97831e03c97521946d34b05e1930ca620066c1
URL:    https://git.icinga.org/?p=icinga-api.git;a=commit;h=8c97831e03c97521946d34b05e1930ca620066c1

Author: Marius Hein <marius.hein at netways.de>
Date:   Thu Jan 20 10:10:55 2011 +0100

* Group summary query fixes for config_type

---

 .../data_interfaces/IcingaApiSearchIdoMysql.php    |   16 ++++++++--------
 .../data_interfaces/IcingaApiSearchIdoOci.php      |   14 ++++++++------
 .../data_interfaces/IcingaApiSearchIdoOci8.php     |    8 ++++----
 .../data_interfaces/IcingaApiSearchIdoPgsql.php    |    6 ++++--
 4 files changed, 24 insertions(+), 20 deletions(-)

diff --git a/objects/search/data_interfaces/IcingaApiSearchIdoMysql.php b/objects/search/data_interfaces/IcingaApiSearchIdoMysql.php
index 6c15a9b..46fd456 100644
--- a/objects/search/data_interfaces/IcingaApiSearchIdoMysql.php
+++ b/objects/search/data_interfaces/IcingaApiSearchIdoMysql.php
@@ -191,8 +191,8 @@ implements IcingaApiSearchIdoInterface {
 				${FIELDS:hs.current_state HOST_STATE, count(hs.current_state) COUNT}
 			from
 				${TABLE_PREFIX}hoststatus hs
-			${if_table:oh:inner join ${TABLE_PREFIX}objects oh on oh.object_id = hs.host_object_id}
-			${if_table:h,oh:inner join ${TABLE_PREFIX}hosts h on h.host_object_id = oh.object_id}
+			inner join ${TABLE_PREFIX}objects oh on oh.object_id = hs.host_object_id
+			inner join ${TABLE_PREFIX}hosts h on h.host_object_id = oh.object_id
 			${if_table:i,h,oh:inner join ${TABLE_PREFIX}instances i on i.instance_id = h.instance_id}
 			${if_table:hcg,h,oh:-- inner join ${TABLE_PREFIX}host_contactgroups hcg on hcg.host_id = h.host_id}
 			${if_table:cg,hcg,h,oh:-- inner join ${TABLE_PREFIX}contactgroups cg on cg.contactgroup_object_id = hcg.contactgroup_object_id}
@@ -209,8 +209,8 @@ implements IcingaApiSearchIdoInterface {
 			${if_table:osg,sg,sgm:left join ${TABLE_PREFIX}servicegroup_members sgm on sgm.service_object_id = s.service_object_id}
 			${if_table:osg,sg,sgm:left join ${TABLE_PREFIX}servicegroups sg on sg.servicegroup_id = sgm.servicegroup_id}
 			${if_table:osg,sg,sgm:left join ${TABLE_PREFIX}objects osg on osg.object_id = sg.servicegroup_object_id}
-
-			${FILTER}
+			where h.config_type=1
+			${FILTER_AND}
 			group by
 				hs.current_state
 			${ORDERBY:hs.current_state}
@@ -220,8 +220,8 @@ implements IcingaApiSearchIdoInterface {
 				${FIELDS:ss.current_state SERVICE_STATE, count(ss.current_state) COUNT}
 			from
 				${TABLE_PREFIX}servicestatus ss
-			${if_table:os:inner join ${TABLE_PREFIX}objects os on os.object_id = ss.service_object_id}
-			${if_table:s,os:inner join ${TABLE_PREFIX}services s on s.service_object_id = os.object_id}
+			inner join ${TABLE_PREFIX}objects os on os.object_id = ss.service_object_id
+			inner join ${TABLE_PREFIX}services s on s.service_object_id = os.object_id
 			${if_table:i,s,os:inner join ${TABLE_PREFIX}instances i on i.instance_id = s.instance_id}
 			${if_table:scg,s,os:-- inner join ${TABLE_PREFIX}service_contactgroups scg on scg.service_id = s.service_id}
 			${if_table:cg,scg,s,os:-- inner join ${TABLE_PREFIX}contactgroups cg on cg.contactgroup_object_id = scg.contactgroup_object_id}
@@ -240,8 +240,8 @@ implements IcingaApiSearchIdoInterface {
 			${if_table:sgm,os:left join ${TABLE_PREFIX}servicegroup_members sgm on sgm.service_object_id = os.object_id}
 			${if_table:sg,sgm,os:left join ${TABLE_PREFIX}servicegroups sg on sg.servicegroup_id = sgm.servicegroup_id}
 			${if_table:osg,sg,sgm,os:left join ${TABLE_PREFIX}objects osg on osg.object_id = sg.servicegroup_object_id}
-
-			${FILTER}
+			where s.config_type=1
+			${FILTER_AND}
 			group by
 				ss.current_state
 			${ORDERBY:ss.current_state}
diff --git a/objects/search/data_interfaces/IcingaApiSearchIdoOci.php b/objects/search/data_interfaces/IcingaApiSearchIdoOci.php
index 355c6e8..03e8763 100644
--- a/objects/search/data_interfaces/IcingaApiSearchIdoOci.php
+++ b/objects/search/data_interfaces/IcingaApiSearchIdoOci.php
@@ -197,8 +197,8 @@ class IcingaApiSearchIdoOci
 				${FIELDS:hs.current_state HOST_STATE, count(hs.current_state) COUNT}
 			from
 				${TABLE_PREFIX}hoststatus hs
-			${if_table:oh:inner join ${TABLE_PREFIX}objects oh on oh.id = hs.host_object_id}
-			${if_table:h,oh:inner join ${TABLE_PREFIX}hosts h on h.host_object_id = oh.id}
+			inner join ${TABLE_PREFIX}objects oh on oh.id = hs.host_object_id
+			inner join ${TABLE_PREFIX}hosts h on h.host_object_id = oh.id
 			${if_table:i,h,oh:inner join ${TABLE_PREFIX}instances i on i.id = h.instance_id}
 			${if_table:hcg,h,oh:-- inner join ${TABLE_PREFIX}host_contactgroups hcg on hcg.host_id = h.id}
 			${if_table:cg,hcg,h,oh:-- inner join ${TABLE_PREFIX}contactgroups cg on cg.contactgroup_object_id = hcg.contactgroup_object_id}
@@ -210,7 +210,8 @@ class IcingaApiSearchIdoOci
 			${if_table:ohg,hg,hgm,oh:inner join ${TABLE_PREFIX}objects ohg on ohg.id = hg.hostgroup_object_id}
 			${if_table:cvsh,oh:inner join ${TABLE_PREFIX}customvariablestatus cvsh on oh.id = cvsh.object_id}
 			${if_table:cvsc,oc,cgm,cg,hcg,h,oh:-- inner join ${TABLE_PREFIX}customvariablestatus cvsc on oc.id = cvsc.object_id}
-			${FILTER}
+			where h.config_type=1
+			${FILTER_AND}
 			group by
 				hs.current_state
 			${ORDERBY:hs.current_state}
@@ -220,8 +221,8 @@ class IcingaApiSearchIdoOci
 				${FIELDS:ss.current_state SERVICE_STATE, count(ss.current_state) COUNT}
 			from
 				${TABLE_PREFIX}servicestatus ss
-			${if_table:os:inner join ${TABLE_PREFIX}objects os on os.id = ss.service_object_id}
-			${if_table:s,os:inner join ${TABLE_PREFIX}services s on s.service_object_id = os.id}
+			inner join ${TABLE_PREFIX}objects os on os.id = ss.service_object_id
+			inner join ${TABLE_PREFIX}services s on s.service_object_id = os.id
 			${if_table:i,s,os:inner join ${TABLE_PREFIX}instances i on i.id = s.instance_id}
 			${if_table:scg,s,os:-- inner join ${TABLE_PREFIX}service_contactgroups scg on scg.service_id = s.id}
 			${if_table:cg,scg,s,os:-- inner join ${TABLE_PREFIX}contactgroups cg on cg.contactgroup_object_id = scg.contactgroup_object_id}
@@ -236,7 +237,8 @@ class IcingaApiSearchIdoOci
 			${if_table:cvsh,oh,s,os:inner join ${TABLE_PREFIX}customvariablestatus cvsh on oh.id = cvsh.object_id}
 			${if_table:cvss,os:inner join ${TABLE_PREFIX}customvariablestatus cvss on os.id = cvss.object_id}
 			${if_table:cvsc,oc,cgm,cg,scg,s,os:--inner join ${TABLE_PREFIX}customvariablestatus cvsc on oc.id = cvsc.object_id}
-			${FILTER}
+			where s.config_type=1
+			${FILTER_AND}
 			group by
 				ss.current_state
 			${ORDERBY:ss.current_state}
diff --git a/objects/search/data_interfaces/IcingaApiSearchIdoOci8.php b/objects/search/data_interfaces/IcingaApiSearchIdoOci8.php
index 4761b7a..40b0f35 100644
--- a/objects/search/data_interfaces/IcingaApiSearchIdoOci8.php
+++ b/objects/search/data_interfaces/IcingaApiSearchIdoOci8.php
@@ -219,8 +219,8 @@ class IcingaApiSearchIdoOci8
 			${if_table:ohg,hg,hgm,oh:inner join ${TABLE_PREFIX}objects ohg on ohg.id = hg.hostgroup_object_id}
 			${if_table:cvsh,oh:inner join ${TABLE_PREFIX}customvariablestatus cvsh on oh.id = cvsh.id}
 			${if_table:cvsc,oc,cgm,cg,hcg,h,oh: inner join ${TABLE_PREFIX}customvariablestatus cvsc on oc.id = cvsc.id}
-			
-			${FILTER}
+			where h.config_type=1
+			${FILTER_AND}
 			group by
 				hs.current_state
 			${ORDERBY:hs.current_state}
@@ -248,8 +248,8 @@ class IcingaApiSearchIdoOci8
 			${if_table:cvss,os:inner join ${TABLE_PREFIX}customvariablestatus cvss on os.id = cvss.id}
 			${if_table:cvsc,oc,cgm,cg,scg,s,os:inner join ${TABLE_PREFIX}customvariablestatus cvsc on oc.id = cvsc.id}
 			left join ${TABLE_PREFIX}objects osg on osg.id = h.host_object_id and osg.is_active = 1
-			
-			${FILTER}
+			where s.config_type=1
+			${FILTER_AND}
 			group by
 				ss.current_state
 			${ORDERBY:ss.current_state}
diff --git a/objects/search/data_interfaces/IcingaApiSearchIdoPgsql.php b/objects/search/data_interfaces/IcingaApiSearchIdoPgsql.php
index 5ea26ac..2245380 100644
--- a/objects/search/data_interfaces/IcingaApiSearchIdoPgsql.php
+++ b/objects/search/data_interfaces/IcingaApiSearchIdoPgsql.php
@@ -203,7 +203,8 @@ class IcingaApiSearchIdoPgsql
 			${if_table:ohg,hg,hgm,oh:inner join ${TABLE_PREFIX}objects AS ohg on ohg.object_id = hg.hostgroup_object_id}
 			${if_table:cvsh,oh:inner join ${TABLE_PREFIX}customvariablestatus AS cvsh on oh.object_id = cvsh.object_id}
 			${if_table:cvsc,oc,cgm,cg,hcg,h,oh:-- inner join ${TABLE_PREFIX}customvariablestatus AS cvsc on oc.object_id = cvsc.object_id}
-			${FILTER}
+			where h.config_type=1
+			${FILTER_AND}
 			group by
 				hs.current_state
 			${ORDERBY:hs.current_state}
@@ -229,7 +230,8 @@ class IcingaApiSearchIdoPgsql
 			${if_table:cvsh,oh,s,os:inner join ${TABLE_PREFIX}customvariablestatus AS cvsh on oh.object_id = cvsh.object_id}
 			${if_table:cvss,os:inner join ${TABLE_PREFIX}customvariablestatus AS cvss on os.object_id = cvss.object_id}
 			${if_table:cvsc,oc,cgm,cg,scg,s,os:-- inner join ${TABLE_PREFIX}customvariablestatus AS cvsc on oc.object_id = cvsc.object_id}
-			${FILTER}
+			where s.config_type=1
+			${FILTER_AND}
 			group by
 				ss.current_state
 			${ORDERBY:ss.current_state}





More information about the icinga-checkins mailing list