[icinga-checkins] icinga.org: icinga-api/master: * ido: added custom variables to queries including contact joins

git at icinga.org git at icinga.org
Wed Jan 13 11:29:41 CET 2010


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

Author: Christian Doebler <christian.doebler at netways.de>
Date:   Wed Jan 13 11:28:22 2010 +0100

* ido: added custom variables to queries including contact joins

---

 .../data_interfaces/IcingaApiSearchIdoMysql.php    |    7 +++++++
 .../data_interfaces/IcingaApiSearchIdoOci.php      |    7 +++++++
 .../data_interfaces/IcingaApiSearchIdoPgsql.php    |    7 +++++++
 3 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/objects/search/data_interfaces/IcingaApiSearchIdoMysql.php b/objects/search/data_interfaces/IcingaApiSearchIdoMysql.php
index c3bdbb3..358b189 100644
--- a/objects/search/data_interfaces/IcingaApiSearchIdoMysql.php
+++ b/objects/search/data_interfaces/IcingaApiSearchIdoMysql.php
@@ -43,6 +43,7 @@ class IcingaApiSearchIdoMysql
 			${if_table:hg,hgm:inner join ${TABLE_PREFIX}hostgroups hg on hg.hostgroup_id = hgm.hostgroup_id}
 			${if_table:ohg,hg,hgm:inner join ${TABLE_PREFIX}objects ohg on ohg.object_id = hg.hostgroup_object_id}
 			${if_table:cvsh,oh:inner join ${TABLE_PREFIX}customvariablestatus cvsh on oh.object_id = cvsh.object_id}
+			${if_table:cvsc,oc,cgm,cg,hcg,h:inner join ${TABLE_PREFIX}customvariablestatus cvsc on oc.object_id = cvsc.object_id}
 			where
 				oh.objecttype_id = 1
 			${FILTER}
@@ -72,6 +73,7 @@ class IcingaApiSearchIdoMysql
 			${if_table:ohg,hg,hgm,oh,s:inner join ${TABLE_PREFIX}objects ohg on ohg.object_id = hg.hostgroup_object_id}
 			${if_table:cvsh,oh,s:inner join ${TABLE_PREFIX}customvariablestatus cvsh on oh.object_id = cvsh.object_id}
 			${if_table:cvss:inner join ${TABLE_PREFIX}customvariablestatus cvss on os.object_id = cvss.object_id}
+			${if_table:cvsc,oc,cgm,cg,scg,s:inner join ${TABLE_PREFIX}customvariablestatus cvsc on oc.object_id = cvsc.object_id}
 			where
 				os.objecttype_id = 2
 			${FILTER}
@@ -114,6 +116,7 @@ class IcingaApiSearchIdoMysql
 			${if_table:cg:inner join ${TABLE_PREFIX}contactgroups cg on cg.contactgroup_object_id = ocg.object_id}
 			${if_table:cgm,cg:inner join ${TABLE_PREFIX}contactgroup_members cgm on cgm.contactgroup_id = cg.contactgroup_id}
 			${if_table:oc,cgm,cg:inner join ${TABLE_PREFIX}objects oc on oc.object_id = cgm.contact_object_id and oc.objecttype_id = 10}
+			${if_table:cvsc,oc,cgm,cg:inner join ${TABLE_PREFIX}customvariablestatus cvsc on oc.object_id = cvsc.object_id}
 			where
 				ocg.objecttype_id = 11
 			${FILTER}
@@ -192,6 +195,7 @@ class IcingaApiSearchIdoMysql
 			${if_table:hg,hgm,oh:inner join ${TABLE_PREFIX}hostgroups hg on hg.hostgroup_id = hgm.hostgroup_id}
 			${if_table:ohg,hg,hgm,oh:inner join ${TABLE_PREFIX}objects ohg on ohg.object_id = hg.hostgroup_object_id}
 			${if_table:cvsh,oh:inner join ${TABLE_PREFIX}customvariablestatus cvsh on oh.object_id = cvsh.object_id}
+			${if_table:cvsc,oc,cgm,cg,hcg,h,oh:-- inner join ${TABLE_PREFIX}customvariablestatus cvsc on oc.object_id = cvsc.object_id}
 			where 1
 			${FILTER}
 			group by
@@ -218,6 +222,7 @@ class IcingaApiSearchIdoMysql
 			${if_table:ohg,hg,hgm,oh,s,os:inner join ${TABLE_PREFIX}objects ohg on ohg.object_id = hg.hostgroup_object_id}
 			${if_table:cvsh,oh,s,os:inner join ${TABLE_PREFIX}customvariablestatus cvsh on oh.object_id = cvsh.object_id}
 			${if_table:cvss,os:inner join ${TABLE_PREFIX}customvariablestatus cvss on os.object_id = cvss.object_id}
+			${if_table:cvsc,oc,cgm,cg,scg,s,os:-- inner join ${TABLE_PREFIX}customvariablestatus cvsc on oc.object_id = cvsc.object_id}
 			where 1
 			${FILTER}
 			group by
@@ -348,6 +353,8 @@ class IcingaApiSearchIdoMysql
 
 		// Contact data
 		'CONTACT_NAME' => array('oc', 'name1'),
+		'CONTACT_CUSTOMVARIABLE_NAME' => array('cvsc', 'varname'),
+		'CONTACT_CUSTOMVARIABLE_VALUE' => array('cvsc', 'varvalue'),
 
 		// Timeperiod data
 		'TIMEPERIOD_ID' => array('tp', 'timeperiod_id'),
diff --git a/objects/search/data_interfaces/IcingaApiSearchIdoOci.php b/objects/search/data_interfaces/IcingaApiSearchIdoOci.php
index 542d091..6be2bbe 100644
--- a/objects/search/data_interfaces/IcingaApiSearchIdoOci.php
+++ b/objects/search/data_interfaces/IcingaApiSearchIdoOci.php
@@ -51,6 +51,7 @@ class IcingaApiSearchIdoOci
 			${if_table:hg,hgm:inner join ${TABLE_PREFIX}hostgroups hg on hg.id = hgm.hostgroup_id}
 			${if_table:ohg,hg,hgm: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:inner join ${TABLE_PREFIX}customvariablestatus cvsc on oc.id = cvsc.object_id}
 			where
 				oh.objecttype_id = 1
 			${FILTER}
@@ -80,6 +81,7 @@ class IcingaApiSearchIdoOci
 			${if_table:ohg,hg,hgm,oh,s:inner join ${TABLE_PREFIX}objects ohg on ohg.id = hg.hostgroup_object_id}
 			${if_table:cvsh,oh,s:inner join ${TABLE_PREFIX}customvariablestatus cvsh on oh.id = cvsh.object_id}
 			${if_table:cvss:inner join ${TABLE_PREFIX}customvariablestatus cvss on os.id = cvss.object_id}
+			${if_table:cvsc,oc,cgm,cg,scg,s:inner join ${TABLE_PREFIX}customvariablestatus cvsc on oc.id = cvsc.object_id}
 			where
 				os.objecttype_id = 2
 			${FILTER}
@@ -122,6 +124,7 @@ class IcingaApiSearchIdoOci
 			${if_table:cg:inner join ${TABLE_PREFIX}contactgroups cg on cg.contactgroup_object_id = ocg.id}
 			${if_table:cgm,cg:inner join ${TABLE_PREFIX}contactgroup_members cgm on cgm.contactgroup_id = cg.id}
 			${if_table:oc,cgm,cg:inner join ${TABLE_PREFIX}objects oc on oc.id = cgm.contact_object_id and oc.objecttype_id = 10}
+			${if_table:cvsc,oc,cgm,cg:inner join ${TABLE_PREFIX}customvariablestatus cvsc on oc.id = cvsc.object_id}
 			where
 				ocg.objecttype_id = 11
 			${FILTER}
@@ -200,6 +203,7 @@ class IcingaApiSearchIdoOci
 			${if_table:hg,hgm,oh:inner join ${TABLE_PREFIX}hostgroups hg on hg.id = hgm.hostgroup_id}
 			${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}
 			where 1
 			${FILTER}
 			group by
@@ -226,6 +230,7 @@ class IcingaApiSearchIdoOci
 			${if_table:ohg,hg,hgm,oh,s,os:inner join ${TABLE_PREFIX}objects ohg on ohg.id = hg.hostgroup_object_id}
 			${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}
 			where 1
 			${FILTER}
 			group by
@@ -356,6 +361,8 @@ class IcingaApiSearchIdoOci
 
 		// Contact data
 		'CONTACT_NAME' => array('oc', 'name1'),
+		'CONTACT_CUSTOMVARIABLE_NAME' => array('cvsc', 'varname'),
+		'CONTACT_CUSTOMVARIABLE_VALUE' => array('cvsc', 'varvalue'),
 
 		// Timeperiod data
 		'TIMEPERIOD_ID' => array('tp', 'id'),
diff --git a/objects/search/data_interfaces/IcingaApiSearchIdoPgsql.php b/objects/search/data_interfaces/IcingaApiSearchIdoPgsql.php
index 770be4c..319e04a 100644
--- a/objects/search/data_interfaces/IcingaApiSearchIdoPgsql.php
+++ b/objects/search/data_interfaces/IcingaApiSearchIdoPgsql.php
@@ -43,6 +43,7 @@ class IcingaApiSearchIdoPgsql
 			${if_table:hg,hgm:inner join ${TABLE_PREFIX}hostgroups hg on hg.hostgroup_id = hgm.hostgroup_id}
 			${if_table:ohg,hg,hgm:inner join ${TABLE_PREFIX}objects ohg on ohg.object_id = hg.hostgroup_object_id}
 			${if_table:cvsh,oh:inner join ${TABLE_PREFIX}customvariablestatus cvsh on oh.object_id = cvsh.object_id}
+			${if_table:cvsc,oc,cgm,cg,hcg,h:inner join ${TABLE_PREFIX}customvariablestatus cvsc on oc.object_id = cvsc.object_id}
 			where
 				oh.objecttype_id = 1
 			${FILTER}
@@ -72,6 +73,7 @@ class IcingaApiSearchIdoPgsql
 			${if_table:ohg,hg,hgm,oh,s:inner join ${TABLE_PREFIX}objects ohg on ohg.object_id = hg.hostgroup_object_id}
 			${if_table:cvsh,oh,s:inner join ${TABLE_PREFIX}customvariablestatus cvsh on oh.object_id = cvsh.object_id}
 			${if_table:cvss:inner join ${TABLE_PREFIX}customvariablestatus cvss on os.object_id = cvss.object_id}
+			${if_table:cvsc,oc,cgm,cg,scg,s:inner join ${TABLE_PREFIX}customvariablestatus cvsc on oc.object_id = cvsc.object_id}
 			where
 				os.objecttype_id = 2
 			${FILTER}
@@ -114,6 +116,7 @@ class IcingaApiSearchIdoPgsql
 			${if_table:cg:inner join ${TABLE_PREFIX}contactgroups cg on cg.contactgroup_object_id = ocg.object_id}
 			${if_table:cgm,cg:inner join ${TABLE_PREFIX}contactgroup_members cgm on cgm.contactgroup_id = cg.contactgroup_id}
 			${if_table:oc,cgm,cg:inner join ${TABLE_PREFIX}objects oc on oc.object_id = cgm.contact_object_id and oc.objecttype_id = 10}
+			${if_table:cvsc,oc,cgm,cg:inner join ${TABLE_PREFIX}customvariablestatus cvsc on oc.object_id = cvsc.object_id}
 			where
 				ocg.objecttype_id = 11
 			${FILTER}
@@ -192,6 +195,7 @@ class IcingaApiSearchIdoPgsql
 			${if_table:hg,hgm,oh:inner join ${TABLE_PREFIX}hostgroups hg on hg.hostgroup_id = hgm.hostgroup_id}
 			${if_table:ohg,hg,hgm,oh:inner join ${TABLE_PREFIX}objects ohg on ohg.object_id = hg.hostgroup_object_id}
 			${if_table:cvsh,oh:inner join ${TABLE_PREFIX}customvariablestatus cvsh on oh.object_id = cvsh.object_id}
+			${if_table:cvsc,oc,cgm,cg,hcg,h,oh:-- inner join ${TABLE_PREFIX}customvariablestatus cvsc on oc.object_id = cvsc.object_id}
 			where 1
 			${FILTER}
 			group by
@@ -218,6 +222,7 @@ class IcingaApiSearchIdoPgsql
 			${if_table:ohg,hg,hgm,oh,s,os:inner join ${TABLE_PREFIX}objects ohg on ohg.object_id = hg.hostgroup_object_id}
 			${if_table:cvsh,oh,s,os:inner join ${TABLE_PREFIX}customvariablestatus cvsh on oh.object_id = cvsh.object_id}
 			${if_table:cvss,os:inner join ${TABLE_PREFIX}customvariablestatus cvss on os.object_id = cvss.object_id}
+			${if_table:cvsc,oc,cgm,cg,scg,s,os:-- inner join ${TABLE_PREFIX}customvariablestatus cvsc on oc.object_id = cvsc.object_id}
 			where 1
 			${FILTER}
 			group by
@@ -348,6 +353,8 @@ class IcingaApiSearchIdoPgsql
 
 		// Contact data
 		'CONTACT_NAME' => array('oc', 'name1'),
+		'CONTACT_CUSTOMVARIABLE_NAME' => array('cvsc', 'varname'),
+		'CONTACT_CUSTOMVARIABLE_VALUE' => array('cvsc', 'varvalue'),
 
 		// Timeperiod data
 		'TIMEPERIOD_ID' => array('tp', 'timeperiod_id'),





More information about the icinga-checkins mailing list