SQL PSSnapin issues with Nagios Core 3.2.3

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
phil_E
Posts: 1
Joined: Thu Nov 13, 2014 6:49 pm

SQL PSSnapin issues with Nagios Core 3.2.3

Post 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
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: SQL PSSnapin issues with Nagios Core 3.2.3

Post 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.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Locked