Merge lp:~brad-marshall/charms/trusty/nrpe-external-master/add-network-ns-check into lp:charms/nrpe-external-master

Proposed by Brad Marshall
Status: Merged
Merged at revision: 38
Proposed branch: lp:~brad-marshall/charms/trusty/nrpe-external-master/add-network-ns-check
Merge into: lp:charms/nrpe-external-master
Diff against target: 55 lines (+37/-0)
2 files modified
files/check_netns.sh (+35/-0)
hooks/config-changed (+2/-0)
To merge this branch: bzr merge lp:~brad-marshall/charms/trusty/nrpe-external-master/add-network-ns-check
Reviewer Review Type Date Requested Status
Review Queue (community) automated testing Needs Fixing
Charles Butler (community) Approve
Review via email: mp+242293@code.launchpad.net

Description of the change

Add a nrpe check that tests each network namespace to ensure its responding.

To post a comment you must log in.
39. By Brad Marshall

[bradm] Removed logic to check if there are no namespaces, this is just checking if what is there is working

40. By Brad Marshall

[bradm] Add an update of the locally provided checks to config-changed hook, and a upgrade-charm hook that points to config-changed.

Revision history for this message
JuanJo Ciarlante (jjo) wrote :

Please see inline comment below, LGTM afterwards.

Revision history for this message
Review Queue (review-queue) wrote :

This items has failed automated testing! Results available here http://reports.vapour.ws/charm-tests/charm-bundle-test-10335-results

review: Needs Fixing (automated testing)
Revision history for this message
Marco Ceppi (marcoceppi) wrote :

While the tests produced "failure" they were for timeouts during deployments. This LGTM as long as jjo's comments are addressed

41. By Brad Marshall

[bradm] Tweaked logic on the error conditions a bit, and fixed the return message for the case where we have no namespaces defined.

42. By Brad Marshall

[bradm] Fixed if statement

Revision history for this message
Charles Butler (lazypower) wrote :

The tests ran fine for me, and the merge looks solid.

Thanks for the contribution brad-marshall!

review: Approve
Revision history for this message
Review Queue (review-queue) wrote :

This items has failed automated testing! Results available here http://reports.vapour.ws/charm-tests/charm-bundle-test-10703-results

review: Needs Fixing (automated testing)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'files/check_netns.sh'
2--- files/check_netns.sh 1970-01-01 00:00:00 +0000
3+++ files/check_netns.sh 2014-11-21 00:37:51 +0000
4@@ -0,0 +1,35 @@
5+#!/bin/bash
6+
7+# Copyright (c) 2014 Canonical, Ltd
8+# Author: Brad Marshall <brad.marshall@canonical.com>
9+
10+# Checks if a network namespace is responding by doing an ip a in each one.
11+
12+. /usr/lib/nagios/plugins/utils.sh
13+
14+netnsok=()
15+netnscrit=()
16+
17+for ns in $(ip netns list); do
18+ output=$(ip netns exec $ns ip a 2>/dev/null)
19+ err=$?
20+ if [ $err -eq 0 ]; then
21+ netnsok=("${netnsok[@]}" $ns)
22+ else
23+ netnscrit=("${netnscrit[@]}" $ns)
24+ fi
25+done
26+
27+if [ ${#netnscrit[@]} -eq 0 ]; then
28+ if [ ${#netnsok[@]} -eq 0 ]; then
29+ echo "OK: no namespaces defined"
30+ exit $STATE_OK
31+ else
32+ echo "OK: ${netnsok[@]} are responding"
33+ exit $STATE_OK
34+ fi
35+else
36+ echo "CRIT: ${netnscrit[@]} aren't responding"
37+ exit $STATE_CRIT
38+fi
39+
40
41=== modified file 'hooks/config-changed'
42--- hooks/config-changed 2014-11-06 07:40:09 +0000
43+++ hooks/config-changed 2014-11-21 00:37:51 +0000
44@@ -30,6 +30,8 @@
45 mkdir -p /etc/rsync-juju.d
46 cp templates/rsyncd.conf.compiled /etc/rsync-juju.d/010-nrpe-external-master.conf
47
48+cp files/check_* /usr/local/lib/nagios/plugins/
49+
50 #-----------------------------------------------------
51 # Standard Checks
52 #-----------------------------------------------------
53
54=== added symlink 'hooks/upgrade-charm'
55=== target is u'config-changed'

Subscribers

People subscribed via source and target branches

to all changes: