… | |
… | |
29 | |
29 | |
30 | use AnyEvent (); |
30 | use AnyEvent (); |
31 | use AnyEvent::Socket (); |
31 | use AnyEvent::Socket (); |
32 | use AnyEvent::Handle (); |
32 | use AnyEvent::Handle (); |
33 | |
33 | |
34 | our $VERSION = '1.0'; |
34 | our $VERSION = '1.1'; |
35 | |
35 | |
36 | =item $zbx = new AnyEvent::ZabbixSender [key => value...] |
36 | =item $zbx = new AnyEvent::ZabbixSender [key => value...] |
37 | |
37 | |
38 | Creates a (virtual) connection to a zabbix server. Since each submission |
38 | Creates a (virtual) connection to a zabbix server. Since each submission |
39 | requires a new TCP connection, creating the connection object does not |
39 | requires a new TCP connection, creating the connection object does not |
… | |
… | |
114 | retry_min => 30, |
114 | retry_min => 30, |
115 | retry_max => 300, |
115 | retry_max => 300, |
116 | queue_time => 3600, |
116 | queue_time => 3600, |
117 | on_response => $NOP, |
117 | on_response => $NOP, |
118 | on_error => sub { |
118 | on_error => sub { |
119 | AE::log 4 => "$_[0]{zhost}:$_[0]{zport}: $_[1]"; # error |
119 | AE::log 4 => "$_[0]{zhost}:$_[0]{zport}: $_[2]"; # error |
120 | }, |
120 | }, |
121 | on_loss => sub { |
121 | on_loss => sub { |
122 | my $nitems = @{ $_[1] }; |
122 | my $nitems = @{ $_[1] }; |
123 | AE::log 5 => "$_[0]{zhost}:$_[0]{zport}: $nitems items lost"; # warn |
123 | AE::log 5 => "$_[0]{zhost}:$_[0]{zport}: $nitems items lost"; # warn |
124 | }, |
124 | }, |