Follow-up from the recent blog post on developing Icinga 2 on Windows:

Now that we’ve learned how to compile and develop Icinga 2 on Windows, it’s all about running it and also creating a setup package for installation.

 

Build Release Package

CMake uses CPack and NSIS to create the setup executable including all binaries and libraries in addition to setup dialogues and configuration. Therefore we’ll need to install NSIS first.

Once completed navigate to your Visual Studio project and tell CMake to build a release package.

cd "c:\Users\michi\Documents\Visual Studio 2015\Projects\icinga2"
cmake --build . --target PACKAGE --config Release

icinga2_windows_cmake_build_exe

Note: This will still use the debug builds from the previous Visual Studio integration guide. A yet more clean approach is to run CMake with changed release parameters beforehand and then re-run the release package builder.

cd "c:\Users\michi\Documents\Visual Studio 2015\Projects\icinga2"
cmake . -DBOOST_ROOT=C:\boost_1_60_0 -DBISON_EXECUTABLE=C:\ProgramData\chocolatey\lib\winflexbison\tools\win_bison.exe -DFLEX_EXECUTABLE=C:\ProgramData\chocolatey\lib\winflexbison\tools\win_flex.exe -DICINGA2_WITH_MYSQL=OFF -DICINGA2_WITH_PGSQL=OFF -DICINGA2_UNITY_BUILD=ON

cmake --build . --target PACKAGE --config Release

The CMake instructions are defined inside the main icinga2 git repository in CMakeLists.txt (look for variables with prefix CPACK_).

Run Icinga 2

While you can run the icinga2 daemon in foreground, you should be well aware that the default mechanism is to install a Windows service and let it handle the start, stop and reload actions for Icinga 2.

Apart from that you may just use the icinga2 cli commands known from the documentation, such as “icinga2.exe daemon -C” for validating the configuration on your Windows client.

Another example: “object list”

icinga2_windows_object_list

Michael Friedrich

Autor: Michael Friedrich

Michael ist seit vielen Jahren Icinga Developer und hat sich Ende 2012 in das Abenteuer NETWAYS gewagt. Ein Umzug von Wien nach Nürnberg mit der Vorliebe, österreichische Köstlichkeiten zu importieren - so mancher Kollege verzweifelt an den süchtig machenden Dragee-Keksi. Oder schlicht am österreichischen Dialekt der gerne mit Thomas im Büro intensiviert wird ("Jo eh."). Wenn sich Michael mal nicht im Monitoring-Portal helfend meldet, arbeitet er am nächsten LEGO-Projekt oder geniesst das schöne Nürnberg. Oder - at an Icinga Camp near you 😉