Migrate Bills from Observium

Hi

To transfer Traffic Bills

Been playing around with migration from Observium,
not sure if this will work for all, but seems to have worked for me

Backup or snapshot both servers!!!

ON OBSERVIUM

login as root run the following:
mysqldump -p observium bills > bills.sql
mysqldump -p observium bill_data > bill_data.sql
mysqldump -p observium bill_history > bill_history.sql
mysqldump -p observium bill_ports > bill_ports.sql

SCP files from OBSERVIUM to LIBRENMS
scp bills.sql [email protected]:/root/
scp bill_history.sql [email protected]:/root/
scp bluesky/bill_ports.sql [email protected]:/root/
scp bill_data.sql [email protected]:/root/

ON LIBRENMS

login as root

login to mysql and backup the existing tables, to give you a way out!!!

mysql -u root -p
RENAME TABLE librenms.bills TO librenms.bills_backup;
RENAME TABLE librenms.bill_data TO librenms.bill_data_backup;
RENAME TABLE librenms.bill_history TO librenms.bill_history_backup;
RENAME TABLE librenms.bill_ports TO librenms.bill_ports_backup;

exit

Import the data

mysql -u root -p -D librenms < /root/bills.sql
mysql -u root -p -D librenms < /root/bill_history.sql
mysql -u root -p -D librenms < /root/bill_ports.sql
mysql -u root -p -D librenms < /root/bill_data.sql

You may have to reconnect the ports in the LibreNMS Traffic Bills and run the poller just in case

If it does not work and you renamed your old tables as suggested try this to get the database back to where you were.

ON LIBRENMS

login as root

login to mysql

mysql -u root -p
drop table if exists librenms.bills
drop table if exists librenms.bill_history
drop table if exists librenms.bill_ports
drop table if exists librenms.bill_data
RENAME TABLE librenms.bills_backup TO librenms.bills;
RENAME TABLE librenms.bill_data_backup TO librenms.bill_data;
RENAME TABLE librenms.bill_history_backup TO librenms.bill_history;
RENAME TABLE librenms.bill_ports_backup TO librenms.bill_ports;

Hope it helps.

1 Like

Hi,

you may want to look at https://github.com/librenms/librenms/pull/13757 or https://github.com/manonfgoo/librenms/blob/master/scripts/Migration/Traffic_bills.md This script handels the new DB Schema from librenms.