line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Armadito::Agent::HTTP::Client::ArmaditoAV::Event::StatusEvent; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
19943609
|
use strict; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
122
|
|
4
|
4
|
|
|
4
|
|
15
|
use warnings; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
130
|
|
5
|
4
|
|
|
4
|
|
13
|
use base 'Armadito::Agent::HTTP::Client::ArmaditoAV::Event'; |
|
4
|
|
|
|
|
42
|
|
|
4
|
|
|
|
|
657
|
|
6
|
4
|
|
|
4
|
|
17
|
use JSON; |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
39
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
9
|
0
|
|
|
0
|
1
|
|
my ( $class, %params ) = @_; |
10
|
|
|
|
|
|
|
|
11
|
0
|
|
|
|
|
|
my $self = $class->SUPER::new(%params); |
12
|
|
|
|
|
|
|
|
13
|
0
|
|
|
|
|
|
return $self; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub _sendToGLPI { |
17
|
0
|
|
|
0
|
|
|
my ( $self, $message ) = @_; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
my $response = $self->{taskobj}->{glpi_client}->sendRequest( |
20
|
0
|
|
|
|
|
|
"url" => $self->{taskobj}->{agent}->{config}->{server}[0] . "/api/states", |
21
|
|
|
|
|
|
|
message => $message, |
22
|
|
|
|
|
|
|
method => "POST" |
23
|
|
|
|
|
|
|
); |
24
|
|
|
|
|
|
|
|
25
|
0
|
0
|
|
|
|
|
if ( $response->is_success() ) { |
26
|
0
|
|
|
|
|
|
$self->{taskobj}->{logger}->info("Send ArmaditoAV State successful..."); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
else { |
29
|
0
|
|
|
|
|
|
$self->{taskobj}->_handleError($response); |
30
|
0
|
|
|
|
|
|
$self->{taskobj}->{logger}->info("Send ArmaditoAV State failed..."); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
return; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub run { |
37
|
0
|
|
|
0
|
1
|
|
my ( $self, %params ) = @_; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
my $obj = { |
40
|
|
|
|
|
|
|
dbinfo => $self->{jobj}, |
41
|
0
|
|
|
|
|
|
avdetails => [] |
42
|
|
|
|
|
|
|
}; |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
$self->{taskobj}->{jobj}->{task}->{obj} = $obj; |
45
|
0
|
|
|
|
|
|
my $json_text = to_json( $self->{taskobj}->{jobj} ); |
46
|
0
|
|
|
|
|
|
print "JSON formatted str : \n" . $json_text . "\n"; |
47
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
$self->_sendToGLPI($json_text); |
49
|
0
|
|
|
|
|
|
$self->{end_polling} = 1; |
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
return $self; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
1; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
__END__ |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 NAME |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Armadito::Agent::HTTP::Client::ArmaditoAV::Event::StatusEvent - ArmaditoAV StatusEvent class |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 DESCRIPTION |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
This is the class dedicated to StatusEvent of ArmaditoAV api. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 FUNCTIONS |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head2 run ( $self, %params ) |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Run event related stuff. Send ArmaditoAV status to Armadito Plugin for GLPI. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head2 new ( $class, %params ) |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Instanciate this class. |