[icinga-checkins] icinga.org: icinga-web/master: * added colored nodes corresponding to host status to status map

git at icinga.org git at icinga.org
Fri Oct 23 15:00:57 CEST 2009


Module: icinga-web
Branch: master
Commit: 348265d6211814ba0b0a1f7667fc018cdabde30b
URL:    https://git.icinga.org/?p=icinga-web.git;a=commit;h=348265d6211814ba0b0a1f7667fc018cdabde30b

Author: Christian Doebler <christian.doebler at netways.de>
Date:   Fri Oct 23 13:59:42 2009 +0200

* added colored nodes corresponding to host status to status map

---

 .../Cronks/models/System/StatusMapModel.class.php  |    3 +++
 .../Cronks/templates/System/js/JitStatusMap.js     |   14 ++++++++++++++
 pub/styles/Icinga.css                              |    4 ----
 3 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/app/modules/Cronks/models/System/StatusMapModel.class.php b/app/modules/Cronks/models/System/StatusMapModel.class.php
index 313c525..bc7da54 100644
--- a/app/modules/Cronks/models/System/StatusMapModel.class.php
+++ b/app/modules/Cronks/models/System/StatusMapModel.class.php
@@ -70,6 +70,7 @@ class Cronks_System_StatusMapModel extends ICINGACronksBaseModel
 					'id'		=> $objectId,
 					'name'		=> $row['host_name'],
 					'data'		=> array(
+						'status'	=> $row['host_current_state'],
 						'relation'	=> $this->getHostDataTable($row),
 					),
 					'children'	=> array(),
@@ -98,6 +99,7 @@ class Cronks_System_StatusMapModel extends ICINGACronksBaseModel
 				'id'		=> $idPrefix . '-1',
 				'name'		=> 'Icinga',
 				'data'		=> array(
+					'status'	=> '-1',
 					'relation'	=> 'Icinga Monitoring Process',
 				),
 				'children'	=> array(),
@@ -108,6 +110,7 @@ class Cronks_System_StatusMapModel extends ICINGACronksBaseModel
 				'id'		=> $idPrefix . '-1',
 				'name'		=> 'Icinga',
 				'data'		=> array(
+					'status'	=> '-1',
 					'relation'	=> 'Icinga Monitoring Process',
 				),
 				'children'	=> $hostsFlatStruct,
diff --git a/app/modules/Cronks/templates/System/js/JitStatusMap.js b/app/modules/Cronks/templates/System/js/JitStatusMap.js
index e4d3a87..4e796ac 100644
--- a/app/modules/Cronks/templates/System/js/JitStatusMap.js
+++ b/app/modules/Cronks/templates/System/js/JitStatusMap.js
@@ -75,6 +75,7 @@ function JitStatusMap (config) {
 		});
 		var rgraph = new RGraph(canvas, {
 			Node: {
+				overridable: true,
 				color: "#ccddee"
 			},
 			Edge: {
@@ -87,6 +88,19 @@ function JitStatusMap (config) {
 			onAfterCompute: function(){
 				JitLog.write(elementIds.jitLog, "done");
 			},
+			onBeforePlotNode:function(node) {
+				switch (node.data.status) {
+					case "0":
+						node.data.$color = "#00cc00";
+						break;
+					case "1":
+						node.data.$color = "#cc0000";
+						break;
+					case "2":
+						node.data.$color = "#ff8000";
+						break;
+				}
+  			},
 			onCreateLabel: function(domElement, node){
 				domElement.innerHTML = node.name;
 				domElement.onclick = function(){
diff --git a/pub/styles/Icinga.css b/pub/styles/Icinga.css
index 12d1db2..df8213b 100644
--- a/pub/styles/Icinga.css
+++ b/pub/styles/Icinga.css
@@ -106,10 +106,6 @@ div.icinga-status-up, div.hostchart-0 {
 	background-color: #00cc00;
 }
 
-div.statusmap-host-0 {
-	color: #00cc00;
-}
-
 div.icinga-status-down, div.hostchart-1 {
 	background-color: #cc0000;
 }





More information about the icinga-checkins mailing list