Performing the change

By now, we should have two cryptic-looking values:

  • The time in Unix timestamp format
  • The item ID

What do we have to do now? Multiply by eight all of the values for the item ID before that timestamp. With the data we have, it's actually quite simpleā€”in the MySQL console, we would have to execute this:

mysql> update history_uint set value=value*8 where itemid=<our ID>   and clock<'<our timestamp>';
To be safe, you might want to perform the modifications in a transaction and check the results while the transaction is still open. If the results are satisfactory, commit the changes. If not, roll them back.

We are updating history_uint, because even though the data for the network traffic is a decimal number because of the Store as item option, we dropped the decimal part by storing the data as an integer. See Chapter 3, Monitoring with Zabbix Agents and Basic Protocols, to remind yourself why we did so. This single query should be enough to convert all of the old data into bits.

If you have lots of historical data in total and for this item, such a query can take quite some time to complete. When running such commands on a remote system, use a tool such as screen.
We're only modifying the history table here. If the item has been collecting data for a longer period of time, we would also have to modify the corresponding trends or trends_uint tables.
..................Content has been hidden....................

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