Error checking .ps1 to check certificate expiration date

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Post Reply
tomitomi
Posts: 4
Joined: Fri Jun 16, 2023 3:09 am

Error checking .ps1 to check certificate expiration date

Post 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,
tomitomi
Posts: 4
Joined: Fri Jun 16, 2023 3:09 am

Re: Error checking .ps1 to check certificate expiration date

Post by tomitomi »

Nobody ?
kg2857
Posts: 233
Joined: Wed Apr 12, 2023 5:48 pm

Re: Error checking .ps1 to check certificate expiration date

Post 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.
tomitomi
Posts: 4
Joined: Fri Jun 16, 2023 3:09 am

Re: Error checking .ps1 to check certificate expiration date

Post 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.
Marilian
Posts: 5
Joined: Sun Jun 25, 2023 11:31 pm

Re: Error checking .ps1 to check certificate expiration date

Post by Marilian »

The arguments were probably wrong, but as it's a script, you can always make it print more information.
run 3
tomitomi
Posts: 4
Joined: Fri Jun 16, 2023 3:09 am

Re: Error checking .ps1 to check certificate expiration date

Post 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
}
nehakakar
Posts: 9
Joined: Tue Jun 20, 2023 2:10 am

Re: Error checking .ps1 to check certificate expiration date

Post 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.
kg2857
Posts: 233
Joined: Wed Apr 12, 2023 5:48 pm

Re: Error checking .ps1 to check certificate expiration date

Post 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.
Post Reply