Hey Samuele, I get your point about multiple host checks becoming unwieldy in 1 string, but I'm still off-put by having 2 config opts for this. How do you feel about testing nagios_check_http_params for "yamlness", and looping over the yaml if true, or treating it as a string if false? Something like:
Hey Samuele, I get your point about multiple host checks becoming unwieldy in 1 string, but I'm still off-put by having 2 config opts for this. How do you feel about testing nagios_ check_http_ params for "yamlness", and looping over the yaml if true, or treating it as a string if false? Something like:
--- hooks/hooks.py 2015-04-15 20:23:01 +0000 http_params = conf.get( 'nagios_ check_http_ params' ) add_check( 'check_ http %s' % check_http_params load(check_ http_params) : add_check( check_http. get('descriptio n', name), 'check_ http %s' % check_http[ 'params' ] add_check( 'check_ http %s' % check_http_params compat. write()
+++ hooks/hooks.py 2015-10-29 18:27:20 +0000
@@ -432,11 +432,21 @@
conf = nrpe_compat.config
check_
if check_http_params:
- nrpe_compat.
- shortname='vhost',
- description='Check Virtual Host',
- check_cmd=
- )
+ for check_http in yaml.safe_
+ try:
+ name = check_http['name']
+ nrpe_compat.
+ shortname=name,
+ description=
+ check_cmd=
+ )
+ except TypeError:
+ nrpe_compat.
+ shortname='vhost',
+ description='Check Virtual Host',
+ check_cmd=
+ )
+ break
nrpe_