Merge ~paulgear/charm-nrpe/+git/nrpe-charm:master into ~nrpe-charmers/charm-nrpe:master

Proposed by Paul Gear
Status: Merged
Approved by: Haw Loeung
Approved revision: 1e902f9d1c9a25f4b8f4956189569c61aa0a8e7e
Merged at revision: 59d13d70d78ce2e9b2392ad51929de0f91811781
Proposed branch: ~paulgear/charm-nrpe/+git/nrpe-charm:master
Merge into: ~nrpe-charmers/charm-nrpe:master
Diff against target: 52 lines (+16/-6)
2 files modified
files/plugins/check_conntrack.sh (+10/-2)
hooks/nrpe_helpers.py (+6/-4)
Reviewer Review Type Date Requested Status
Haw Loeung Approve
Review via email: mp+322170@code.launchpad.net

Description of the change

To post a comment you must log in.
Revision history for this message
Haw Loeung (hloeung) wrote :

LGTM, +1

review: Approve
Revision history for this message
Haw Loeung (hloeung) wrote :

LGTM, +1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/files/plugins/check_conntrack.sh b/files/plugins/check_conntrack.sh
2index 0cfaf28..1f08075 100755
3--- a/files/plugins/check_conntrack.sh
4+++ b/files/plugins/check_conntrack.sh
5@@ -20,8 +20,16 @@ if ! lsmod | grep -q conntrack; then
6 exit $STATE_OK
7 fi
8
9-max=$(sysctl net.netfilter.nf_conntrack_max | awk '{ print $3 }')
10-current=$(sysctl net.netfilter.nf_conntrack_count | awk '{ print $3 }')
11+max=$(sysctl net.netfilter.nf_conntrack_max 2>/dev/null | awk '{ print $3 }')
12+if [ -z "$max" ]; then
13+ echo "UNKNOWN: unable to retrieve value of net.netfilter.nf_conntrack_max"
14+ exit $STATE_UNKNOWN
15+fi
16+current=$(sysctl net.netfilter.nf_conntrack_count 2>/dev/null | awk '{ print $3 }')
17+if [ -z "$current" ]; then
18+ echo "UNKNOWN: unable to retrieve value of net.netfilter.nf_conntrack_count"
19+ exit $STATE_UNKNOWN
20+fi
21
22 # default thresholds
23 crit=90
24diff --git a/hooks/nrpe_helpers.py b/hooks/nrpe_helpers.py
25index 90a6f8e..d96b0a8 100644
26--- a/hooks/nrpe_helpers.py
27+++ b/hooks/nrpe_helpers.py
28@@ -250,11 +250,11 @@ class SubordinateCheckDefinitions(dict):
29
30 if hookenv.config('load') == 'auto':
31 # Give 1min load alerts higher thresholds than 15 min load alerts
32- warn_multipliers = (4,2,1)
33- crit_multipliers = (8,4,2)
34+ warn_multipliers = (4, 2, 1)
35+ crit_multipliers = (8, 4, 2)
36 load_thresholds = ('-w %s -c %s') \
37- % (','.join([str(m*procs) for m in warn_multipliers]),
38- ','.join([str(m*procs) for m in crit_multipliers]))
39+ % (','.join([str(m * procs) for m in warn_multipliers]),
40+ ','.join([str(m * procs) for m in crit_multipliers]))
41 else:
42 load_thresholds = hookenv.config('load')
43
44@@ -313,6 +313,8 @@ class SubordinateCheckDefinitions(dict):
45 self['checks'] = []
46 sub_postfix = str(hookenv.config("sub_postfix"))
47 for check in checks:
48+ if check['cmd_params'] == "":
49+ continue
50 check['description'] += " (sub)"
51 check['cmd_name'] += sub_postfix
52 self['checks'].append(check)

Subscribers

People subscribed via source and target branches