Merge lp:~verterok/charms/trusty/conn-check/fix-nrpe-check-hostname into lp:~ubuntuone-hackers/charms/trusty/conn-check/trunk

Proposed by Guillermo Gonzalez
Status: Merged
Approved by: Guillermo Gonzalez
Approved revision: 49
Merged at revision: 47
Proposed branch: lp:~verterok/charms/trusty/conn-check/fix-nrpe-check-hostname
Merge into: lp:~ubuntuone-hackers/charms/trusty/conn-check/trunk
Diff against target: 25 lines (+3/-1)
2 files modified
playbook.yaml (+1/-1)
roles/nrpe-external-master/library/nrpe (+2/-0)
To merge this branch: bzr merge lp:~verterok/charms/trusty/conn-check/fix-nrpe-check-hostname
Reviewer Review Type Date Requested Status
Wes Mason (community) Approve
Review via email: mp+272523@code.launchpad.net

Commit message

Use nagios_hostname value from the relation when configuring nrpe checks.

Description of the change

Use nagios_hostname value from the relation when configuring nrpe checks.

Also had to fix the nrpe library in the nrpe-external-master role to only concatenate the context when is not already in the hostname (in our case the context is already in the hostname).

Wasn't sure about that change, but check the roles git branch and the nrpe role there is quite different from the one using in conn-check

To post a comment you must log in.
Revision history for this message
Guillermo Gonzalez (verterok) wrote :
Revision history for this message
Guillermo Gonzalez (verterok) wrote :

sorry, wrong MP :p

Revision history for this message
Wes Mason (wesmason) wrote :

lgtm

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'playbook.yaml'
2--- playbook.yaml 2015-08-11 14:57:30 +0000
3+++ playbook.yaml 2015-09-26 21:58:25 +0000
4@@ -16,7 +16,7 @@
5
6 roles:
7 - role: nrpe-external-master
8- nagios_hostname: "{{ relations['conn-check'][0]['__unit__']|replace('/', '-') }}"
9+ nagios_hostname: "{{ relations['nrpe-external-master'][0]['nagios_hostname'] }}"
10 checks:
11 - name: "{{ nagios_check_name }}"
12 command: "{{ env_dir }}/{{ revision }}/bin/conn-check --exclude-tags=no-nagios {{ args }} {{ config_path }}"
13
14=== modified file 'roles/nrpe-external-master/library/nrpe'
15--- roles/nrpe-external-master/library/nrpe 2015-07-20 16:16:54 +0000
16+++ roles/nrpe-external-master/library/nrpe 2015-09-26 21:58:25 +0000
17@@ -24,6 +24,8 @@
18 charm_config["nagios_context"] = params['nagios_context']
19 charm_config["nagios_servicegroups"] = params['nagios_servicegroups']
20 hostname = "{}-{}".format(params['nagios_context'], params['nagios_hostname'])
21+ if params['nagios_context'] in params['nagios_hostname']:
22+ hostname = params['nagios_hostname']
23
24 try:
25 nrpe_compat = NRPE(hostname)

Subscribers

People subscribed via source and target branches