Merge ~xavpaice/charm-nrpe:nrpe-address into ~nrpe-charmers/charm-nrpe:master

Proposed by Xav Paice
Status: Rejected
Rejected by: Xav Paice
Proposed branch: ~xavpaice/charm-nrpe:nrpe-address
Merge into: ~nrpe-charmers/charm-nrpe:master
Diff against target: 27 lines (+8/-0)
2 files modified
config.yaml (+6/-0)
hooks/nrpe_helpers.py (+2/-0)
Reviewer Review Type Date Requested Status
Xav Paice (community) Disapprove
Chris Sanders (community) Needs Information
Wouter van Bommel (community) Approve
Canonical IS Reviewers Pending
Review via email: mp+368744@code.launchpad.net

Commit message

This is to work around 1832671 - it's not a fix, but a handy addition for when we need it.

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
Wouter van Bommel (woutervb) wrote :

For the moment this is handy, it will allow nagios servers to monitor, even if they are not part of the juju model

review: Approve
Revision history for this message
Chris Sanders (chris.sanders) wrote :

> For the moment this is handy, it will allow nagios servers to monitor, even if
> they are not part of the juju model

For a temporary fork this seems ok, but I tend to think this isn't the correct fix for the upstream charm. Wouldn't the correct fix here to be implement support for spaces so that relations work as expected rather than add a configuration to work without relations?

Is the root cause something that can't be fixed due to some limitation?

review: Needs Information
Revision history for this message
Xav Paice (xavpaice) wrote :

the limitation is that an openstack instance doesn't have any idea at all of it's floating IP address - only the cloud provider can tell Juju that - but the instance is what provides the list of addresses for the relation to Nagios. In this case, what's happening is that somehow the floating IP address of the Nagios unit is getting pumped into the relation data across the cross model relation, but not the floating IP of the nrpe unit - and that means the wrong address is added to nrpe.cfg. It should be fixable, I just am at a bit of a loss as to how right now.

Meantime, this change would allow us to have a non-related Nagios allowed for checks in addition to any related units - that might be handy for the future.

I've not checked if the change of nagios_address_type from private to public needs the relation removing and re-adding to trigger any change. Also, we might be able to use nagios_master rather than add a new config option.

There's a fork for this at cs:~xavpaice/nrpe at this point in time, to allow the site affected to be monitored.

Revision history for this message
Stuart Bishop (stub) wrote :

charmhelpers.core.hookenv.ingress_address(relid, charmhelpers.core.hookenv.local_unit()) provides the IP address that remote units in that particular relation should connect to the local unit. Juju maintains this, and should always be correct per the spaces, public ip addresses etc. chosen at deploy time.

Revision history for this message
Xav Paice (xavpaice) wrote :

great, thanks for that! I'll dig that a bit further wrt the bug for this.

Revision history for this message
Tom Haddon (mthaddon) wrote :

I'll mark this MP as work in progress for now. Please flip back to "Needs Review" when you're ready to progress, or let us know if it can be deleted and will be progressed in a different MP.

Revision history for this message
Xav Paice (xavpaice) wrote :

I think we can abandon this change, the bug was fixed in https://bugs.launchpad.net/charm-nrpe/+bug/1827703

review: Disapprove

Unmerged commits

7a45b98... by Xav Paice

add config param for Nagios hosts we cannot specify via relation

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 44a6680..ffdc1c4 100644
3--- a/config.yaml
4+++ b/config.yaml
5@@ -179,3 +179,9 @@ options:
6 dmesg history length to check for xfs errors, in minutes
7 .
8 Defaults to disabled, set the time to enable.
9+ nagios_hosts:
10+ default: ""
11+ type: string
12+ description:
13+ Additional Nagios hosts that should be allowed to query NRPE. This
14+ is not required if the the application is related to Nagios.
15diff --git a/hooks/nrpe_helpers.py b/hooks/nrpe_helpers.py
16index c3adc6e..8a103d9 100644
17--- a/hooks/nrpe_helpers.py
18+++ b/hooks/nrpe_helpers.py
19@@ -161,6 +161,8 @@ class MonitorsRelation(helpers.RelationContext):
20 if not hookenv.relation_ids(self.name):
21 return
22 addresses = [self.ingress_address(info) for info in self['monitors']]
23+ if hookenv.config('nagios_hosts'):
24+ addresses += hookenv.config('nagios_hosts').split(",")
25 self['monitor_allowed_hosts'] = ','.join(addresses)
26
27 def provide_data(self):

Subscribers

People subscribed via source and target branches