[icinga-checkins] icinga.org: icinga-reports/mluebben/default: Fix bug to set parameters in timeperiods module Availibility.pm

git at icinga.org git at icinga.org
Wed Apr 27 11:56:59 CEST 2011


Module: icinga-reports
Branch: mluebben/default
Commit: a166063bc535442be721c6f0a4120a0c5229fd1e
URL:    https://git.icinga.org/?p=icinga-reports.git;a=commit;h=a166063bc535442be721c6f0a4120a0c5229fd1e

Author: Michael Luebben <michael_luebben at web.de>
Date:   Wed Apr 27 11:56:47 2011 +0200

Fix bug to set parameters in timeperiods module Availibility.pm

---

 .../Modules/Reporting/Availability.pm              |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/AvailReportParser/Modules/Reporting/Availability.pm b/AvailReportParser/Modules/Reporting/Availability.pm
index 9127c51..d97a7dc 100755
--- a/AvailReportParser/Modules/Reporting/Availability.pm
+++ b/AvailReportParser/Modules/Reporting/Availability.pm
@@ -14,7 +14,7 @@ Availability.pm
 
 =head1 Version
 
-Version 0.04
+Version 0.0.5
 
 =head1 DESCRIPTION
 
@@ -51,13 +51,13 @@ This module get and parse the availalibilty report only for a service from Icing
   GetOptions(
 	"H=s" =>	\$opt_H, "hostname=s"		=> \$opt_H,
 	"S=s" =>	\$opt_S, "services=s"		=> \$opt_S,
-	"T=s" =>	\$opt_R, "rpttimeperiod=s"	=> \$opt_R
+	"T=s" =>	\$opt_T, "timeperiod=s"		=> \$opt_T
   );
 
   # Set parameters for url
   $ReportAvail->setUrlParameter('host',$opt_H);
   $ReportAvail->setUrlParameter('service',$opt_S);
-  $ReportAvail->setUrlParameter('rpttimeperiod',$opt_R);
+  $ReportAvail->setUrlParameter('timeperiod',$opt_T);
   
   # Get url for availibility report
   $ReportAvail->setUrlPath("http://localhost/icinga/");
@@ -309,7 +309,7 @@ sub setUrlParameter {
 				return $self->{url}->{param}->{value}->{$index} = $value;
 			}
 			case "rpttimeperiod" {
-				if (length($value) == 0 ||$value eq "today" || $value eq "last24hours" || $value eq "yesterday" || $value eq "thisweek" || $value eq "last7days" || $value eq "lastweek" || $value eq "last31days" || $value eq "thismonth" || $value eq "lastmonth" || $value eq "thisyear" || $value eq "lastyear" || $value eq "custom") {
+				if (length($value) == 0) {
 					return $self->{url}->{param}->{value}->{$index} = $value;
 				} else {
 					$self->{errMessage} = "setUrlParameter(): ".$value." is not a allowed value for the parameter ".$name."!\n";
@@ -350,7 +350,6 @@ sub setUrlParameter {
 			}
 			case "backtrack" {
 				if ($value =~ y/0-9//) {
-					print $value;
 					return $self->{url}->{param}->{value}->{$index} = $value;
 				} else {
 					$self->{errMessage} = "setUrlParameter(): ".$value." is not a allowed value for the parameter ".$name."!\n";
@@ -365,6 +364,14 @@ sub setUrlParameter {
 					return -1;
 				}
 			}
+			case "timeperiod" {
+				if (length($value) == 0 ||$value eq "today" || $value eq "last24hours" || $value eq "yesterday" || $value eq "thisweek" || $value eq "last7days" || $value eq "lastweek" || $value eq "last31days" || $value eq "thismonth" || $value eq "lastmonth" || $value eq "thisyear" || $value eq "lastyear" || $value eq "custom") {
+					return $self->{url}->{param}->{value}->{$index} = $value;
+				} else {
+					$self->{errMessage} = "setUrlParameter(): ".$value." is not a allowed value for the parameter ".$name."!\n";
+					return -1;
+				}
+			}
 			case "smon" {
 				if ($value =~ y/0-9//) {
 					print $value;





More information about the icinga-checkins mailing list