line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Nagios::Passive::BulkResult; |
2
|
2
|
|
|
2
|
|
3021
|
use Moo; |
|
2
|
|
|
|
|
9115
|
|
|
2
|
|
|
|
|
13
|
|
3
|
2
|
|
|
2
|
|
2325
|
use MooX::late; |
|
2
|
|
|
|
|
18576
|
|
|
2
|
|
|
|
|
14
|
|
4
|
2
|
|
|
2
|
|
1605
|
use IO::File; |
|
2
|
|
|
|
|
1896
|
|
|
2
|
|
|
|
|
290
|
|
5
|
2
|
|
|
2
|
|
14
|
use Carp qw/croak/; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
107
|
|
6
|
2
|
|
|
2
|
|
11
|
use File::Temp; |
|
2
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
208
|
|
7
|
2
|
|
|
2
|
|
11
|
use Scalar::Util qw/blessed/; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
608
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
has 'checkresults_dir' => ( is => 'ro', isa => 'Str', required => 1); |
10
|
|
|
|
|
|
|
has rpobjects => ( |
11
|
|
|
|
|
|
|
is => 'rw', |
12
|
|
|
|
|
|
|
isa => 'ArrayRef[Nagios::Passive::ResultPath]', |
13
|
|
|
|
|
|
|
traits => ['Array'], |
14
|
|
|
|
|
|
|
default => sub { [] }, |
15
|
|
|
|
|
|
|
handles => { |
16
|
|
|
|
|
|
|
add => 'push', |
17
|
|
|
|
|
|
|
}, |
18
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
with 'Nagios::Passive::Role::Tempfile'; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub submit { |
23
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# nothing to do if empty |
26
|
0
|
0
|
|
|
|
|
return unless @{$self->rpobjects}; |
|
0
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
my $fh = $self->tempfile; |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
|
print $fh "### Active Check Result File ###\n"; |
31
|
0
|
|
|
|
|
|
print $fh sprintf("file_time=%d\n\n",time); |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
for my $rp (@{ $self->rpobjects }) { |
|
0
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
my $output = $rp->_to_string . "\n"; |
35
|
0
|
0
|
|
|
|
|
$fh->print($output) or croak($!); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
$self->_touch_file; |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
return $fh->filename; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
1; |
44
|
|
|
|
|
|
|
__END__ |