Linux – Run remote Powershell from Nagios – nrpe_check

I experienced a strange problem when calling Powershell from nagios to
check failover cluster status.

Note – using old NRPE_NT nagios agent – no problem with NSClient++.

The Get-Cluster cmdlet failed each time the script was executed.
I thought this was related to the fact that this cmdlet requires elevated privieges,
but this was not the case. The issue occurred because NRPE_NT is running as a 32-bit program
and this calls 32-bit cmd, which calls 32-bit Powershell.

If you want to run 64-bit Powershell and use 64-bit Powershell commands,
from nagios, 64-bit powershell must be executed. This means that C:\WINDOWS\sysnative
is required.

nrpe.cfg on Windows
….
command[failover-cluster-check]=C:\WINDOWS\sysnative\WindowsPowerShell\v1.0\powershell.exe “& path\check_1.ps1”
….

if not using NSClient++
– the NRPE_NT service is running as a 32-bit executable
– it runs cmd as 32-bit
– 32-bit cmd calls 32-bit powershell unless C:\WINDOWS\sysnative\ is used