Migrating services and commands only

Hello,

I’m trying to set up an Icinga2 master development server which is identical to an existing master production server (icinga2, icingaweb2) both on centos7; however, I only want to move the services and commands from the production server, not the client information. Once the development server is identical to the production server in terms of services and commands, I can manually add one of the client servers so that I can test new scripts/checks, etc. Can you tell me which config files to migrate? I figure I should move /etc/icinga2 and /etc/icingaweb2 but not /var/lib/icinga2. I’m not sure about migrating the database from production to development server. Is there anything else I should be aware of when I do this migration?

Thanks,

Mark

Hi,

could you tell us more about your environment pls? How do you manage it? Do you use automation tools? Do you use the director? Do you write your config files on your own? Is it a single setup or a cluster installation?

Why I’m asking?

  • If you are using the director, you could use the basket function: https://icinga.com/docs/director/latest/doc/30-Configuration-Baskets/
  • if you are writing the config files on your own it’s depending on you how you handle this. If you seperated everything in own files (one for host, one for service, one for check commands etc.) you only need to transfer this
  • and if you are installation is a cluster and/or using the director, the files are saved in diffrent directories

Hello,

We are running a single production master server managed by director and using no automation tools at this time. We do not write config files. We would like to set up a development server. To do this, we’d like to migrate the services and commands from the production server to the development server, not the host information. Right now I’m entering the services/command information manually which is taking long. Is there a better way to do this?

Please advise,

Mark

Hi,

if you are still using the director, the basket is a good choice to transfer the config.

Hi,

I set up a basket and created a snapshot. I got the following error:

===
Error while sending QUERY packet. PID=27517 (Pdo.php:219)

#0 [internal function]: Icinga\Application\ApplicationBootstrap->Icinga\Application\{closure}(2, 'Error while sen...', '/usr/share/icin...', 219, Array)
#1 /usr/share/icingaweb2/library/vendor/Zend/Db/Statement/Pdo.php(219): PDOStatement->execute(Array)
#2 /usr/share/icingaweb2/library/vendor/Zend/Db/Statement.php(297): Zend_Db_Statement_Pdo->_execute(Array)
#3 /usr/share/icingaweb2/library/vendor/Zend/Db/Adapter/Abstract.php(470): Zend_Db_Statement->execute(Array)
#4 /usr/share/icingaweb2/library/vendor/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT COUNT(*)...', Array)
#5 /usr/share/icingaweb2/library/vendor/Zend/Db/Adapter/Abstract.php(816): Zend_Db_Adapter_Pdo_Abstract->query('SELECT COUNT(*)...', Array)
#6 /usr/share/icingaweb2/modules/incubator/vendor/gipfl/icingaweb2/src/Zf1/Db/SelectPaginationAdapter.php(42): Zend_Db_Adapter_Abstract->fetchOne('SELECT COUNT(*)...')
#7 [internal function]: gipfl\IcingaWeb2\Zf1\Db\SelectPaginationAdapter->count()
#8 /usr/share/icingaweb2/modules/incubator/vendor/gipfl/icingaweb2/src/Widget/Paginator.php(134): count(Object(gipfl\IcingaWeb2\Zf1\Db\SelectPaginationAdapter))
#9 /usr/share/icingaweb2/modules/incubator/vendor/gipfl/icingaweb2/src/Widget/Paginator.php(115): gipfl\IcingaWeb2\Widget\Paginator->getTotalItemCount()
#10 /usr/share/icingaweb2/modules/incubator/vendor/gipfl/icingaweb2/src/Widget/Paginator.php(457): gipfl\IcingaWeb2\Widget\Paginator->getPageCount()
#11 /usr/share/icingaweb2/modules/ipl/vendor/ipl/html/src/HtmlDocument.php(273): gipfl\IcingaWeb2\Widget\Paginator->render()
#12 /usr/share/icingaweb2/modules/ipl/vendor/ipl/html/src/BaseHtmlElement.php(175): ipl\Html\HtmlDocument->renderUnwrapped()
#13 /usr/share/icingaweb2/modules/ipl/vendor/ipl/html/src/BaseHtmlElement.php(213): ipl\Html\BaseHtmlElement->renderContent()
#14 /usr/share/icingaweb2/modules/ipl/vendor/ipl/html/src/HtmlDocument.php(211): ipl\Html\BaseHtmlElement->renderUnwrapped()
#15 /usr/share/icingaweb2/modules/ipl/vendor/ipl/html/src/HtmlDocument.php(273): ipl\Html\HtmlDocument->render()
#16 /usr/share/icingaweb2/modules/ipl/vendor/ipl/html/src/BaseHtmlElement.php(175): ipl\Html\HtmlDocument->renderUnwrapped()
#17 /usr/share/icingaweb2/modules/incubator/vendor/gipfl/icingaweb2/src/Widget/Controls.php(161): ipl\Html\BaseHtmlElement->renderContent()
#18 /usr/share/icingaweb2/modules/ipl/vendor/ipl/html/src/BaseHtmlElement.php(213): gipfl\IcingaWeb2\Widget\Controls->renderContent()
#19 /usr/share/icingaweb2/modules/ipl/vendor/ipl/html/src/HtmlDocument.php(211): ipl\Html\BaseHtmlElement->renderUnwrapped()
#20 /usr/share/icingaweb2/modules/ipl/vendor/ipl/html/src/HtmlDocument.php(285): ipl\Html\HtmlDocument->render()
#21 /usr/share/icingaweb2/modules/incubator/vendor/gipfl/icingaweb2/src/Zf1/SimpleViewRenderer.php(61): ipl\Html\HtmlDocument->__toString()
#22 /usr/share/icingaweb2/modules/incubator/vendor/gipfl/icingaweb2/src/Zf1/SimpleViewRenderer.php(104): gipfl\IcingaWeb2\Zf1\SimpleViewRenderer->render()
#23 /usr/share/icingaweb2/library/vendor/Zend/Controller/Action/HelperBroker.php(272): gipfl\IcingaWeb2\Zf1\SimpleViewRenderer->postDispatch()
#24 /usr/share/icingaweb2/library/vendor/Zend/Controller/Action.php(518): Zend_Controller_Action_HelperBroker->notifyPostDispatch()
#25 /usr/share/php/Icinga/Web/Controller/Dispatcher.php(76): Zend_Controller_Action->dispatch('snapshotsAction')
#26 /usr/share/icingaweb2/library/vendor/Zend/Controller/Front.php(937): Icinga\Web\Controller\Dispatcher->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))
#27 /usr/share/php/Icinga/Application/Web.php(300): Zend_Controller_Front->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))
#28 /usr/share/php/Icinga/Application/webrouter.php(99): Icinga\Application\Web->dispatch()
#29 /usr/share/icingaweb2/public/index.php(4): require_once('/usr/share/php/...')
#30 {main}
#0 /usr/share/icingaweb2/library/vendor/Zend/Db/Statement.php(297): Zend_Db_Statement_Pdo->_execute(Array)
#1 /usr/share/icingaweb2/library/vendor/Zend/Db/Adapter/Abstract.php(470): Zend_Db_Statement->execute(Array)
#2 /usr/share/icingaweb2/library/vendor/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT b.uuid, ...', Array)
#3 /usr/share/icingaweb2/library/vendor/Zend/Db/Adapter/Abstract.php(725): Zend_Db_Adapter_Pdo_Abstract->query(Object(Zend_Db_Select), Array)
#4 /usr/share/icingaweb2/modules/incubator/vendor/gipfl/icingaweb2/src/Table/ZfQueryBasedTable.php(99): Zend_Db_Adapter_Abstract->fetchAll(Object(Zend_Db_Select))
#5 /usr/share/icingaweb2/modules/incubator/vendor/gipfl/icingaweb2/src/Table/QueryBasedTable.php(227): gipfl\IcingaWeb2\Table\ZfQueryBasedTable->fetchQueryRows()
#6 /usr/share/icingaweb2/modules/incubator/vendor/gipfl/icingaweb2/src/Table/QueryBasedTable.php(161): gipfl\IcingaWeb2\Table\QueryBasedTable->fetch()
#7 /usr/share/icingaweb2/modules/incubator/vendor/gipfl/icingaweb2/src/Table/QueryBasedTable.php(112): gipfl\IcingaWeb2\Table\QueryBasedTable->fetchRows()
#8 /usr/share/icingaweb2/modules/ipl/vendor/ipl/html/src/BaseHtmlElement.php(213): gipfl\IcingaWeb2\Table\QueryBasedTable->renderContent()
#9 /usr/share/icingaweb2/modules/ipl/vendor/ipl/html/src/HtmlDocument.php(211): ipl\Html\BaseHtmlElement->renderUnwrapped()
#10 /usr/share/icingaweb2/modules/ipl/vendor/ipl/html/src/HtmlDocument.php(273): ipl\Html\HtmlDocument->render()
#11 /usr/share/icingaweb2/modules/ipl/vendor/ipl/html/src/BaseHtmlElement.php(175): ipl\Html\HtmlDocument->renderUnwrapped()
#12 /usr/share/icingaweb2/modules/ipl/vendor/ipl/html/src/BaseHtmlElement.php(213): ipl\Html\BaseHtmlElement->renderContent()
#13 /usr/share/icingaweb2/modules/ipl/vendor/ipl/html/src/HtmlDocument.php(211): ipl\Html\BaseHtmlElement->renderUnwrapped()
#14 /usr/share/icingaweb2/modules/ipl/vendor/ipl/html/src/HtmlDocument.php(285): ipl\Html\HtmlDocument->render()
#15 /usr/share/icingaweb2/modules/incubator/vendor/gipfl/icingaweb2/src/Zf1/SimpleViewRenderer.php(65): ipl\Html\HtmlDocument->__toString()
#16 /usr/share/icingaweb2/modules/incubator/vendor/gipfl/icingaweb2/src/Zf1/SimpleViewRenderer.php(104): gipfl\IcingaWeb2\Zf1\SimpleViewRenderer->render()
#17 /usr/share/icingaweb2/library/vendor/Zend/Controller/Action/HelperBroker.php(272): gipfl\IcingaWeb2\Zf1\SimpleViewRenderer->postDispatch()
#18 /usr/share/icingaweb2/library/vendor/Zend/Controller/Action.php(518): Zend_Controller_Action_HelperBroker->notifyPostDispatch()
#19 /usr/share/php/Icinga/Web/Controller/Dispatcher.php(76): Zend_Controller_Action->dispatch('snapshotsAction')
#20 /usr/share/icingaweb2/library/vendor/Zend/Controller/Front.php(937): Icinga\Web\Controller\Dispatcher->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))
#21 /usr/share/php/Icinga/Application/Web.php(300): Zend_Controller_Front->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))
#22 /usr/share/php/Icinga/Application/webrouter.php(99): Icinga\Application\Web->dispatch()
#23 /usr/share/icingaweb2/public/index.php(4): require_once('/usr/share/php/...')
#24 {main}
===

Mark

Which director version you have installed? And also which from the dependency packages like ipl, incubator …

You get this while creating the snapshot?

My guess would be that you are missing some php packages.
php-mbstring and php-pdo come to my mind reading the error log.

Using director version 1.7.2.

Yes, we get this while creating the snapshot. php-mbstring and php-pdo are installed.

incubator and ipl are installed:

ls /usr/share/icingaweb2/modules/
director grafana idoreports ipl pdfexport reactbundle setup
doc graphite incubator monitoring pnp reporting translation

I resolved the issue by increasing max_allowed_packet in my.cnf.