How to monitor Windows server from Icinga and Nagios?

Hi,
because Microsoft cut off WMI support, I need to migrate to a different way to monitor Windows server.
I read about:
Icinga for Windows
Icinga Agent
NSClient++

My problem is that I have a Nagios system monitoring, too, so, both Icinga and Nagios need to monitor Windows server.
How could I choose as agent useful both for Icinga and Nagios?

Could you suggest me a good solution for it?

Thanks a lot
Mario

If you are already monitoring your Windows systems with Nagios, why do you
also want to use Icinga? Surely you would choose either one or the other?

Antony.

you could use icinga powershell plugins and icinga powershell framework with nagios as it uses the nagios compatible return values

Because, I manage Icinga but our external support uses Nagios to monitor a subset of infrastructure.

So, I have to keep both the monitoring system.
Thanks

So, your suggestion is to install “Icinga for Windows” ?

yes, do that, add the commands and services to nagios and report back

1 Like

Ok.
So, when you speak about “add the commands and services to nagios and report back” how to do this?
Thanks a lot

that’s something i cant tell you because i don’t use nagios but i hope that helps.

the command definition in icinga looks like this:

object CheckCommand "Invoke-IcingaCheckICMP" {
    import "PowerShell Base"

    arguments += {
        "-C" = {
            order = 0
            value = "try { Use-Icinga -Minimal; } catch { Write-Output 'The Icinga PowerShell Framework is either not installed on the system or not configured properly. Please check https://icinga.com/docs/windows for further details'; Write-Output 'Error:' $$($$_.Exception.Message)Components:`r`n$$( Get-Module -ListAvailable 'icinga-powershell-*' )`r`n'Module-Path:'`r`n$$($$Env:PSModulePath); exit 3; }; Exit-IcingaExecutePlugin -Command 'Invoke-IcingaCheckICMP' "
        }
        "-Critical" = {
            order = 3
            value = "$ICMP_Object_Critical$"
        }
        "-CriticalPl" = {
            order = 5
            value = "$ICMP_Object_CriticalPl$"
        }
        "-Hostname" = {
            order = 6
            value = "$ICMP_String_Hostname$"
        }
        "-IPv4" = {
            order = 99
            set_if = "$ICMP_Switchparameter_IPv4$"
        }
        "-IPv6" = {
            order = 99
            set_if = "$ICMP_Switchparameter_IPv6$"
        }
        "-NoPerfData" = {
            order = 99
            set_if = "$ICMP_Switchparameter_NoPerfData$"
        }
        "-PacketCount" = {
            order = 7
            value = "$ICMP_Int32_PacketCount$"
        }
        "-PacketSize" = {
            order = 8
            value = "$ICMP_Int32_PacketSize$"
        }
        "-ThresholdInterval" = {
            order = 100
            value = "$ICMP_String_ThresholdInterval$"
        }
        "-Verbosity" = {
            order = 9
            value = "$ICMP_Int32_Verbosity$"
        }
        "-Warning" = {
            order = 2
            value = "$ICMP_Object_Warning$"
        }
        "-WarningPl" = {
            order = 4
            value = "$ICMP_Object_WarningPl$"
        }
    }
    vars.ICMP_Switchparameter_IPv4 = false
    vars.ICMP_Switchparameter_IPv6 = false
    vars.ICMP_Switchparameter_NoPerfData = false
}

with powershell base:

object CheckCommand "PowerShell Base" {
    import "plugin-check-command"
    command = [
        "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"
    ]
    timeout = 3m
    arguments += {
        "-ExecutionPolicy" = {
            order = -1
            value = "$IcingaPowerShellBase_String_ExecutionPolicy$"
        }
        "-NoLogo" = {
            order = -2
            set_if = "1"
        }
        "-NoProfile" = {
            order = -3
            set_if = "1"
        }
    }
    vars.IcingaPowerShellBase_String_ExecutionPolicy = "ByPass"
}

I tried the above command, but, from Icinga I obtain:

execvpe(C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe) failed: No such file or directory

What could I check?
Thanks a lot

looks like it get executed on the nagios server not on the windows server

I found on icinga2.log:

[2022-10-05 12:42:35 +0200] warning/PluginCheckTask: Check command for object ‘myserverwindow.domain.net!CPU Utilization IcingaForWindows’ (PID: 14445, arguments: ‘C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe’ ‘-NoProfile’ ‘-NoLogo’ ‘-ExecutionPolicy’ ‘Bypass’ ‘-C’ 'try { Use-Icinga -Minimal; } catch { Write-Output ‘The Icinga PowerShell Framework is either not installed on the system or not configured properly. Please check Introduction - Icinga for Windows for further details’; Write-Output ‘Error:’ $($_.Exception.Message)Components:rn$( Get-Module -ListAvailable ‘icinga-powershell-*’ )rn’Module-Path:'rn$($Env:PSModulePath); exit 3; }; Exit-IcingaExecutePlugin -Command ‘Invoke-IcingaCheckCPU’ ') terminated with exit code 128, output: execvpe(C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe) failed: No such file or directory

so you do have icinga2 not nagios?

you have to execute the check on the windows server.
if you use director you have to set “run on agent” yes
if you use config files you have to set the command_endpoint to the hostname

Hi, I implemented “Icinga for Windows” and implemented service on Icinga.

How could I implement service on Nagios, to use with “Icinga for Windows”?
Could you give me any suggestions?

Thanks a lot

Mario