ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent-ZabbixSender/ZabbixSender.pm
(Generate patch)

Comparing AnyEvent-ZabbixSender/ZabbixSender.pm (file contents):
Revision 1.2 by root, Thu Jan 18 10:48:10 2018 UTC vs.
Revision 1.3 by root, Thu Jan 18 15:38:11 2018 UTC

84 84
85Called on any protocol errors - these generally indicate that something 85Called on any protocol errors - these generally indicate that something
86other than a zabbix server is running on a port. The given key-value pairs 86other than a zabbix server is running on a port. The given key-value pairs
87are the lost items. 87are the lost items.
88 88
89=item on_loss => $cb->$zbx, (\@items) (default: log and continue) 89=item on_loss => $cb->($zbx, \@items) (default: log and continue)
90 90
91Will be called when some data items are thrown away (this happens if the 91Will be called when some data items are thrown away (this happens if the
92server isn't reachable for at least C<queue_time> seconds), 92server isn't reachable for at least C<queue_time> seconds),
93 93
94=item on_response => $cb->$zbx, (\@items, \%response) (default: not called) 94=item on_response => $cb->($zbx, \@items, \%response) (default: not called)
95 95
96Will be called with the (generally rather useless) response form the 96Will be called with the (generally rather useless) response form the
97zabbix server. 97zabbix server.
98 98
99=back 99=back
218 $fh 218 $fh
219 or return $self->_retry; 219 or return $self->_retry;
220 220
221 delete $self->{retry}; 221 delete $self->{retry};
222 222
223 delete $self->{send_immediate};
223 my $data = delete $self->{queue}; 224 my $data = delete $self->{queue};
224 my $items = [map @{ $_->[1] }, @$data]; 225 my $items = [map @{ $_->[1] }, @$data];
225 226
226 my $fail = sub { 227 my $fail = sub {
227 $self->{on_error}($self, $items, $_[0]); 228 $self->{on_error}($self, $items, $_[0]);
260 }, 261 },
261 ; 262 ;
262 263
263 my $json = $json->encode ({ 264 my $json = $json->encode ({
264 request => "sender data", 265 request => "sender data",
265 clock => AE::now, 266 clock => int AE::now,
266 data => [ 267 data => [
267 map { 268 map {
268 my $slot = $_; 269 my $slot = $_;
269 270
270 map { 271 map {
271 key => $_->[0], 272 key => $_->[0],
272 value => $_->[1], 273 value => $_->[1],
273 clock => $_->[2] // $slot->[0], 274 clock => int ($_->[2] // $slot->[0]),
274 host => $_->[3] // $self->{host}, 275 host => $_->[3] // $self->{host},
275 }, @{ $slot->[1] } 276 }, @{ $slot->[1] }
276 } @$data 277 } @$data
277 ], 278 ],
278 }); 279 });

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines