Hi guys,
the last time our server admins installed on our windows server Icinga as agent with automatic deployment tools and the old PowerShell module. The last time there are more and more requirement for new checks. So I test diffrent checks like the new PowerShell Framework/Plugins where I often need the debug log on Windows.
Here is described how to enable the debug log under Windows: Troubleshooting - Icinga 2
C:\Program Files\ICINGA2\sbin> .\icinga2.exe feature enable debuglog
That means it’s the same way as we know from our Linux setups. But we saw that this isn’t working in our setups. No log file is created. So we tried to open a new shell and write a log file during debuging with the call. By the way also the main log is not written.
C:\Program Files\ICINGA2\sbin>icinga2.exe daemon --log-level debug >[path]\debug.log
for the debugging session. This is working but not everything is written in the file. e.g. how icinga calls check plugins incl. parameter.
By chance a colleague of mine discovered the following entries in icinga2.conf, which are sadly not in the documention for windows setups:
/* Define our block required to enable or disable Icinga 2 debug log
- Enable or disable it by using the PowerShell Module with
- argument -IcingaEnableDebugLog or by switching
- PowerShellIcinga2EnableDebug to true or false manually.
- true: Debug log is active
- false: Debug log is deactivated
- IMPORTANT: “;” after true or false has to remain to allow the
PowerShell Module to switch this feature on or off.
*/
const PowerShellIcinga2EnableDebug = false;
const PowerShellIcinga2EnableLog = false;if (PowerShellIcinga2EnableDebug) {
object FileLogger “debug-file” {
severity = “debug”
path = LocalStateDir + “/log/icinga2/debug.log”
}
}
With setting the following constants to true
const PowerShellIcinga2EnableDebug = false;
const PowerShellIcinga2EnableLog = false;
and restart the Icinga service - et voilĂ - the log files are created and Icinga writes long entries!
So the conclussion is you don’t need to enable the feature mainlog and debuglog under Windows. You need only the set this constantes to true. That’s all. I don’t know if it’s a bug, a feature or something else …
I hope this help some people, who maybe have the same problem like us. As I wrote, sadly that this is not documented.
Edit:
A reason could be, using the old powershell module https://github.com/Icinga/icinga2-powershell-module, because the icinga2.conf is created by the installation routine!