[icinga-checkins] icinga.org: icinga-api/cdoebler/default: * added custom variables to host and service queries (pgsql)

git at icinga.org git at icinga.org
Tue Jan 12 15:47:05 CET 2010


Module: icinga-api
Branch: cdoebler/default
Commit: bcc32c778b36be14dbdf02c0c47eaf8b96745f68
URL:    https://git.icinga.org/?p=icinga-api.git;a=commit;h=bcc32c778b36be14dbdf02c0c47eaf8b96745f68

Author: Christian Doebler <christian.doebler at netways.de>
Date:   Tue Jan 12 15:46:46 2010 +0100

* added custom variables to host and service queries (pgsql)

---

 .../data_interfaces/IcingaApiSearchIdoPgsql.php    |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/objects/search/data_interfaces/IcingaApiSearchIdoPgsql.php b/objects/search/data_interfaces/IcingaApiSearchIdoPgsql.php
index e59099b..7c6170a 100644
--- a/objects/search/data_interfaces/IcingaApiSearchIdoPgsql.php
+++ b/objects/search/data_interfaces/IcingaApiSearchIdoPgsql.php
@@ -42,6 +42,7 @@ class IcingaApiSearchIdoPgsql
 			${if_table:hgm:inner join ${TABLE_PREFIX}hostgroup_members hgm on hgm.host_object_id = oh.object_id}
 			${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:cvh,oh:inner join ${TABLE_PREFIX}customvariables cvh on oh.object_id = cvh.object_id}
 			where
 				oh.objecttype_id = 1
 			${FILTER}
@@ -69,6 +70,8 @@ class IcingaApiSearchIdoPgsql
 			${if_table:hgm,oh,s:inner join ${TABLE_PREFIX}hostgroup_members hgm on hgm.host_object_id = oh.object_id}
 			${if_table:hg,hgm,oh,s:inner join ${TABLE_PREFIX}hostgroups hg on hg.hostgroup_id = hgm.hostgroup_id}
 			${if_table:ohg,hg,hgm,oh,s:inner join ${TABLE_PREFIX}objects ohg on ohg.object_id = hg.hostgroup_object_id}
+			${if_table:cvh,oh,s:inner join ${TABLE_PREFIX}customvariables cvh on oh.object_id = cvh.object_id}
+			${if_table:cvs:inner join ${TABLE_PREFIX}customvariables cvs on os.object_id = cvs.object_id}
 			where
 				os.objecttype_id = 2
 			${FILTER}
@@ -185,11 +188,10 @@ class IcingaApiSearchIdoPgsql
 			${if_table:ocg,hcg,h,oh:-- inner join ${TABLE_PREFIX}objects ocg on ocg.object_id = hcg.contactgroup_object_id}
 			${if_table:cgm,cg,hcg,h,oh:-- inner join ${TABLE_PREFIX}contactgroup_members cgm on cgm.contactgroup_id = cg.contactgroup_id}
 			${if_table:oc,cgm,cg,hcg,h,oh:-- inner join ${TABLE_PREFIX}objects oc on oc.object_id = cgm.contact_object_id}
-			
 			${if_table:hgm,oh:inner join ${TABLE_PREFIX}hostgroup_members hgm on hgm.host_object_id = oh.object_id}
 			${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:cvh,oh:inner join ${TABLE_PREFIX}customvariables cvh on oh.object_id = cvh.object_id}
 			where 1
 			${FILTER}
 			group by
@@ -210,10 +212,12 @@ class IcingaApiSearchIdoPgsql
 			${if_table:oc,cgm,cg,scg,s,os:-- inner join ${TABLE_PREFIX}objects oc on oc.object_id = cgm.contact_object_id}
 			${if_table:ocg,scg,s,os:-- inner join ${TABLE_PREFIX}objects ocg on ocg.object_id = scg.contactgroup_object_id}
 			${if_table:hs,s,os,:-- inner join ${TABLE_PREFIX}hoststatus hs on hs.host_object_id = s.host_object_id}
-			${if_table:oh,s,os:-- inner join ${TABLE_PREFIX}objects oh on oh.object_id = s.host_object_id}
+			${if_table:oh,s,os:inner join ${TABLE_PREFIX}objects oh on oh.object_id = s.host_object_id}
 			${if_table:hgm,oh,s,os:inner join ${TABLE_PREFIX}hostgroup_members hgm on hgm.host_object_id = oh.object_id}
 			${if_table:hg,hgm,oh,s,os:inner join ${TABLE_PREFIX}hostgroups hg on hg.hostgroup_id = hgm.hostgroup_id}
 			${if_table:ohg,hg,hgm,oh,s,os:inner join ${TABLE_PREFIX}objects ohg on ohg.object_id = hg.hostgroup_object_id}
+			${if_table:cvh,oh,s,os:inner join ${TABLE_PREFIX}customvariables cvh on oh.object_id = cvh.object_id}
+			${if_table:cvs,os:inner join ${TABLE_PREFIX}customvariables cvs on os.object_id = cvs.object_id}
 			where 1
 			${FILTER}
 			group by
@@ -230,6 +234,7 @@ class IcingaApiSearchIdoPgsql
 			${if_table:hgm,oh:inner join ${TABLE_PREFIX}hostgroup_members hgm on hgm.host_object_id = oh.object_id}
 			${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:cvh,oh:inner join ${TABLE_PREFIX}customvariables cvh on oh.object_id = cvh.object_id}
 			where 1
 			${FILTER}
 			${GROUPBY}
@@ -247,6 +252,8 @@ class IcingaApiSearchIdoPgsql
 			${if_table:hgm,oh,s,os:inner join ${TABLE_PREFIX}hostgroup_members hgm on hgm.host_object_id = oh.object_id}
 			${if_table:hg,hgm,oh,s,os:inner join ${TABLE_PREFIX}hostgroups hg on hg.hostgroup_id = hgm.hostgroup_id}
 			${if_table:ohg,hg,hgm,oh,s,os:inner join ${TABLE_PREFIX}objects ohg on ohg.object_id = hg.hostgroup_object_id}
+			${if_table:cvh,oh,s,os:inner join ${TABLE_PREFIX}customvariables cvh on oh.object_id = cvh.object_id}
+			${if_table:cvs,os:inner join ${TABLE_PREFIX}customvariables cvs on os.object_id = cvs.object_id}
 			where 1
 			${FILTER}
 			${GROUPBY}
@@ -423,6 +430,8 @@ class IcingaApiSearchIdoPgsql
 		'HOST_PARENT_NAME' => array('ohp', 'name1'),
 		'HOST_CHILD_OBJECT_ID' => array('oh', 'object_id'),
 		'HOST_CHILD_NAME' => array('oh', 'name1'),
+		'HOST_CUSTOMVARIABLE_NAME' => array('cvh', 'varname'),
+		'HOST_CUSTOMVARIABLE_VALUE' => array('cvh', 'varvalue'),
 	
 		// Service data
 		'SERVICE_ID' => array('s', 'service_id'),
@@ -474,6 +483,8 @@ class IcingaApiSearchIdoPgsql
 		'SERVICE_LATENCY_MAX' => array('ss', 'latency', 'max(%s)'),
 		'SERVICE_ALL' => array('s', '*'),
 		'SERVICE_STATUS_ALL' => array('ss', '*'),
+		'SERVICE_CUSTOMVARIABLE_NAME' => array('cvs', 'varname'),
+		'SERVICE_CUSTOMVARIABLE_VALUE' => array('cvs', 'varvalue'),
 	
 		// Config vars
 		'CONFIG_VAR_ID' => array('cfv', 'configfilevariable_id'),





More information about the icinga-checkins mailing list