[icinga-checkins] icinga.org: icinga-api/cdoebler/default: * added base for host-parent search

Christian Doebler christian.doebler at netways.de
Sat Oct 3 18:31:47 CEST 2009


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

Author: Christian Doebler <christian.doebler at netways.de>
Date:   Sat Oct  3 18:31:29 2009 +0200

* added base for host-parent search

---

 objects/IcingaApiConstantsInterface.php |    1 +
 objects/search/IcingaApiSearchIdo.php   |   21 +++++++++++++++++----
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/objects/IcingaApiConstantsInterface.php b/objects/IcingaApiConstantsInterface.php
index 2474157..2daef1c 100644
--- a/objects/IcingaApiConstantsInterface.php
+++ b/objects/IcingaApiConstantsInterface.php
@@ -42,6 +42,7 @@ interface IcingaApiConstantsInterface {
 	const TARGET_SERVICE_STATUS_SUMMARY = 'service_status_summary';
 	const TARGET_HOST_STATUS_HISTORY = 'host_status_history';
 	const TARGET_SERVICE_STATUS_HISTORY = 'service_status_history';
+	const TARGET_HOST_PARENTS = 'host_parents';
 
 	// SEARCH TYPES
 	const SEARCH_TYPE_COUNT = 'count';
diff --git a/objects/search/IcingaApiSearchIdo.php b/objects/search/IcingaApiSearchIdo.php
index d259eb5..3b5b3b3 100644
--- a/objects/search/IcingaApiSearchIdo.php
+++ b/objects/search/IcingaApiSearchIdo.php
@@ -197,7 +197,6 @@ class IcingaApiSearchIdo
 				ss.current_state
 			order by
 				ss.current_state',
-		
 		self::TARGET_HOST_STATUS_HISTORY => 
 			'select
 				${FIELDS}
@@ -210,7 +209,6 @@ class IcingaApiSearchIdo
 				${GROUPBY}
 				${ORDERBY}
 				${LIMIT}',
-		
 		self::TARGET_SERVICE_STATUS_HISTORY => 
 			'select
 				${FIELDS}
@@ -225,8 +223,23 @@ class IcingaApiSearchIdo
 				${GROUPBY}
 				${ORDERBY}
 				${LIMIT}',
-	
-
+		self::TARGET_HOST_PARENTS =>
+			'select
+				ohp.object_id parent_object_id, ohp.name1 parent_name, oh.object_id child_object_id, oh.name1 child_name
+			from
+				${TABLE_PREFIX}objects ohp
+			inner join ${TABLE_PREFIX}host_parenthosts hph on hph.parent_host_object_id = ohp.object_id
+			inner join ${TABLE_PREFIX}hosts h on h.host_id = hph.host_id
+			inner join ${TABLE_PREFIX}objects oh on oh.object_id = h.host_object_id
+			where
+				oh.objecttype_id = 1
+				and ohp.objecttype_id = 1
+				${FILTER}
+				${GROUPBY}
+			order by
+				parent_name asc,
+				child_name asc
+			${LIMIT}',
 	);
 
 	/*





More information about the icinga-checkins mailing list