Merge lp:~deej/charms/xenial/errors/nrpe-relation-data into lp:~daisy-pluckers/charms/xenial/errors/trunk

Proposed by David Lawson
Status: Merged
Merged at revision: 111
Proposed branch: lp:~deej/charms/xenial/errors/nrpe-relation-data
Merge into: lp:~daisy-pluckers/charms/xenial/errors/trunk
Diff against target: 23 lines (+9/-2)
1 file modified
hooks/nrpe-external-master-relation-changed (+9/-2)
To merge this branch: bzr merge lp:~deej/charms/xenial/errors/nrpe-relation-data
Reviewer Review Type Date Requested Status
Brian Murray Approve
Review via email: mp+354285@code.launchpad.net

Commit message

[deej] Use nrpe relation data to set hostname and default service group

Description of the change

[deej] Use nrpe relation data to set hostname and default service group

To post a comment you must log in.
Revision history for this message
Brian Murray (brian-murray) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/nrpe-external-master-relation-changed'
2--- hooks/nrpe-external-master-relation-changed 2015-01-20 18:14:09 +0000
3+++ hooks/nrpe-external-master-relation-changed 2018-09-05 03:07:27 +0000
4@@ -1,10 +1,17 @@
5 #!/bin/bash
6 set -eux
7 . hooks/common
8-export NAGIOS_HOSTNAME="ue-${REGION}-et-${JUJU_UNIT_NAME//\//-}"
9+relation_id=$(relation-ids nrpe-external-master)
10+if [ -z "$relation_id" ]; then
11+ echo "No nrpe-external-master relation yet. Skipping nrpe setup"
12+ return 0
13+fi
14+relation_unit=$(relation-list -r $relation_id)
15+nagios_host_context=$(relation-get -r $relation_id nagios_host_context $relation_unit)
16+export NAGIOS_HOSTNAME=$(relation-get -r $relation_id nagios_hostname $relation_unit)
17
18 export INSTANCE_TYPE
19-export NAGIOS_SERVICEGROUP="ue-${REGION}-et"
20+export NAGIOS_SERVICEGROUP=$nagios_host_context
21 export PROJECT="UE"
22
23 export SERVICE_DESCRIPTION="Error tracker app server"

Subscribers

People subscribed via source and target branches

to all changes: