Zabbix Documentation 2.2

2.23.03.44.0 (current)In development:4.2 (devel)Unsupported:1.82.02.43.2

User Tools

Site Tools


Sidebar

manual:concepts:sender

6 Sender

Overview

Zabbix sender is a command line utility that may be used to send performance data to Zabbix server for processing.

The utility is usually used in long running user scripts for periodical sending of availability and performance data.

For sending results directly to Zabbix server or proxy, a trapper item type must be configured.

Sending one value

An example of sending a value to Zabbix server using Zabbix sender:

shell> zabbix_sender -z zabbix -s "Linux DB3" -k db.connections -o 43

where:

  • z - Zabbix server host (IP address can be used as well)
  • s - technical name of monitored host (as registered in Zabbix frontend)
  • k - item key
  • o - value to send

If objects have whitespaces, these objects must be quoted using double quotes.

Zabbix trapper process does not expand macros used in the item key in attempt to check corresponding item key existence for targeted host.

See the Zabbix sender manpage for more information.

Zabbix sender on Windows can be run similarly:

zabbix_sender.exe [options]

Since Zabbix 1.8.4, zabbix_sender realtime sending scenarios have been improved to gather multiple values passed to it in close succession and send them to the server in a single connection. A value that is not further apart from the previous value than 0.2 seconds can be put in the same stack, but maximum pooling time still is 1 second.

Sending many values

It is possible to specify an input file containing the values to be sent to Zabbix server.

See the --input-file option in Zabbix sender manpage on how to properly format the file.

Without value timestamps

If you don't need to specify the timestamp of each value, here is an example contents of the input file:

"Linux DB1" db.ping 1
"Linux DB3" db.ping 0
"Zabbix server" db.status 0
"Zabbix server" db.error "Linux DB3 down"
With value timestamps

It is possible to specify the timestamp of each value that is to be sent. Use option --with-timestamps in that case. Here is an example of the input file with timestamps:

"Linux DB1" db.ping 1429533600 1
"Linux DB3" db.ping 1429533602 0
"Zabbix server" db.status 1429533603 0
"Zabbix server" db.error 1429533603 "Linux DB3 down"

If the target item has triggers referencing it, all timestamps in an input file must be in an increasing order, otherwise event calculation will not be correct.

The timestamps specified in the input file will be adjusted to match server time. For instance, if the timestamp specified is “10:30:50”, the current time on Zabbix sender's machine is “10:40:03”, and the current time on Zabbix server's machine is “10:40:05”, then the item's value will be stored in the database with a timestamp of “10:30:52”.

Similarly, if a value is first sent to Zabbix proxy, which later sends it to Zabbix server, the timestamp will be first adjusted to match Zabbix proxy time, and then it will be adjusted to match Zabbix server time.

Zabbix sender accepts strings in UTF-8 encoding (for both UNIX-like systems and Windows) without byte order mark (BOM) first in the file.

Quoting in the input file

Zabbix sender manpage contains the rules how to properly format the entries in the input file in --input-file section. Here are the examples on how the values are stored in the database when different quoting is used:

value in the input fileresult in the databaseerror message on the screen
failedfailed
“status: failed”status: failed
“status: \”failed\““status: “failed”
“C:\\”C:\
C:\C:\
“C:\” Warning: [line 1] 'Key value' required
“C:\My Documents”C:\My Documents
status:\nfailedstatus:\nfailed
“status:\tfailed”status:\tfailed
“status:\nfailed”status:
failed
“status:\nfailed\n”status:
failed
“\nstatus:\nfailed”
status:
failed
“\n\n”
Example of the output

Here is an example of sending 300 values from the input file:

# zabbix_sender -z 127.0.0.1 -i /tmp/trapper.txt 
Info from server: "Processed 250 Failed 0 Total 250 Seconds spent 0.002668"
Info from server: "Processed 50 Failed 0 Total 50 Seconds spent 0.000540"
sent: 300; skipped: 0; total: 300

Zabbix sender will terminate if invalid (not following parameter=value notation) parameter entry is present in specified configuration file.