The data that we sent so far was considered to be received at that exact moment—the 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_sender—when 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.
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 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.