matteocorti / check_ssl_cert

A shell script (that can be used as a Nagios/Icinga plugin) to check an SSL/TLS connection.
GNU General Public License v3.0
360 stars 132 forks source link

Output format on failure? #463

Open mmdevl opened 1 year ago

mmdevl commented 1 year ago

It's possible to set an output format on success:

check_ssl_cert --help | grep FORMAT
      --format FORMAT              Format output template on success, for

What about setting also an output format on failure?

matteocorti commented 1 year ago

Not really a bug but a missing feature. On failure, not all the data is available, and the formatting could be complicated. I'll have a look.

mmdevl commented 1 year ago

You're right (missing feature). You could add these 2 new options:

      --default-failure-format [*]
      --format-failure FORMAT

[*] you already have a kind of default

matteocorti commented 1 year ago

I would rather try to keep one option and just display what is available.

matteocorti commented 1 year ago

I'm still struggling with the failure format, as the content could be very different depending on the error. From one single sentence as for a wrong command line option, to the full output in case of an expired certificate.

I did some refactoring, putting the parsing in a separate function, but I'll leave it here for the moment as I don't really have a bright idea on how to implement it.

The separate command line option would bear the same problems.

ArminRadmueller commented 8 months ago

Hi Matteo, is there a solution/fix for this issue?

matteocorti commented 7 months ago

Not yet, if I find the time I'll try to implement a solution