Page 1 of 1

Error checking .ps1 to check certificate expiration date

Posted: Fri Jun 16, 2023 3:31 am
by tomitomi
Hello,

Im testing this check:
https://exchange.nagios.org/directory/P ... ck/details

And i get this error:

Cannot process argument
transformation on parameter 'critical'. Cannot convert value "$" to type "System.Int32". Error: "Input string was not
in a correct format."
At line:1 char:42
+ scripts\check_certificate_expiration.ps1 $ARG1$; exit $LastExitCode
+ ~~~~~~
+ CategoryInfo : InvalidData: (:) [check_certificate_expiration.ps1], ParameterBindingArgumentTransformat
ionException
+ FullyQualifiedErrorId : ParameterArgumentTransformationError,check_certificate_expiration.ps1



If i try with -w and -c we got this other error:

/check_centreon_nrpe: invalid option -- 'w'

Any idea ?

Thanks,

Re: Error checking .ps1 to check certificate expiration date

Posted: Mon Jun 19, 2023 5:02 am
by tomitomi
Nobody ?

Re: Error checking .ps1 to check certificate expiration date

Posted: Tue Jun 20, 2023 12:09 am
by kg2857
I'd guess the arguments were incorrect but it's a script so you can make it print more to give you more clues.

Re: Error checking .ps1 to check certificate expiration date

Posted: Wed Jun 21, 2023 5:24 am
by tomitomi
If i run the script on a windows server works corretly, it must be some incompatibility with nagios/linux.

I will continue looking for information.

Thanks.

Re: Error checking .ps1 to check certificate expiration date

Posted: Sun Jun 25, 2023 11:32 pm
by Marilian
The arguments were probably wrong, but as it's a script, you can always make it print more information.
run 3

Re: Error checking .ps1 to check certificate expiration date

Posted: Wed Jul 05, 2023 5:45 am
by tomitomi
Marilian wrote: Sun Jun 25, 2023 11:32 pm The arguments were probably wrong, but as it's a script, you can always make it print more information.
run 3
This is the help, just two arguments, c and w

if ($help)
{
Write-Output ""
Write-Output "---------------------------------------------"
Write-Output "nm-check-certificate-expiration.ps1 v.$scriptversion"
Write-Output "---------------------------------------------"
Write-Output ""
Write-Output "Options:"
Write-Output "-c or -critical (number)"
Write-Output "-h or -help display help"
Write-Output "-w or -warning (number)"
Write-Output ""
Write-Output "Example:"
Write-Output ".\nm-check-certificate-expiration.ps1 -c 4 -w 10"
Write-Output ""
Write-Output "For more information visit:"
Write-Output "http://networklore.com/nelmon/"
Write-Output "http://networklore.com/windows-certificate-expiration/"
Write-Output ""
exit $returnStateUnknown
}

Re: Error checking .ps1 to check certificate expiration date

Posted: Thu Jul 06, 2023 7:28 am
by nehakakar
Regarding the "-w" and "-c" options, it seems that they are not recognized by the check_centreon_nrpe command. Double-check the command's syntax and options to ensure you are using the correct parameters.

Re: Error checking .ps1 to check certificate expiration date

Posted: Thu Jul 06, 2023 9:48 pm
by kg2857
Post the service defined, the command on the nagios host to run it, and the command defined on the host where it runs along with the agent used to run it.
It seems evident that along the line there's a syntax error.