Page 2 of 2

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

Posted: Sat Sep 14, 2019 4:36 am
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

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

Posted: Mon Sep 16, 2019 6:50 am
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++

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

Posted: Tue Sep 17, 2019 10:03 pm
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.

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

Posted: Wed Sep 18, 2019 6:14 am
by scottwilkerson
Thanks for adding!

Locking thread