line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Nagios::Passive::BulkResult; |
2
|
2
|
|
|
2
|
|
1965
|
use Moo; |
|
2
|
|
|
|
|
8460
|
|
|
2
|
|
|
|
|
13
|
|
3
|
2
|
|
|
2
|
|
2384
|
use MooX::late; |
|
2
|
|
|
|
|
27033
|
|
|
2
|
|
|
|
|
22
|
|
4
|
2
|
|
|
2
|
|
1773
|
use IO::File; |
|
2
|
|
|
|
|
2342
|
|
|
2
|
|
|
|
|
376
|
|
5
|
2
|
|
|
2
|
|
23
|
use Carp qw/croak/; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
117
|
|
6
|
2
|
|
|
2
|
|
15
|
use File::Temp; |
|
2
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
241
|
|
7
|
2
|
|
|
2
|
|
16
|
use Scalar::Util qw/blessed/; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
552
|
|
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
|
1
|
|
|
1
|
0
|
1443
|
my $self = shift; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# nothing to do if empty |
26
|
1
|
50
|
|
|
|
3
|
return unless @{$self->rpobjects}; |
|
1
|
|
|
|
|
26
|
|
27
|
|
|
|
|
|
|
|
28
|
1
|
|
|
|
|
35
|
my $fh = $self->tempfile; |
29
|
|
|
|
|
|
|
|
30
|
1
|
|
|
|
|
56
|
print $fh "### Active Check Result File ###\n"; |
31
|
1
|
|
|
|
|
14
|
print $fh sprintf("file_time=%d\n\n",time); |
32
|
|
|
|
|
|
|
|
33
|
1
|
|
|
|
|
4
|
for my $rp (@{ $self->rpobjects }) { |
|
1
|
|
|
|
|
27
|
|
34
|
2
|
|
|
|
|
30
|
my $output = $rp->_to_string . "\n"; |
35
|
2
|
50
|
|
|
|
15
|
$fh->print($output) or croak($!); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
1
|
|
|
|
|
18
|
$self->_touch_file; |
39
|
|
|
|
|
|
|
|
40
|
1
|
|
|
|
|
143
|
return $fh->filename; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
1; |
44
|
|
|
|
|
|
|
__END__ |