Windows check-certificate Unknown command(s) showing

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
grayloglearn
Posts: 222
Joined: Thu Jul 06, 2017 8:55 am

Re: Windows check-certificate Unknown command(s) showing

Post by grayloglearn »

I am getting the below error after i added above.

root@ip-XXXX:/usr/local/nagios/libexec# ./check_nrpe -H 172.31.89.249 -u -t 90 -c PSCheckCertificate
scripts\Check-Certificate.ps1 : AuthorizationManager check failed.
At line:1 char:1
+ scripts\Check-Certificate.ps1; exit($lastexitcode)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Windows check-certificate Unknown command(s) showing

Post by scottwilkerson »

Now it at least looks like it is executing the script...

You may need to update to the following to bypass the execution policy

Code: Select all

PSCheckCertificate=cmd /c echo scripts\Check-Certificate.ps1; exit($lastexitcode) | powershell.exe -executionpolicy bypass -command -
then restart nsclient++
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
grayloglearn
Posts: 222
Joined: Thu Jul 06, 2017 8:55 am

Re: Windows check-certificate Unknown command(s) showing

Post by grayloglearn »

Hi Team,
Thanks its showing ok now. I am just adding the points for how to monitor the windows certificate monitoring, At least it will useful to for single person.

Windows certificate monitoring via nagios.
1) Download the windows certificate script from below link
https://gallery.technet.microsoft.com/s ... g-0c2d6f6c

2) Try to execute the script in windows server so that you will know that any errors are coming.
3) Copy the script in nsclient/scripts/ folder in windows server
4) Open the nsclient.ini and add the below lines to call the script from Nagios.

[/settings/external scripts/scripts]
PSCheckCertificate=cmd /c echo scripts\Check-Certificate.ps1; exit($lastexitcode) | powershell.exe -executionpolicy bypass -command –
5) Login to Nagios server create a command as below
define command {
command_name check_nrpe_Certificate
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -u -t 90 -c $ARG1$
}
6) root@XXXX:/usr/local/nagios/libexec# ./check_nrpe -H X.X.X.X -u -t 90 -c PSCheckCertificate
Certificates OK.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Windows check-certificate Unknown command(s) showing

Post by scottwilkerson »

Thanks for adding!

Locking thread
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked