NCPA need to run 64 bit version of powershell

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
btayl
Posts: 131
Joined: Mon Aug 24, 2020 8:51 am

NCPA need to run 64 bit version of powershell

Post by btayl »

I am running a powershell script that uses a FailoverClusters 64bit module not found in the 32bit powershell called NCPA need to run 64 bit version of powershell and load the module. added a copy of the powershell script
You do not have the required permissions to view the files attached to this post.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: NCPA need to run 64 bit version of powershell

Post by ssax »

If you look at the bottom of the ncpa.cfg on the remote machine you should see this:

Code: Select all

# Since windows NCPA is 32-bit, if you need to use 64-bit powershell, try the following for
# the powershell plugin definition:
# .ps1 = c:\windows\sysnative\windowspowershell\v1.0\powershell.exe -ExecutionPolicy Unrestricted -File $plugin_name $plugin_args
Please change this:

Code: Select all

.ps1 = powershell -ExecutionPolicy Bypass -File $plugin_name $plugin_args
To this:

Code: Select all

.ps1 = c:\windows\sysnative\windowspowershell\v1.0\powershell.exe -ExecutionPolicy Unrestricted -File $plugin_name $plugin_args
Then restart the NCPA services on the system and test it again.
btayl
Posts: 131
Joined: Mon Aug 24, 2020 8:51 am

Re: NCPA need to run 64 bit version of powershell

Post by btayl »

That worked
Now I am trying a different script
this is what it looks like in powershell
checkClusterOwner.ps1 'UHSPCNTDBCPR' 'SQL Server (MSSQLSERVER)'
how would I pass the argument in nagios?
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: NCPA need to run 64 bit version of powershell

Post by ssax »

You can try this:

Code: Select all

/usr/local/nagios/libexec/check_ncpa.py -H 192.168.X.X -t 'mytoken' -P 5693 -M plugins/checkClusterOwner.ps1 -a 'UHSPCNTDBCPR' 'SQL Server (MSSQLSERVER)'
One of the best parts of NCPA is if you go to https://YOURNCPAHOST:5693 and click the API it will show you what options are available and can help you construct the commands you need. Once you get one setup if you click the Run as a nagios check box another button on the bottom left shows up, if you click that View in alternative format button and click Active or Passive it will show you what command you should use.

See here as well:

https://www.nagios.org/ncpa/help.php
https://support.nagios.com/kb/article/n ... a-722.html
Locked