[icinga-checkins] icinga.org: icinga-reports/r1.8: added brackets in sla calculation. fixes #3312

git at icinga.org git at icinga.org
Fri Feb 1 23:30:23 CET 2013


Module: icinga-reports
Branch: r1.8
Commit: 6cc679563671d7153593378822d287d041d8eb35
URL:    https://git.icinga.org/?p=icinga-reports.git;a=commit;h=6cc679563671d7153593378822d287d041d8eb35

Author: Bernd Erk <bernd.erk at icinga.org>
Date:   Tue Dec  4 22:59:20 2012 +0100

added brackets in sla calculation. fixes #3312

---

 .../sub/host/availabilityInGivenTime.jrxml         |    7 +++----
 .../sub/service/availabilityInGivenTime.jrxml      |    7 +++----
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/jasperreports/templates/sub/host/availabilityInGivenTime.jrxml b/jasperreports/templates/sub/host/availabilityInGivenTime.jrxml
index b0b56d5..29ef42f 100644
--- a/jasperreports/templates/sub/host/availabilityInGivenTime.jrxml
+++ b/jasperreports/templates/sub/host/availabilityInGivenTime.jrxml
@@ -33,11 +33,11 @@ SELECT
   name1,
   name2,
   '1' as state,
-  100 - ifnull(icinga_availability(
+  (100 - ifnull(icinga_availability(
     objects.object_id,
     $P{p_date_start},
     $P{p_date_end}
-  ), 0) / 100 as sla
+  ), 0)) / 100 as sla
 FROM icinga_objects objects
 WHERE objects.object_id = $P{p_host_object_id}]]>
 		</queryString>
@@ -139,8 +139,7 @@ and object_id                      = $P{p_host_object_id}]]>
 							<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
 						</datasetRun>
 					</dataset>
-					<keyExpression><![CDATA[$F{state}.toString().replaceFirst("0", "OK").replaceFirst("1", "NOK")
-]]></keyExpression>
+					<keyExpression><![CDATA[$F{state}.toString().replaceFirst("0", "OK").replaceFirst("1", "NOK")]]></keyExpression>
 					<valueExpression><![CDATA[$F{sla}.setScale(3,BigDecimal.ROUND_HALF_UP)]]></valueExpression>
 					<labelExpression><![CDATA[$F{sla}.setScale(3,BigDecimal.ROUND_HALF_UP).toString() + "%"]]></labelExpression>
 				</pieDataset>
diff --git a/jasperreports/templates/sub/service/availabilityInGivenTime.jrxml b/jasperreports/templates/sub/service/availabilityInGivenTime.jrxml
index 34a00da..2597f2c 100644
--- a/jasperreports/templates/sub/service/availabilityInGivenTime.jrxml
+++ b/jasperreports/templates/sub/service/availabilityInGivenTime.jrxml
@@ -35,11 +35,11 @@ SELECT
   name1,
   name2,
   '1' as state,
-  100 - ifnull(icinga_availability(
+  (100 - ifnull(icinga_availability(
     objects.object_id,
     $P{p_date_start},
     $P{p_date_end}
-  ), 0) / 100 as sla
+  ), 0)) / 100 as sla
 FROM icinga_objects objects
 WHERE objects.object_id = $P{p_service_object_id}]]>
 		</queryString>
@@ -147,8 +147,7 @@ AND icinga_objects.object_id    = $P{p_service_object_id}]]>
 							<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
 						</datasetRun>
 					</dataset>
-					<keyExpression><![CDATA[$F{state}.toString().replaceFirst("0", "OK").replaceFirst("1", "NOK")
-]]></keyExpression>
+					<keyExpression><![CDATA[$F{state}.toString().replaceFirst("0", "OK").replaceFirst("1", "NOK")]]></keyExpression>
 					<valueExpression><![CDATA[$F{sla}.setScale(3,BigDecimal.ROUND_HALF_UP)]]></valueExpression>
 					<labelExpression><![CDATA[$F{sla}.setScale(3,BigDecimal.ROUND_HALF_UP).toString() + "%"]]></labelExpression>
 				</pieDataset>





More information about the icinga-checkins mailing list