Automate of manual backup/restore xi to xi
Posted: Fri Oct 22, 2021 10:51 pm
We are beginning a hardware refresh and moving from CentOS to Ubuntu for the base OS. I am planning to use the manual backup/restore process to move over the data from the old machines but I would prefer to automate these tasks. I am looking for a command line way to do the following:
From the core config manager I need to write configs and delete files. How can this be done from the cli?
From there I move over the files which I can easily automate with Ansible file copy module:
scp -r /usr/local/nagios/etc/ user@serverip:/usr/local/nagios/
scp -r /etc/mrtg/conf.d/ user@serverip:/etc/mrtg/
scp -r /var/lib/mrtg user@serverip:/var/lib/
scp -r /usr/local/nagios/share/perfdata user@serverip:/usr/local/nagios/share/
Then I need to run the import configs tool and import in the following order: commands, time, periods, contact templates, etc. How can this import be done from the cli?
Finally I want to write and verify the import. How can this be done from the cli?
Note, there is an import API call but I am not sure how it would work since it looks for files in /usr/local/nagios/etc/import.
Thanks!
From the core config manager I need to write configs and delete files. How can this be done from the cli?
From there I move over the files which I can easily automate with Ansible file copy module:
scp -r /usr/local/nagios/etc/ user@serverip:/usr/local/nagios/
scp -r /etc/mrtg/conf.d/ user@serverip:/etc/mrtg/
scp -r /var/lib/mrtg user@serverip:/var/lib/
scp -r /usr/local/nagios/share/perfdata user@serverip:/usr/local/nagios/share/
Then I need to run the import configs tool and import in the following order: commands, time, periods, contact templates, etc. How can this import be done from the cli?
Finally I want to write and verify the import. How can this be done from the cli?
Note, there is an import API call but I am not sure how it would work since it looks for files in /usr/local/nagios/etc/import.
Thanks!