How to transfer zabbix item from different hosts and save item statistic

migrationzabbix

There are two server's (srv1 and srv2). Mysql server has been installed on which of them. Srv1 mysql contains database (db1). Zabbix-server get statistic throw configured agent user parameter (https://www.zabbix.com/documentation/2.0/manual/config/items/userparameters). Yesterday i has been copyed database db1 from mysql srv1 to mysql srv2. I can clone zabbix server item (https://www.zabbix.com/documentation/2.0/manual/config/items) to srv2, but lost all srv1 db1 statistic. Can you advice how keep them?

Best Answer

You have to find the itemid from your old data - look that up in the table "items" ("hostid" is the relevant field to find the data from your old host)

If you get the itemid update your history data to match from the old item to the new one:

UPDATE history SET itemid = <itemid new_host> WHERE itemid = <itemid old_host>;

Do that for your trends table too and you should be fine.