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

git at icinga.org git at icinga.org
Tue Jan 26 13:54:02 CET 2010


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

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

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

---

 .../data_interfaces/IcingaApiSearchIdoMysql.php    |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/objects/search/data_interfaces/IcingaApiSearchIdoMysql.php b/objects/search/data_interfaces/IcingaApiSearchIdoMysql.php
index 00e978b..7602c00 100644
--- a/objects/search/data_interfaces/IcingaApiSearchIdoMysql.php
+++ b/objects/search/data_interfaces/IcingaApiSearchIdoMysql.php
@@ -42,6 +42,7 @@ class IcingaApiSearchIdoMysql
 			${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 IcingaApiSearchIdoMysql
 			${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}
@@ -188,7 +191,7 @@ class IcingaApiSearchIdoMysql
 			${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
@@ -209,11 +212,12 @@ class IcingaApiSearchIdoMysql
 			${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 IcingaApiSearchIdoMysql
 			${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,7 +252,8 @@ class IcingaApiSearchIdoMysql
 			${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}
@@ -424,6 +430,8 @@ class IcingaApiSearchIdoMysql
 		'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'),
@@ -475,6 +483,8 @@ class IcingaApiSearchIdoMysql
 		'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