In part 1 through 3 in this series we looked at implementing Icinga2 in our network environment. We started with this topology.

We installed an Icinga2 master and then a Linux and Windows Node. On both of the nodes we used the Node Wizard to install the Icinga2 agent. That established a secure connection from the node to the master. I allowed sending commands to the nodes to monitor its services.

But what if we don’t want to use the agent? What if Microsoft already build the monitoring/managing tools into Windows? Well you’re in luck, Microsoft just did that: it’s called WMI. Learn more about WMI here (https://msdn.microsoft.com/en-us/library/aa384642(v=vs.85).aspx).

There are more advantages in using WMI for Windows Nodes:

  • Increased server, services, and application availability
  • Fast detection of server and operating system failures
  • Fast detection of service and application failures
  • Agentless monitoring

For WMI to work with Icinga2 we need to install a WMI module. We use Check WMI plus, you can find all the information about this plugin here (http://www.edcint.co.nz/checkwmiplus/).

Installing Perl modules

I am using Ubuntu 16.04. Perl is installed by default. We need to install some Perl modules for Check WMI Plus.

Do this as root:

You can see which perl modules are installed with:

Installing Linux WMI Client.

Check WMI Plus relies on a WMI client for Linux to send its commands to the Windows nodes. You can build it from source, but I find that the linux WMI client is a bit old now and does not really compiles well with having to rely on old dependencies.
The easies method is just to install pre-compiled packages in Ubuntu 16.04. The WMI-client package depends on python and python-support. On Ubuntu 16.04 the python-support package isn’t available by default, so we need to install this first.

Now we proceed with the libw- and wmi-packages.

The WMI client command is located at: /usr/bin/wmic

Install Check WMI Plus module

With all the dependencies in place we proceed by installing Check WMI Plus module:

Copy relevant files to the plug-in map:

We now going to edit the Check WMI plus configuration:

Change the lib and base-dir map accordingly. It tells the perl script where it is installed on the server and where to find the check_wmi_plus.d map.

Configuring the Windows Node.

For Icinga2 commands to be accepted we need to provide a user account with the right privileges on the Windows host. Let’s create the authorization file for plug-in (/etc/icinga2/wmi.auth) with the following contents:

The best method is to create a designated user for Icinga2. More information on how to add this specific user see here.

On the Windows host we need to enable remote desktop in the firewall and enable WinRM service at start-up:

The second command sets up a listener on the Windows node. Answer yes to apply these changes.

Configuring Icinga2

Now that Check WMI plus is correctly setup we can add the new command to Icinga.

Add a new WMI template:

Here you can set global options for the services. Like check-interval and retry-interval.
The only thing you need to add is the services you want. I created a new conf-file and named it WMI-services.conf.

Services in Icinga Web 2

Always after changing the conf-files you need to restart Icinga2

You will see the new command’s pending. And after a while they show up green.

Conclusion

We now have Windows WMI integrated within Icinga2. This has great advantages. Now you do not have to install an agent. This makes changes in the future much easier to implement. What if the Icinga2 master gets another IP?
The initial node setup can be done in deployment or you can use a post-install install script. This makes deployment of possible hundreds of Windows nodes much easier to implement.
But we are not done. Maybe you saw it already in the screen shots. Icinga2 comes with an excellent Graphite module for all those nifty charts Icinga2 can produce. In the next part we are going to look at this module and how to install it on our Icinga2 master.