[icinga-checkins] icinga.org: icinga-api/cdoebler/default: * Servicegroup summary queries

git at icinga.org git at icinga.org
Thu Oct 22 11:27:39 CEST 2009


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

Author: Marius Hein <marius.hein at netways.de>
Date:   Wed Oct 21 16:24:06 2009 +0200

* Servicegroup summary queries

---

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

diff --git a/objects/IcingaApiConstantsInterface.php b/objects/IcingaApiConstantsInterface.php
index 6ef327f..0d3c2db 100644
--- a/objects/IcingaApiConstantsInterface.php
+++ b/objects/IcingaApiConstantsInterface.php
@@ -45,6 +45,7 @@ interface IcingaApiConstantsInterface {
 	const TARGET_HOST_PARENTS = 'host_parents';
 	const TARGET_NOTIFICATIONS = 'notifications';
 	const TARGET_HOSTGROUP_SUMMARY = 'hostgroup_summary';
+	const TARGET_SERVICEGROUP_SUMMARY = 'servicegroup_summary';
 
 	// SEARCH TYPES
 	const SEARCH_TYPE_COUNT = 'count';
diff --git a/objects/search/IcingaApiSearchColumnsIdo.php b/objects/search/IcingaApiSearchColumnsIdo.php
index c34d145..9954646 100644
--- a/objects/search/IcingaApiSearchColumnsIdo.php
+++ b/objects/search/IcingaApiSearchColumnsIdo.php
@@ -186,8 +186,8 @@ class IcingaApiSearchColumnsIdo {
 		'NOTIFY_OBJECTTYPE_ID' => 'on.objecttype_id',
 		
 		// Summary queries
-		'HOSTGROUP_SUMMARY_COUNT' => 'Count(oh.object_id) hostgroup_summary_count'
-	
+		'HOSTGROUP_SUMMARY_COUNT' => 'Count(oh.object_id) hostgroup_summary_count',
+		'SERVICEGROUP_SUMMARY_COUNT' => 'Count(ss.current_state) servicegroup_summary_count'
 	
 	);
 
diff --git a/objects/search/IcingaApiSearchIdo.php b/objects/search/IcingaApiSearchIdo.php
index ca830e8..da5d5ff 100644
--- a/objects/search/IcingaApiSearchIdo.php
+++ b/objects/search/IcingaApiSearchIdo.php
@@ -274,6 +274,21 @@ class IcingaApiSearchIdo
 				${GROUPBY}
 				${ORDERBY:hs.current_state ASC}
 				${LIMIT}',
+		self::TARGET_SERVICEGROUP_SUMMARY =>
+			'select
+				${FIELDS}
+			FROM
+			icinga_servicegroups AS sg
+			Inner Join icinga_objects AS osg ON sg.servicegroup_object_id = osg.object_id
+			Inner Join icinga_servicegroup_members AS sgm ON sgm.servicegroup_id = sg.servicegroup_id
+			Inner Join icinga_objects AS so ON sgm.service_object_id = so.object_id
+			Inner Join icinga_servicestatus AS ss ON ss.service_object_id = so.object_id
+			WHERE
+				osg.is_active = 1
+				${FILTER}
+				${GROUPBY}
+				${ORDERBY:ss.current_state ASC}
+				${LIMIT}'
 	);
 
 	/*





More information about the icinga-checkins mailing list