This time, we will try to migrate our centreon solution from our previous Ubuntu 8.04 LTS to our new Ubuntu 10.04 LTS edition (It should work for other version too).
To do that, you should have the same centreon version on both side (for database scheme compatibility).
I use the same IP address for my both servers (it’s for a complete replacement)
Backup your Ubuntu 8.04 LTS solution
sudo service nagios stop sudo service centstorage stop sudo /usr/local/centreon/cron/purgeCentstorage sudo service centcore stop sudo service ndo2db stop
Check if there is some process still loaded by:
ps -A|grep nagios ps -A|grep cent ps -A|grep ndo
If you have some, please kill it with:
sudo kill -9 PID
mkdir backup mysqldump -u ndouser -pndopassword -h localhost ndo > backup/ndo.sql mysqldump -u CentDB -pmysqlcentdb -h localhost CentDB > backup/CentDB.sql mysqldump -u CentDB -pmysqlcentdb -h localhost StoreDB > backup/StoreDB.sql mkdir -p backup/var/lib/centreon mkdir -p backup/usr/local/nagios/var/ sudo cp -Rp /var/lib/centreon/* backup/var/lib/centreon
If you have added some additionnal commands, backup also these commands from the folder /usr/local/nagios/libexec/
Please keep only the additionnal commands you have added. You could copy perl an shell commands ‘as is’ but if you have some binary files, this rule should apply:
OS architecture Action
32bits to 32bits Simply copy the commands
64bits to 64bits Simply copy the commands
32bits to 64bits You have to rebuild the commands
64bits to 32bits You have to rebuild the commands
I personnaly advise to rebuild the binaries in any case. This will update the libraries dependency of your commands.
mkdir -p backup/usr/local/nagios/libexec/ sudo cp -p /usr/local/nagios/libexec/YOURCOMMAND backup/usr/local/nagios/libexec/
Compress the backup
tar czf backup.tar.gz backup --remove-files --anchored -p
Then copy it to a safe place.
Restore in Ubuntu 10.04 LTS
Stop the runing centreon solution:
sudo service nagios stop sudo service centstorage stop sudo /usr/local/centreon/cron/purgeCentstorage sudo service centcore stop sudo service ndo2db stop
Check if there is some process still loaded by:
ps -A|grep nagios ps -A|grep cent ps -A|grep ndo
If you have some, please kill it with:
sudo kill -9 PID
Copy your backup in your home location then uncompress it:
sudo tar xvfz backup.tar.gz -p cd backup
If your target server have a different IP adress, please change it in SQL files like this:
find *.sql -type f -exec sed -i 's/OLD_IP_ADDRESS/NEW_IP_ADDRESS/g' {} \;
mysql -u ndouser -pndopassword ndo < ndo.sql mysql -u CentDB -pmysqlcentdb CentDB < CentDB.sql mysql -u CentDB -pmysqlcentdb StoreDB < StoreDB.sql
In case you forgot the centreon admin password, you could reset it like that:
Convert your new password in MD5
echo -n "actwebaccess03" | md5sum
This will produce an encoded password for your web admin account.
ed212c9a1a32378c4682b55ae69a4894 -
Connect to mysql
mysql -u root --password=mysqlcentaccess03
Change the password:
use CentDB; UPDATE contact SET contact_passwd = 'ed212c9a1a32378c4682b55ae69a4894' WHERE contact_alias = 'admin'; exit
sudo cp -Rp backup/usr/local/nagios/libexec/* /usr/local/nagios/libexec/ sudo rm -R /var/lib/centreon/* sudo cp -Rp backup/var/lib/centreon/* /var/lib/centreon/
If needed, rebuild your binary commands.
Reboot your server and log you in.
Export your Nagios configuration.
Rebuild the RRD graphs by sellectint all the fields and use the rebuild action.