[icinga-checkins] icinga.org: icinga-web/cdoebler/default: * Hostgroup summary view

git at icinga.org git at icinga.org
Wed Oct 21 15:10:41 CEST 2009


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

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

* Hostgroup summary view
* Changes on the template worker
* Added the view to cronks

---

 app/config/cronks.xml                              |   11 +++++++++++
 .../icinga/template/IcingaTemplateWorker.class.php |   17 +++++++++++++++++
 2 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/app/config/cronks.xml b/app/config/cronks.xml
index 84d773d..6c23c75 100644
--- a/app/config/cronks.xml
+++ b/app/config/cronks.xml
@@ -109,6 +109,17 @@
 			</parameter>
 		</parameter>
 		
+		<parameter name="gridHostgroupSummary">
+			<parameter name="module">Cronks</parameter>
+			<parameter name="action">System.ViewProc</parameter>
+			<parameter name="hide">false</parameter>
+			<parameter name="description">Display hostgroup summary</parameter>
+			<parameter name="name">Hostgroupsummary</parameter>
+			<parameter name="parameter">
+				<parameter name="template">icinga-hostgroup-summary-template</parameter>
+			</parameter>
+		</parameter>
+		
 		<parameter name="icingaStatusMap">
 			<parameter name="module">Cronks</parameter>
 			<parameter name="action">System.StatusMap</parameter>
diff --git a/app/modules/Web/lib/icinga/template/IcingaTemplateWorker.class.php b/app/modules/Web/lib/icinga/template/IcingaTemplateWorker.class.php
index e4d6c3b..3ed46b5 100644
--- a/app/modules/Web/lib/icinga/template/IcingaTemplateWorker.class.php
+++ b/app/modules/Web/lib/icinga/template/IcingaTemplateWorker.class.php
@@ -274,6 +274,12 @@ class IcingaTemplateWorker {
 				}
 			}
 			
+			// Groupby fields
+			$gbf = $this->getGroupByFields();
+			if (is_array($gbf) && count($gbf)>0) {
+				$search->setSearchGroup($gbf);
+			}
+			
 			// Clone our count query
 			$this->api_count = clone $search;
 			
@@ -294,6 +300,17 @@ class IcingaTemplateWorker {
 		return true;
 	}
 	
+	private function getGroupByFields() {
+		static $fields = null;
+		
+		if ($fields === null) {
+			$db = $this->getTemplate()->getSectionParams('datasource');
+			$fields = $db->getParameter('groupby', array());
+		}
+		
+		return $fields;
+	}
+	
 	private function collectOrders() {
 		$fields = array();
 		if (count($this->sort_orders)) {





More information about the icinga-checkins mailing list