Merge ~afreiberger/charm-nagios:check_timeout into ~nagios-charmers/charm-nagios:master

Proposed by Drew Freiberger
Status: Merged
Approved by: Jay Kuri
Approved revision: 0f2fe8ad515bd190c81a108b25da69f752243357
Merged at revision: 668d0e49bcac93d79188a4580372ce2c40a1054e
Proposed branch: ~afreiberger/charm-nagios:check_timeout
Merge into: ~nagios-charmers/charm-nagios:master
Diff against target: 77 lines (+23/-0)
2 files modified
config.yaml (+7/-0)
hooks/common.py (+16/-0)
Reviewer Review Type Date Requested Status
Nagios Charm developers Pending
Review via email: mp+353461@code.launchpad.net

Commit message

Added check_timeout to configure external monitor socket timeouts

To post a comment you must log in.
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change successfully merged at revision 668d0e49bcac93d79188a4580372ce2c40a1054e

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/config.yaml b/config.yaml
index eca8add..5aff8c9 100644
--- a/config.yaml
+++ b/config.yaml
@@ -177,3 +177,10 @@ options:
177 A string to use for the service_notification_options in the177 A string to use for the service_notification_options in the
178 pagerduty contact configuration. Remove w to avoid paging for178 pagerduty contact configuration. Remove w to avoid paging for
179 warning events.179 warning events.
180 check_timeout:
181 default: 10
182 type: int
183 description: |
184 A number of seconds before nrpe checks timeout from not being able
185 to connect to the client or finish execution of the command.
186 Raise this value to combat 'CHECK_NRPE Socket timeout alerts'
diff --git a/hooks/common.py b/hooks/common.py
index 620c22e..65718f4 100644
--- a/hooks/common.py
+++ b/hooks/common.py
@@ -12,6 +12,7 @@ from charmhelpers.core.hookenv import (
12 network_get,12 network_get,
13 network_get_primary_address,13 network_get_primary_address,
14 unit_get,14 unit_get,
15 config,
15)16)
1617
17from pynag import Model18from pynag import Model
@@ -176,6 +177,9 @@ def customize_http(service, name, extra):
176 cmd_args.extend(('-I', '$HOSTADDRESS$'))177 cmd_args.extend(('-I', '$HOSTADDRESS$'))
177 else:178 else:
178 cmd_args.extend(('-H', '$HOSTADDRESS$'))179 cmd_args.extend(('-H', '$HOSTADDRESS$'))
180 check_timeout = config('check_timeout')
181 if check_timeout is not None:
182 cmd_args.extend(('-t', check_timeout))
179 check_command = _make_check_command(cmd_args)183 check_command = _make_check_command(cmd_args)
180 cmd = '%s!%s' % (check_command, '!'.join([str(x) for x in args]))184 cmd = '%s!%s' % (check_command, '!'.join([str(x) for x in args]))
181 service.set_attribute('check_command', cmd)185 service.set_attribute('check_command', cmd)
@@ -190,6 +194,9 @@ def customize_mysql(service, name, extra):
190 _extend_args(args, cmd_args, '-u', extra['user'])194 _extend_args(args, cmd_args, '-u', extra['user'])
191 if 'password' in extra:195 if 'password' in extra:
192 _extend_args(args, cmd_args, '-p', extra['password'])196 _extend_args(args, cmd_args, '-p', extra['password'])
197 check_timeout = config('check_timeout')
198 if check_timeout is not None:
199 cmd_args.extend(('-t', check_timeout))
193 check_command = _make_check_command(cmd_args)200 check_command = _make_check_command(cmd_args)
194 cmd = '%s!%s' % (check_command, '!'.join([str(x) for x in args]))201 cmd = '%s!%s' % (check_command, '!'.join([str(x) for x in args]))
195 service.set_attribute('check_command', cmd)202 service.set_attribute('check_command', cmd)
@@ -200,6 +207,9 @@ def customize_pgsql(service, name, extra):
200 plugin = os.path.join(PLUGIN_PATH, 'check_pgsql')207 plugin = os.path.join(PLUGIN_PATH, 'check_pgsql')
201 args = []208 args = []
202 cmd_args = [plugin, '-H', '$HOSTADDRESS$']209 cmd_args = [plugin, '-H', '$HOSTADDRESS$']
210 check_timeout = config('check_timeout')
211 if check_timeout is not None:
212 cmd_args.extend(('-t', check_timeout))
203 check_command = _make_check_command(cmd_args)213 check_command = _make_check_command(cmd_args)
204 cmd = '%s!%s' % (check_command, '!'.join([str(x) for x in args]))214 cmd = '%s!%s' % (check_command, '!'.join([str(x) for x in args]))
205 service.set_attribute('check_command', cmd)215 service.set_attribute('check_command', cmd)
@@ -216,6 +226,9 @@ def customize_nrpe(service, name, extra):
216 cmd_args.extend(('-c', extra['command']))226 cmd_args.extend(('-c', extra['command']))
217 else:227 else:
218 cmd_args.extend(('-c', extra))228 cmd_args.extend(('-c', extra))
229 check_timeout = config('check_timeout')
230 if check_timeout is not None:
231 cmd_args.extend(('-t', check_timeout))
219 check_command = _make_check_command(cmd_args)232 check_command = _make_check_command(cmd_args)
220 cmd = '%s!%s' % (check_command, '!'.join([str(x) for x in args]))233 cmd = '%s!%s' % (check_command, '!'.join([str(x) for x in args]))
221 service.set_attribute('check_command', cmd)234 service.set_attribute('check_command', cmd)
@@ -256,6 +269,9 @@ def customize_tcp(service, name, extra):
256 cmd_args.extend(('-c', extra['critical']))269 cmd_args.extend(('-c', extra['critical']))
257 if 'timeout' in extra:270 if 'timeout' in extra:
258 cmd_args.extend(('-t', extra['timeout']))271 cmd_args.extend(('-t', extra['timeout']))
272 check_timeout = config('check_timeout')
273 if check_timeout is not None:
274 cmd_args.extend(('-t', check_timeout))
259275
260 check_command = _make_check_command(cmd_args)276 check_command = _make_check_command(cmd_args)
261 cmd = '%s!%s' % (check_command, '!'.join([str(x) for x in args]))277 cmd = '%s!%s' % (check_command, '!'.join([str(x) for x in args]))

Subscribers

People subscribed via source and target branches