-
Notifications
You must be signed in to change notification settings - Fork 72
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
How do I pass arguments to check_nginx? #96
Comments
Hi, I came to the same problem when trying to pass arguments to check_http ("-u /something" in my case) and the only way I found to do that was to patch the nagios::check::httpd define call in defaultchecks.pp (so the data binding takes places when calling the define and not later). diff --git a/modules/nagios/manifests/defaultchecks.pp b/modules/nagios/manifests/defaultchecks.pp
index 8b6e7e1..6cc3cd4 100644
--- a/modules/nagios/manifests/defaultchecks.pp
+++ b/modules/nagios/manifests/defaultchecks.pp
@@ -15,7 +15,9 @@ class nagios::defaultchecks {
# Conditional checks, enabled based on custom facts
if $::nagios_check_httpd_disable != 'true' and
$::nagios_httpd {
- nagios::check::httpd { $nagios::client::host_name: }
+ nagios::check::httpd { $nagios::client::host_name:
+ args => hiera('nagios_check_httpd_args',''),
+ }
} else {
nagios::check::httpd { $nagios::client::host_name: ensure => absent }
} So I guess you should do the same for the nginx check (with some extra modification in the check::nginx define itself: diff --git a/modules/nagios/manifests/defaultchecks.pp b/modules/nagios/manifests/defaultchecks.pp
index 6cc3cd4..1c012f7 100644
--- a/modules/nagios/manifests/defaultchecks.pp
+++ b/modules/nagios/manifests/defaultchecks.pp
@@ -35,7 +35,9 @@ class nagios::defaultchecks {
}
if $::nagios_check_nginx_disable != 'true' and
$::nagios_httpd_nginx {
- nagios::check::nginx { $nagios::client::host_name: }
+ nagios::check::nginx { $nagios::client::host_name:
+ args => hiera('nagios_check_nginx_args',''),
+ }
} else {
nagios::check::nginx { $nagios::client::host_name: ensure => absent }
} then change the nginx check define to: define nagios::check::nginx (
$ensure = undef,
$args = $::nagios_check_nginx_args,
) { and set nagios_check_nginx_args in your hiera file: nagios_check_nginx_args: '-u /s' HTH |
Nice, thanks a lot for this, will you make a PR? |
I don't know... |
Well, you could fork or branch it, and we can use that in the mean time until it maybe gets merged since we are using r10k. |
I've not tested the nginx part so I cannot ensure that it will work. Also, I'm running and old version of the module (1.0.7), so I don't think it's a good idea to create a PR. |
Using v1.0.10
How do I add arguments to check_nginx?
I've tried in yaml: nagios::check::nginx::args: 'argument'
and: nagios_check_nginx_args: 'argument'
If I add a block of nagios::check::nginx and using args parameter, it works, though the "default (which contains no arguments)" check is still there.
The text was updated successfully, but these errors were encountered: