Monitoring-Availability
view release on metacpan or search on metacpan
t/34-availability-breakdown.t view on Meta::CPAN
#!/usr/bin/env perl
#########################
use strict;
use Test::More;
use Data::Dumper;
# checks against localtime will fail otherwise
use POSIX qw(tzset);
$ENV{'TZ'} = "CET";
POSIX::tzset();
BEGIN {
if( $^O eq 'MSWin32' ) {
plan skip_all => 'windows is not supported';
}
else {
plan tests => 4;
}
require 't/00_test_utils.pm';
import TestUtils;
}
use_ok('Monitoring::Availability');
#########################
# read logs from data
my $logs;
while(my $line = <DATA>) {
$logs .= $line;
}
my $expected = {
'services' => {},
'hosts' => {
'mo' => {
'time_up' => 172218,
'time_down' => 582,
'time_unreachable' => 0,
'scheduled_time_up' => 0,
'scheduled_time_down' => 0,
'scheduled_time_unreachable' => 0,
'scheduled_time_indeterminate' => 0,
'time_indeterminate_nodata' => 0,
'time_indeterminate_notrunning' => 0,
'time_indeterminate_outside_timeperiod' => 0,
'breakdown' => {
'2012-04-22' => {
'time_down' => 582,
'time_indeterminate_notrunning' => 0,
'scheduled_time_down' => 0,
'scheduled_time_up' => 0,
'time_unreachable' => 0,
'time_indeterminate_nodata' => 0,
'time_up' => 85818,
'scheduled_time_unreachable' => 0,
'time_indeterminate_outside_timeperiod' => 0,
'scheduled_time_indeterminate' => 0,
'timestamp' => 1335045600
},
'2012-04-21' => {
'time_down' => 0,
'time_indeterminate_notrunning' => 0,
'scheduled_time_down' => 0,
'scheduled_time_up' => 0,
'time_unreachable' => 0,
'time_indeterminate_nodata' => 0,
( run in 0.982 second using v1.01-cache-2.11-cpan-14f38c9f855 )