Page 1 of 1

SQL PSSnapin issues with Nagios Core 3.2.3

Posted: Thu Nov 13, 2014 7:01 pm
by phil_E
Hi

I'm working on some basic functionality plugins to get my feet wet on Nagios using Powershell 2.0 and NRPE_NT.exe - (NRPE_NT v0.8b/2.0)

I have a script that basically makes a connection to SQL and confirms its up...

So i have all this configured and working as expected against a win2008R2 - SQL 2012 instance (where Powershell is using the sqlps module)

But when i set it up against a win2008R2 - SQL2008R2 box (the OS is a clone of the other so exactly the same) using the powershell PSSnapin's it will not recognize the snapins..

The PS commands work just fine outside of nagios on both boxes so its something with nagios... i have tried forcing powershell to run a 32bit & 64bit exe and get the same error.

The command i have configured is -
command[SQL_IsAlive]=cmd /c echo C:\nagios\powershell\SQL_IsAlive.ps1 $ARG1$ "$ARG2$" "$ARG3$"; exit $($LastExitCode) | powershell.exe -NoProfile -NonInteractive -NoLogo -Executionpolicy remotesigned -command -

and i have even run this exact command in a dos windows (with and without admin rights) and it allways works..except when i run it through nagios

And it fails in nagios either on the console or through the Core side - /usr/lib/nagios/plugins/check_nrpe -H 192.168.1.1 -t 20 -c SQL_IsAlive -a . user password

Any ideas ?

Thanks

Phil

Re: SQL PSSnapin issues with Nagios Core 3.2.3

Posted: Fri Nov 14, 2014 11:16 am
by sreinhardt
What user account is nrpe running as on your windows service? My guess would be that your nrpe\nagios windows account may not have permissions to load those modules. I'd suggest logging in directly as that user, opening a non-admin ps shell, and trying your script from there. See if we get any errors.