Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add check_curl to ITL #9205

Merged
merged 29 commits into from
Aug 30, 2024
Merged

Add check_curl to ITL #9205

merged 29 commits into from
Aug 30, 2024

Conversation

RincewindsHat
Copy link
Member

Adding check_curl from Monitoring Plugins to the ITL

@cla-bot cla-bot bot added the cla/signed label Feb 3, 2022
@Al2Klimov Al2Klimov added this to the 2.14.0 milestone Feb 7, 2022
Copy link
Member

@Al2Klimov Al2Klimov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And the documentation?

@RincewindsHat
Copy link
Member Author

Added some documentation

Copy link
Member

@Al2Klimov Al2Klimov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have a look at the failed checks.

@cla-bot
Copy link

cla-bot bot commented Feb 14, 2022

Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: Lorenz Kästle.
This is most likely caused by a git client misconfiguration; please make sure to:

  1. check if your git client is configured with an email to sign commits git config --list | grep email
  2. If not, set it up using git config --global user.email [email protected]
  3. Make sure that the git commit email is configured in your GitHub account settings, see https://github.com/settings/emails

@cla-bot
Copy link

cla-bot bot commented Feb 14, 2022

Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: Lorenz Kästle.
This is most likely caused by a git client misconfiguration; please make sure to:

  1. check if your git client is configured with an email to sign commits git config --list | grep email
  2. If not, set it up using git config --global user.email [email protected]
  3. Make sure that the git commit email is configured in your GitHub account settings, see https://github.com/settings/emails

doc/10-icinga-template-library.md Outdated Show resolved Hide resolved
itl/command-plugins.conf Outdated Show resolved Hide resolved
itl/command-plugins.conf Outdated Show resolved Hide resolved
itl/command-plugins.conf Outdated Show resolved Hide resolved
@julianbrost julianbrost removed this from the 2.14.0 milestone Jan 12, 2023
@hydrapolic
Copy link

This would be nice as check_http is going to be removed monitoring-plugins/monitoring-plugins#1806

@Al2Klimov Al2Klimov added the area/itl Template Library CheckCommands label May 27, 2024
Copy link
Member

@oxzi oxzi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The following options from the man page are missing in the CheckCommand:

  • --continue-after-certificate
  • -4 and -6
  • --haproxy-protocol
  • ---cookie-jar=FILE

Furthermore, as already mentioned by @hydrapolic, if the monitoring-plugins project (or you in specific) aims to obsolete the good old check_http plugin, please add a comment to the ITL documentation of check_http, stating that this plugin will be deprecated and check_curl should be used instead.

itl/command-plugins.conf Outdated Show resolved Hide resolved
itl/command-plugins.conf Show resolved Hide resolved
itl/command-plugins.conf Outdated Show resolved Hide resolved
@RincewindsHat
Copy link
Member Author

RincewindsHat commented Aug 15, 2024

The following options from the man page are missing in the CheckCommand:

* `--continue-after-certificate`

* `-4` and `-6`

* `--haproxy-protocol`

* `---cookie-jar=FILE`

I did add those options (they were added after I opened this PR...., except for -4 and -6 which I somehow forgot halfway)

Furthermore, as already mentioned by @hydrapolic, if the monitoring-plugins project (or you in specific) aims to obsolete the good old check_http plugin, please add a comment to the ITL documentation of check_http, stating that this plugin will be deprecated and check_curl should be used instead.

This is slightly tricky, check_http is going to be deprecated in the monitoring-plugins which is the one you get on debianish and suseish systems (and others).
This is probably not true for the check_http from the nagios-plugins.

Copy link
Member

@oxzi oxzi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The following options from the man page are missing in the CheckCommand:

* `--continue-after-certificate`

* `-4` and `-6`

* `--haproxy-protocol`

* `---cookie-jar=FILE`

I did add those options (they were added after I opened this PR...., except for -4 and -6 which I somehow forgot halfway)

Thanks for keeping it up to date. I know, long lived (or long ignored) PRs are keeping one's patience to the test.

Furthermore, as already mentioned by @hydrapolic, if the monitoring-plugins project (or you in specific) aims to obsolete the good old check_http plugin, please add a comment to the ITL documentation of check_http, stating that this plugin will be deprecated and check_curl should be used instead.

This is slightly tricky, check_http is going to be deprecated in the monitoring-plugins which is the one you get on debianish and suseish systems (and others). This is probably not true for the check_http from the nagios-plugins.

Valid point. I tend to forget the multiple implementations. Maybe add a short note stating that users of the monitoring-plugins should take a look at check_curl. My train of thought was that doing so might ease the deprecation process for you.

itl/command-plugins.conf Outdated Show resolved Hide resolved
itl/command-plugins.conf Outdated Show resolved Hide resolved
itl/command-plugins.conf Outdated Show resolved Hide resolved
itl/command-plugins.conf Outdated Show resolved Hide resolved
itl/command-plugins.conf Outdated Show resolved Hide resolved
itl/command-plugins.conf Outdated Show resolved Hide resolved
itl/command-plugins.conf Outdated Show resolved Hide resolved
doc/10-icinga-template-library.md Show resolved Hide resolved
Copy link
Member

@oxzi oxzi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just imported the CheckCommand into a playground setup to replace the "http" CheckCommand. Thereby I experienced some issues, as commented inline. However, with the named workarounds or posted patches, it worked for me :)

doc/10-icinga-template-library.md Outdated Show resolved Hide resolved
itl/command-plugins.conf Show resolved Hide resolved
itl/command-plugins.conf Outdated Show resolved Hide resolved
itl/command-plugins.conf Outdated Show resolved Hide resolved
itl/command-plugins.conf Outdated Show resolved Hide resolved
itl/command-plugins.conf Show resolved Hide resolved
@oxzi
Copy link
Member

oxzi commented Aug 26, 2024

Could you please rebase this PR branch against the current master. Doing so should please the CI.

@cla-bot cla-bot bot added the cla/signed label Aug 26, 2024
Copy link
Member

@oxzi oxzi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope this was my last round of comments and we can finish this long march.

Regardless of my nagging, I want to say thanks again and have even replaced the check_http with your check_curl for my private monitoring.

itl/command-plugins.conf Outdated Show resolved Hide resolved
itl/command-plugins.conf Show resolved Hide resolved
doc/10-icinga-template-library.md Outdated Show resolved Hide resolved
doc/10-icinga-template-library.md Outdated Show resolved Hide resolved
itl/command-plugins.conf Outdated Show resolved Hide resolved
oxzi
oxzi previously approved these changes Aug 29, 2024
Copy link
Member

@oxzi oxzi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again for all your work. For me, this looks good now.

@yhabteab and @Al2Klimov, you have also taken a look in the past. Thus, would at least one of you take another look?

Btw, I would suggest to "squash-and-merge" this PR, as, at least imho, not all commits are needed in the master branch.

@oxzi oxzi requested review from yhabteab and Al2Klimov August 29, 2024 12:53
Copy link
Member

@yhabteab yhabteab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The --extra-opts option is still missing!

Edit: Apart from that why do I get this warning on Debian? WARNING: check_curl is experimental. Please use check_http if you need a stable version.

@oxzi
Copy link
Member

oxzi commented Aug 29, 2024

The --extra-opts option is still missing!

I am not quite sure how useful the monitoring plugins extra-opts are for an Icinga 2 CheckCommand, but it seems like (some) other CheckCommands are implementing those as well.

"--extra-opts" = {
value = "$apt_extra_opts$"
description = "Read options from an ini file."

Edit: Apart from that why do I get this warning on Debian? WARNING: check_curl is experimental. Please use check_http if you need a stable version.

Depends on your Debian package version, I guess. Unlike in sid, the monitoring-plugin package versions are quite old.

https://packages.debian.org/search?keywords=monitoring-plugins

I tested it with the latest monitoring-plugins version, which works fine.

@RincewindsHat
Copy link
Member Author

The --extra-opts option is still missing!

I guess I forgot about it, since I haven't ever seen anyone use it (in any of the MP plugins).
Added it now.

@oxzi
Copy link
Member

oxzi commented Aug 30, 2024

Edit: Apart from that why do I get this warning on Debian? WARNING: check_curl is experimental. Please use check_http if you need a stable version.

Depends on your Debian package version, I guess. Unlike in sid, the monitoring-plugin package versions are quite old.

https://packages.debian.org/search?keywords=monitoring-plugins

I tested it with the latest monitoring-plugins version, which works fine.

I thought that the check plugin returned a WARNING, but I missed the part in the --help output, which seems to be a forgotten relict. As I just wanted to create an upstream issue about it, I found out that @RincewindsHat just resolved it: monitoring-plugins/monitoring-plugins#2017

@oxzi oxzi requested a review from yhabteab August 30, 2024 08:03
Copy link
Member

@yhabteab yhabteab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be fine, I guess!

http:

WARNING - Certificate 'Yonas Icinga' expires in 189 day(s) (Fri Mar  7 14:31:58 2025 +0000).
HTTP WARNING: HTTP/1.1 200 OK - 11031 bytes in 0.007 second response time |time=0.006887s;;;0.000000;10.000000 size=11031B;;;0;

curl:

WARNING - Certificate 'Yonas Icinga' expires in 189 day(s) (Fri Mar  7 14:31:58 2025 +0000).
HTTP OK: HTTP/1.1 200 OK - 11031 bytes in 0.008 second response time |time=0.007655s;;;0.000000;10.000000 size=11031B;;;0;

@yhabteab yhabteab added this to the 2.15.0 milestone Aug 30, 2024
@oxzi oxzi enabled auto-merge (squash) August 30, 2024 10:23
@oxzi oxzi removed the request for review from Al2Klimov August 30, 2024 10:24
@oxzi oxzi dismissed Al2Klimov’s stale review August 30, 2024 10:25

almost two years old

@oxzi oxzi merged commit ba200f7 into Icinga:master Aug 30, 2024
26 checks passed
@RincewindsHat RincewindsHat deleted the ITL_add_check_curl branch August 30, 2024 11:56
Al2Klimov pushed a commit that referenced this pull request Jan 21, 2025
* Add check_curl to ITL

* small fixes and boolean defaults

* Add documentation for check_curl

* Replace dash with underscore in variables

* Add link to documentation

* Change order of argument attributes to adhere to style guide

* Shorten description of  tls option in itl

* Just remove information for check_curl options

* itl - check_curl: document -4 and -6

* itl - check_curl: Add haproxy option for check_curl

* itl - check_curl: add cookie-jar option

* itl - check_curl: add continue_after_certificate option

* itl - check_curl: replace dashes with underscores in macros

* Update itl/command-plugins.conf

Co-authored-by: alvar <[email protected]>

* Update itl/command-plugins.conf

Co-authored-by: alvar <[email protected]>

* itl - check_curl: add missing option documentation and reorder options

* itl - check_curl: Split certificate lifetime in two parameters

* itl - check_curl: replace remaining instances of single parameter for remaining valid time

* check_curl: allow assignements for host without address set

* check_curl: fix typo expext -> expect

* itl - check_curl: add state-regex option and documentation

* Add Tls options with version and without

* itl - check_curl: fix indentation

* itl - check_curl: Set v4/v6 variables

* itl - check_curl: Edit description for --sni

* doc - check_curl: fix singular-plural typo for curl_max_redir(s)

* doc/check_curl: sni description

* itl - check_curl: remove superfluous brace

* itl - check_curl: add extra-opts parameter

---------

Co-authored-by: alvar <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/itl Template Library CheckCommands cla/signed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants