Adapting Icinga Web modules To Icinga DB

by | Feb 23, 2022

Icinga DB web has a better layout and is more user friendly. This makes monitoring more simple. Hence it would be nice if we could adapt all the Icinga modules to Icinga DB.

In this blogpost, I will discuss how to adapt Icinga Web modules to Icinga DB. To do this, first and foremost, install and enable the Icinga DB module. Currently, monitoring backend is the default backend for all the modules. Hence we would need a toggle button in the corresponding Icinga Web module, to switch between Icinga DB backend and monitoring backend. We introduce this toggle button through IcingadbSupportHook in the Icinga DB Web module.

For the modules supporting both monitoring and Icinga DB backend to see the toggle button, add a hook IcingadbSupport hook that just extends IcingadbSupportHook in the ProvidedHook\Icingadb namespace of the corresponding module with the following code.

class IcingadbSupport extends IcingadbSupportHook
{

}

Subsequently, add $this->provideHook('icingadb/icingadbSupport'); to run.php of the module.

Other than this also introduce some code to obtain the object details from the Icinga DB module when you enable the toggle button. So that the links for the monitored objects would point to the corresponding object in the Icinga DB Web module.

Also, the default backend for the modules supporting Icinga DB module will be set to Icinga DB backend, when you disable the monitoring module.

Here, I will show how to adapt business process module to Icinga DB module. I have already installed Icinga DB module and enabled it.

As I have already mentioned we need a toggle button as shown in the figure below. This toggle button is made visible by adding IcingadbSupport  hook in the ProvidedHook namespace of the module. In the business process module we introduce IcingaDbObject class to fetch the object names for the monitored nodes and IcingadbState class to calculate states for the monitored nodes in the business process when it uses Icinga DB backend.

To demonstrate how this actually works create a dummy business process with default backend. To see how to create the business process refer to this blogpost or to the business process documentation.

Add a dummy node is to this business process.  Subsequently, add some hosts from monitoring module to the dummy node. This business process uses the monitoring backend as default backend.

If you enable the toggle button, the business process uses Icinga DB backend. Hence, when you click on the monitored object nodes, it will take you to the object detail in Icinga DB module.

If you disable the monitoring backend, it uses the Icinga DB backend as default backend. You can already see these code changes in business process module master branch. Hence, you can use this branch to further explore the business process module that supports Icinga DB.

You May Also Like…

Releasing Icinga Director v1.11.3

Releasing Icinga Director v1.11.3

We are happy to announce the release of Icinga Director version 1.11.3. This release addresses few important bug fixes...

Subscribe to our Newsletter

A monthly digest of the latest Icinga news, releases, articles and community topics.