diff options
-rw-r--r-- | Build.PL | 1 | ||||
-rw-r--r-- | Changelog | 2 | ||||
-rw-r--r-- | README | 1 | ||||
-rwxr-xr-x | bin/icli | 19 |
4 files changed, 14 insertions, 9 deletions
@@ -41,6 +41,7 @@ my $build = Module::Build->new( 'Carp' => 0, 'DateTime' => 0, 'DateTime::Format::Strptime' => 0, + 'DateTime::TimeZone' => 0, 'Getopt::Long' => 0, 'List::MoreUtils' => 0, 'POSIX' => 0, @@ -1,6 +1,6 @@ git HEAD - * New dependencies: DateTime and DateTime::Format::Strptime + * New dependencies: DateTime, DateTime::Format::Strptime, DateTime::TimeZone * NOT BACKWARDS COMPATIBLE: Add -a/--action option to invoke generic actions on selected services. This replaces -a/--acknowledge with -aa/ -a acknowledge, -r/--recheck with -ar / -a recheck and @@ -5,6 +5,7 @@ Requires: * perl v5.10 or newer with the following modules: * DateTime * DateTime::Format::Strptime + * DateTime::TimeZone * List::MoreUtils * Term::Size @@ -12,6 +12,7 @@ use App::Icli::ConfigData; use Carp qw(croak); use DateTime; use DateTime::Format::Strptime; +use DateTime::TimeZone; use Getopt::Long qw/:config bundling/; use List::MoreUtils qw(any firstval); use POSIX qw(strftime); @@ -1044,12 +1045,14 @@ sub dispatch_command { sub action_on_host { my ($host) = @_; + my $tz = DateTime::TimeZone->new( name => 'local' ); + given ($action) { when ('downtime') { my ( $start, $end, $duration, $comment, @opts ) = @action_args; my $strp = DateTime::Format::Strptime->new( pattern => '%Y-%m-%dT%H:%M:%S', - time_zone => 'Europe/Berlin', # TODO read from system + time_zone => $tz->name, ); my $dt_start = $strp->parse_datetime($start); @@ -1095,12 +1098,14 @@ sub action_on_service { return; } + my $tz = DateTime::TimeZone->new( name => 'local' ); + given ($action) { when ('downtime') { my ( $start, $end, $duration, $comment, @opts ) = @action_args; my $strp = DateTime::Format::Strptime->new( pattern => '%Y-%m-%dT%H:%M:%S', - time_zone => 'Europe/Berlin', # TODO read from system + time_zone => $tz->name, ); my $dt_start = $strp->parse_datetime($start); @@ -1296,8 +1301,8 @@ Note: Acknowledgement of host problems is not yet supported. Schedule a non-triggered host or service (depending on the filter arguments) downtime. I<start> and I<stop> are timestamps and must be formatted as -YYYY-MM-DDTHH:MM:SS, where the "T" is literal. At this moment, they are always -interpreted in the Europe/Berlin timezone, this will change in the future. +YYYY-MM-DDTHH:MM:SS, where the "T" is literal. The timestamp is assumed to +be in the same time zone as the system running icli. If I<duration> is 0 (zero), a fixed downtime between I<start> and I<stop> is scheduled. Otherwise, a flexible downtime which will start between @@ -1539,16 +1544,14 @@ None. =item * DateTime::Format::Strptime +=item * DateTime::TimeZone + =item * Term::Size =back =head1 BUGS AND LIMITATIONS -When scheduling a downtime, the start and stop times are always interpreted -in the Europe/Berlin timezone. Also, the duration parameter is always -interpreted in hours. - It is probably not clear from the documentation when an action will operate on hosts and when on services. |