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
1diff --git a/config.yaml b/config.yaml
2index eca8add..5aff8c9 100644
3--- a/config.yaml
4+++ b/config.yaml
5@@ -177,3 +177,10 @@ options:
6 A string to use for the service_notification_options in the
7 pagerduty contact configuration. Remove w to avoid paging for
8 warning events.
9+ check_timeout:
10+ default: 10
11+ type: int
12+ description: |
13+ A number of seconds before nrpe checks timeout from not being able
14+ to connect to the client or finish execution of the command.
15+ Raise this value to combat 'CHECK_NRPE Socket timeout alerts'
16diff --git a/hooks/common.py b/hooks/common.py
17index 620c22e..65718f4 100644
18--- a/hooks/common.py
19+++ b/hooks/common.py
20@@ -12,6 +12,7 @@ from charmhelpers.core.hookenv import (
21 network_get,
22 network_get_primary_address,
23 unit_get,
24+ config,
25 )
26
27 from pynag import Model
28@@ -176,6 +177,9 @@ def customize_http(service, name, extra):
29 cmd_args.extend(('-I', '$HOSTADDRESS$'))
30 else:
31 cmd_args.extend(('-H', '$HOSTADDRESS$'))
32+ check_timeout = config('check_timeout')
33+ if check_timeout is not None:
34+ cmd_args.extend(('-t', check_timeout))
35 check_command = _make_check_command(cmd_args)
36 cmd = '%s!%s' % (check_command, '!'.join([str(x) for x in args]))
37 service.set_attribute('check_command', cmd)
38@@ -190,6 +194,9 @@ def customize_mysql(service, name, extra):
39 _extend_args(args, cmd_args, '-u', extra['user'])
40 if 'password' in extra:
41 _extend_args(args, cmd_args, '-p', extra['password'])
42+ check_timeout = config('check_timeout')
43+ if check_timeout is not None:
44+ cmd_args.extend(('-t', check_timeout))
45 check_command = _make_check_command(cmd_args)
46 cmd = '%s!%s' % (check_command, '!'.join([str(x) for x in args]))
47 service.set_attribute('check_command', cmd)
48@@ -200,6 +207,9 @@ def customize_pgsql(service, name, extra):
49 plugin = os.path.join(PLUGIN_PATH, 'check_pgsql')
50 args = []
51 cmd_args = [plugin, '-H', '$HOSTADDRESS$']
52+ check_timeout = config('check_timeout')
53+ if check_timeout is not None:
54+ cmd_args.extend(('-t', check_timeout))
55 check_command = _make_check_command(cmd_args)
56 cmd = '%s!%s' % (check_command, '!'.join([str(x) for x in args]))
57 service.set_attribute('check_command', cmd)
58@@ -216,6 +226,9 @@ def customize_nrpe(service, name, extra):
59 cmd_args.extend(('-c', extra['command']))
60 else:
61 cmd_args.extend(('-c', extra))
62+ check_timeout = config('check_timeout')
63+ if check_timeout is not None:
64+ cmd_args.extend(('-t', check_timeout))
65 check_command = _make_check_command(cmd_args)
66 cmd = '%s!%s' % (check_command, '!'.join([str(x) for x in args]))
67 service.set_attribute('check_command', cmd)
68@@ -256,6 +269,9 @@ def customize_tcp(service, name, extra):
69 cmd_args.extend(('-c', extra['critical']))
70 if 'timeout' in extra:
71 cmd_args.extend(('-t', extra['timeout']))
72+ check_timeout = config('check_timeout')
73+ if check_timeout is not None:
74+ cmd_args.extend(('-t', check_timeout))
75
76 check_command = _make_check_command(cmd_args)
77 cmd = '%s!%s' % (check_command, '!'.join([str(x) for x in args]))

Subscribers

People subscribed via source and target branches