Windows check-certificate Unknown command(s) showing

This board serves as an open discussion and support collaboration point for Nagios XI. NOTE: Nagios XI customers should use the Customer Support forum to obtain expedited support.

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

Postby grayloglearn » Sat Sep 14, 2019 4:36 am

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
grayloglearn
 
Posts: 176
Joined: Thu Jul 06, 2017 8:55 am

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

Postby scottwilkerson » Mon Sep 16, 2019 6:50 am

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++
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 17032
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

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

Postby grayloglearn » Tue Sep 17, 2019 10:03 pm

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.
grayloglearn
 
Posts: 176
Joined: Thu Jul 06, 2017 8:55 am

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

Postby scottwilkerson » Wed Sep 18, 2019 6:14 am

Thanks for adding!

Locking thread
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 17032
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Previous

Return to Nagios XI

Who is online

Users browsing this forum: Google [Bot] and 14 guests