SQL PSSnapin issues with Nagios Core 3.2.3
Posted: Thu Nov 13, 2014 7:01 pm
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
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