++ed by:
1 non-PAUSE user
Author image Dominik Schulz
and 1 contributors


Zabbix::Sender - A pure-perl implementation of zabbix-sender.


version 0.07


This code snippet shows how to send the value "OK" for the item "my.zabbix.item" to the zabbix server/proxy at "my.zabbix.server.example" on port "10055".

    use Zabbix::Sender;

    my $Sender = Zabbix::Sender->new({
       'server' => 'my.zabbix.server.example',
       'port' => 10055,


Zabbix::Sender - A pure-perl implementation of zabbix-sender.



Name of the host for which to submit items to Zabbix. Initialized by _init_hostname. You can set it either using


or during creation time of Zabbix::Sender

    my $Sender = Zabbix::Sender->new({
        'server' => 'my.zabbix.server.example',
        'hostname' => 'another.hostname',

You can also query the current setting using

    my $current_hostname = $Sender->hostname();


Use the strict setting to make Zabbix::Sender check the return values from Zabbix:


You can also query the current setting using

    my $is_strict = $Sender->strict();


Zabbix 1.8 uses a JSON encoded payload after a custom Zabbix header. So this initializes the JSON object.


The hostname of the sending instance may be given in the constructor.

If not it is detected here.



a4 - ZBXD b - 0x01 V - Length of Request in Bytes (64-bit integer), aligned left, padded with 0x00, low 32 bits V - High 32 bits of length (always 0 in Zabbix::Sender) a* - JSON encoded request

This may be changed to a HashRef if future version of zabbix change the header template.


This method encodes values as a json string and creates the required header according to the template defined above.


Checks the return value from the Zabbix server (or Zabbix proxy), which states the number of processed, failed and total values. Returns undef if everything is alright, a message otherwise.

This method is called when the strict setting of Zabbix::Sender is active:

    my $Sender = Zabbix::Sender->new({
        'server' => 'my.zabbix.server.example',
        'strict' => 1,


This method tries to decode the answer received from the server.

Returns true if response indicates success, false if response indicates failure, undefined value if response was empty or cannot be decoded.

Method "response" may be used to return decoded response.


Send the given item with the given value to the server.

Takes two or three scalar arguments: item key, value and clock (clock is optional).


Adds values to the stack of values to bulk_send.

It accepts arguments in forms:

$sender->bulk_buf_add($key, $value, $clock, ...); $sender->bulk_buf_add([$key, $value, $clock], ...); $sender->bulk_buf_add($hostname, [ [$key, $value, $clock], ...], ...);

Last form allows to add values for several hosts at once.

$clock is optional and may be undef, empty or omitted.

Returns true if successful or undef if invalid arguments are specified.


Clear bulk_send buffer.


Send accumulated values to the server.

It accepts the same arguments as bulk_buf_add. If arguments are specified, they are added to the buffer before sending.


Disconnects any open sockets on destruction.


"Dominik Schulz", <"lkml at ds.gauner.org">


Please report any bugs or feature requests to bug-zabbix-sender at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Zabbix-Sender. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.


You can find documentation for this module with the perldoc command.

    perldoc Zabbix::Sender

You can also look for information at:


This code is based on the documentation and sample code found at:



Copyright 2011 Dominik Schulz.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.


Dominik Schulz <dominik.schulz@gauner.org>


This software is copyright (c) 2017 by Dominik Schulz.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.