Monitoring-Availability

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Revision history for Perl extension Monitoring::Availability.
 
0.46  Tue Mar 12 16:46:40 CET 2013
    - fixed typo
 
0.44  Tue Mar 12 14:32:48 CET 2013
    - added support for livestatus logs from mysql logfilecache
    - performance tunings
 
0.42  Thu Feb 21 16:38:30 CET 2013
    - fixed breakdown by weeks
    - fixed calculation when report start is at the same time as log entry
 
0.40  Sat Dec 29 20:51:55 CET 2012
    - changed confess to warning on bogus logentries
    - fixed breakdown by weeks
 
0.38  Thu Jun 21 10:25:03 CEST 2012
    - don't break on broken logfiles
 
0.36  Mon May 21 16:53:29 CEST 2012
    - fixed breakdown values with uneven report timeperiods
    - added downtime information to result logs

Changes  view on Meta::CPAN

30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
0.30  Mon Apr 30 17:35:04 CEST 2012
    - fixed breakdown support when no events happen between breakpoints
 
0.28  Mon Apr 30 17:35:04 CEST 2012
    - fixed breakdown support on bsd systems
 
0.26  Mon Apr 23 17:23:24 CEST 2012
    - added breakdown support
 
0.24  Fri Jan 27 00:34:03 CET 2012
    - fixed timeperiod support
    - report time outside timeperiods as extra item
 
0.22  Thu Jan 26 01:10:58 CET 2012
    - added support for timeperiods (based on livestatus time transitions)
 
0.20  Sun Jul 31 10:36:44 CEST 2011
    - fixed problem with pending states in shinken
 
0.18  Sat Apr 16 18:01:26 CEST 2011
    - fixed tests with use english
 
0.16  Fri Jun 18 13:18:29 CEST 2010
    - added perl 5.8 requirement
 
0.14  Fri Jun 18 11:53:49 CEST 2010
    - excluded some tests on windows hosts
 
0.12  Sun Feb 21 18:04:47 CET 2010
    - fixed initial fake log for empty logs
 
0.11  Sat Feb 20 20:22:48 CET 2010
    - fixed logfile tests on windows
 
0.10  Sun Feb  7 02:48:47 CET 2010
    - fixed initial fake entry
 
0.08  Sun Jan 24 21:39:55 CET 2010
    - added on the fly calculation for livestatus logs
 
0.07  Sun Jan 24 21:39:55 CET 2010
    - fixed report log for hosts with services
    - fixed test requirements
 
0.06  Sun Jan 24 00:29:06 CET 2010
    - fixed initial states 'current'
 
0.05  Thu Jan 21 22:05:16 CET 2010
    - fixed reports when logfiles are totally out of report range
    - changed the way of settings options
    - added new option services_inherit_hostdowntimes
    - added new option timeformat which is used for log output
    - moved logfile parsing to extra module
    - fixed initialassumedservicestate
 
0.04  Mon Jan 18 08:06:59 CET 2010
    - added message when passing wrong services
 
0.03  Sat Jan 16 20:46:54 CET 2010
    - added resulting datastructure
    - added read string/array/file/dir methods
    - first tests
    - implemented assumestatesduringnotrunning option
    - implemented service availability calculation
    - implemented hostdowntimes
    - implemented servicedowntimes
    - implemented hosts
 
0.01  Fri Jan 15 16:40:00 CET 2010
    - initial version

t/10-availability-load_logs.t  view on Meta::CPAN

5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use strict;
use Test::More tests => 60;
use File::Temp qw/ tempfile tempdir /;
 
use_ok('Monitoring::Availability::Logs');
 
#########################
 
my $expected = [
    { 'time' => '1260711580', 'type' => 'Local time is Sun Dec 13 14:39:40 CET 2009' },
    { 'time' => '1260711580', 'type' => 'Nagios 3.0.6 starting... (PID=12480)', 'proc_start' => 1 },
    { 'time' => '1260711581', 'type' => 'Finished daemonizing... (New PID=12484)' },
    { 'time' => '1260715790', 'type' => 'Error' },
    { 'time' => '1260715801', 'type' => 'Successfully shutdown... (PID=12502)' },
    { 'time' => '1260716221', 'type' => 'Lockfile \'/opt/projects/nagios/n1/var/nagios3.pid\' looks like its already held by another instance of Nagios (PID 13226).  Bailing out...', 'proc_start' => -1 },
    { 'time' => '1260722815', 'type' => 'Warning' },
    { 'time' => '1260725492', 'type' => 'Warning' },
    { 'time' => '1260725492', 'type' => 'Warning' },
    { 'time' => '1260971246', 'type' => 'PROGRAM_RESTART event encountered, restarting...', 'proc_start' => 2 },
    { 'time' => '1261050819', 'type' => 'PASSIVE HOST CHECK' },

t/10-availability-load_logs.t  view on Meta::CPAN

89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
    my $line = shift;
    my $mal  = shift;
    diag('line: '.Dumper($line));
    diag('got : '.Dumper($mal->{'logs'}->[0]));
    diag('exp : '.Dumper($expected->[$x]));
    BAIL_OUT('failed');
}
 
 
__DATA__
[1260711580] Local time is Sun Dec 13 14:39:40 CET 2009: 39:40 CET 2009
[1260711580] Nagios 3.0.6 starting... (PID=12480)
[1260711581] Finished daemonizing... (New PID=12484)
[1260715790] Error: Unable to create temp file for writing status data!
[1260715801] Successfully shutdown... (PID=12502)
[1260716221] Lockfile '/opt/projects/nagios/n1/var/nagios3.pid' looks like its already held by another instance of Nagios (PID 13226).  Bailing out...
[1260722815] Warning: The check of host 'test_host_020' looks like it was orphaned (results never came back).  I'm scheduling an immediate check of the host...
[1260725492] Warning: Check result queue contained results for host 'test_host_105', but the host could not be found!  Perhaps you forgot to define the host in your config files?
[1260725492] Warning: Check result queue contained results for service 'test_ok_04' on host 'test_host_131', but the service could not be found!  Perhaps you forgot to define the service in your config files?
[1260971246] PROGRAM_RESTART event encountered, restarting...
[1261050819] PASSIVE HOST CHECK: n1_test_router_00;0;blah blah blah

t/30-availability-host_with_downtime.t  view on Meta::CPAN

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env perl
 
#########################
 
use strict;
 
# 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 => 14;
    }

t/31-availability-host_with_services.t  view on Meta::CPAN

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env perl
 
#########################
 
use strict;
 
# 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 => 19;
    }

t/32-availability-service.t  view on Meta::CPAN

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env perl
 
#########################
 
use strict;
 
# 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 => 18;
    }

t/32-availability-service.t  view on Meta::CPAN

100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
my $condensed_logs = $ma->get_condensed_logs();
# test will fail on windows because of a different used timezone
TestUtils::check_array_one_by_one($expected_condensed_log, $condensed_logs, 'condensed logs');
 
my $full_logs = $ma->get_full_logs();
# test will fail on windows because of a different used timezone
TestUtils::check_array_one_by_one($expected_full_log, $full_logs, 'full logs');
 
__DATA__
[1264111515] Nagios 3.2.0 starting... (PID=31189)
[1264111515] Local time is Thu Jan 21 23:05:15 CET 2010
[1264111515] LOG VERSION: 2.0
[1264111515] livestatus: Setting max number of cached log messages to 0
[1264111515] livestatus: Version 1.1.2rc1 initializing. Socket path: '/tmp/live.sock'
[1264111515] livestatus: Created UNIX control socket at /tmp/live.sock
[1264111515] livestatus: Opened UNIX socket /tmp/live.sock
[1264111515] livestatus: successfully finished initialization
[1264111515] Event broker module '/opt/projects/git/check_mk/livestatus/src/livestatus.o' initialized successfully.
[1264111516] Finished daemonizing... (New PID=31195)
[1264111516] livestatus: Entering main loop, listening on UNIX socket. PID is 31195
[1264111516] livestatus: Starting 10 client threads

t/32-availability-service.t  view on Meta::CPAN

135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
[1264112016] EXTERNAL COMMAND: RESTART_PROCESS;
[1264112017] PROGRAM_RESTART event encountered, restarting...
[1264112017] livestatus: deinitializing
[1264112017] livestatus: Waiting for main to terminate...
[1264112018] livestatus: Socket thread has terminated
[1264112018] livestatus: error: Client connection terminated while request still incomplete
[1264112018] livestatus: Waiting for client threads to terminate...
[1264112018] livestatus: Main thread + 10 client threads have finished
[1264112018] Event broker module '/opt/projects/git/check_mk/livestatus/src/livestatus.o' deinitialized successfully.
[1264112018] Nagios 3.2.0 starting... (PID=31195)
[1264112018] Local time is Thu Jan 21 23:13:38 CET 2010
[1264112018] LOG VERSION: 2.0
[1264112018] livestatus: Setting max number of cached log messages to 0
[1264112018] livestatus: Version 1.1.2rc1 initializing. Socket path: '/tmp/live.sock'
[1264112018] livestatus: Created UNIX control socket at /tmp/live.sock
[1264112018] livestatus: Opened UNIX socket /tmp/live.sock
[1264112018] livestatus: successfully finished initialization
[1264112018] Event broker module '/opt/projects/git/check_mk/livestatus/src/livestatus.o' initialized successfully.
[1264112019] livestatus: Starting 10 client threads
[1264112019] livestatus: Entering main loop, listening on UNIX socket. PID is 31195
[1264112020] SERVICE DOWNTIME ALERT: n0_test_host_004;n0_test_critical_18;STARTED; Service has entered a period of scheduled downtime

t/33-availability-service_ok_logs.t  view on Meta::CPAN

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env perl
 
#########################
 
use strict;
 
# 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 => 63;
    }

t/34-availability-breakdown.t  view on Meta::CPAN

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env perl
 
#########################
 
use strict;
 
# 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;
    }

t/35-availability-timeperiods.t  view on Meta::CPAN

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env perl
 
#########################
 
use strict;
 
# 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 => 30;
    }

t/36-availability-nologs.t  view on Meta::CPAN

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env perl
 
#########################
 
use strict;
 
# 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;
    }



( run in 0.615 second using v1.01-cache-2.11-cpan-cba739cd03b )