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.

Windows check-certificate Unknown command(s) showing

Postby grayloglearn » Tue Sep 10, 2019 2:15 am

Hi Team,

I want to monitor the windows server certificate monitoring using nagios. I have downloaded the check_certificate plugin and executed in server which looks working fine. Find the attachment for output while executed the script.

But when we are calling the same script we are not getting command error from nagios server. The below are the configuration from nagios server end.

define command {
command_name check_nrpe_Certificate
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -u -t 90 -c $ARG1$
}

root@ip-xxxxx:/usr/local/nagios/libexec# ./check_nrpe -H 172.31.89.249 -t 90 -c Check-Certificate
Unknown command(s): check-certificate

We have added some details in nsclient.in as follows below and we copy the script in nsclint++/script/

[/settings/external scripts/]
PSCheckCertificate=cmd /c echo scripts\Check-Certificate.ps1; exit($lastexitcode) | powershell.exe -command -

Please suggest where we are doing mistake.
grayloglearn
 
Posts: 173
Joined: Thu Jul 06, 2017 8:55 am

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

Postby mcapra » Tue Sep 10, 2019 10:00 am

grayloglearn wrote:[/settings/external scripts/]
PSCheckCertificate=cmd /c echo scripts\Check-Certificate.ps1; exit($lastexitcode) | powershell.exe -command -


In your nsclient.ini, you've named the command PSCheckCertificate. That is what you should be passing as the command name -c via check_nrpe:

Code: Select all
#check_nrpe -H 172.31.89.249 -t 90 -c PSCheckCertificate


More info:
https://docs.nsclient.org/howto/external_scripts/
Former Nagios employee
http://www.mcapra.com/
User avatar
mcapra
 
Posts: 3587
Joined: Thu May 05, 2016 3:54 pm

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

Postby scottwilkerson » Tue Sep 10, 2019 12:31 pm

Thanks @mcapra
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: 17023
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

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

Postby grayloglearn » Wed Sep 11, 2019 11:42 pm

Hi team,

We have tried with the below but still we are getting same error.
root@ip-xxxx:/usr/local/nagios/libexec# ./check_nrpe -H 172.31.89.249 -t 90 -c PSCheckCertificate
Unknown command(s): pscheckcertificate
grayloglearn
 
Posts: 173
Joined: Thu Jul 06, 2017 8:55 am

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

Postby scottwilkerson » Thu Sep 12, 2019 7:14 am

grayloglearn wrote:Hi team,

We have tried with the below but still we are getting same error.
root@ip-xxxx:/usr/local/nagios/libexec# ./check_nrpe -H 172.31.89.249 -t 90 -c PSCheckCertificate
Unknown command(s): pscheckcertificate


Can you share your nsclient.ini from 172.31.89.249?

Thanks
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: 17023
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

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

Postby grayloglearn » Fri Sep 13, 2019 1:53 am

Hi Team
Please find the attachment for nsclient.ini
Attachments
nsclient-support.txt
(1.29 KiB) Downloaded 8 times
grayloglearn
 
Posts: 173
Joined: Thu Jul 06, 2017 8:55 am

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

Postby scottwilkerson » Fri Sep 13, 2019 6:46 am

Did you restart the NSClient++ service after adding the PSCheckCertificate command?
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: 17023
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

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

Postby grayloglearn » Fri Sep 13, 2019 1:30 pm

Yes I have restarted multiple times..
grayloglearn
 
Posts: 173
Joined: Thu Jul 06, 2017 8:55 am

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

Postby scottwilkerson » Fri Sep 13, 2019 1:34 pm

I guess next we need to look in the nsclient.log to see what errors are in there
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: 17023
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

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

Postby scottwilkerson » Fri Sep 13, 2019 1:36 pm

Oh I just noticed this in your nsclient.ini file
this
Code: Select all
[/settings/external scripts/]
PSCheckCertificate=cmd /c echo scripts\Check-Certificate.ps1; exit($lastexitcode) | powershell.exe -command -


should be this
Code: Select all
[/settings/external scripts/scripts]
PSCheckCertificate=cmd /c echo scripts\Check-Certificate.ps1; exit($lastexitcode) | powershell.exe -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: 17023
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Next

Return to Nagios XI

Who is online

Users browsing this forum: andrea.bolongaro, MSN [Bot] and 17 guests