Sending timestamped values

The data that we sent so far was considered to be received at that exact momentthe values had the timestamp assigned by the server when it got them. Every now and then, there's a need to send values in batches for a longer period of time or import a backlog of older values. This can be easily achieved with zabbix_senderwhen sending values from a file, it supports supplying a timestamp. When doing so, the value field in the input file is shifted to the right and the timestamp is inserted as the third field. For a quick test, we could generate timestamps one, two, and three days ago:

$ for i in 1 2 3; do date -d "-$i day" "+%s"; done  

Take the resulting timestamps and use them in a new input file:

- room.persons 1462745422 11 
"A test host" room.persons 1462659022 12 
- room.persons 1462572622 13 

With a file named sender_input_timestamps.txt, we would additionally use the -T flag to tell zabbix sender that it should expect the timestamps in there:

$ zabbix_sender -c /usr/local/etc/zabbix_agentd.conf -T -i /tmp/sender_input_timestamps.txt

All three values should be sent successfully.

When sending in values for a longer period of time, make sure the history and trend retention periods for that item match your needs. Otherwise, the housekeeper process could delete the older values soon after they're sent in.

Looking at the graph or latest values for this item, it's probably slightly messed up. The timestamped values we just sent in are likely to be overlapping in time with the previous values. In most cases, sending in values normally and with timestamps for the same item isn't suggested.

If the Zabbix trapper items have triggers configured against them, timestamped values should only be sent with increasing timestamps. If values are sent in a reversed or chaotic older-newer-older order, the generated events won't make sense.
If data is sent in for a host that's in a no-data maintenance, the values are also discarded if the value timestamp is outside the current maintenance window. Maintenance was discussed in Chapter 5, Managing Hosts, Users, and Permissions.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.21.104.109