canonical / charm-nrpe

A subordinate charm used to configure nrpe (Nagios Remote Plugin Executor)
Apache License 2.0
1 stars 6 forks source link

NRPE relation provides public address when nagios_address_type=private #157

Open sudeephb opened 8 months ago

sudeephb commented 8 months ago

Using Juju 2.9.12, master branch of NRPE and Nagios charms as at 2021-09-10. All hosted on AWS in a default VPC.

Using a cross model relation between the controller model and the monitoring model, NRPE in the controller model and Nagios in the main model.

Out of 3 units, 2 received the public address of the controller machines, and one received the private address. I expected to see all 3 get the private address.

nagios_address_type=private

On a host with the incorrect info:

relation-get -r monitors:75 - nrpe-controller/1 egress-subnets: (public address/32) ingress-address: (public address) machine_id: "1" model_id: b0a3c2ff-739d-4c45-8032-dbb9b043a593 monitors: '{''monitors'': {''remote'': {''nrpe'': {''juju_health'': {''command'': ''check_juju_health''}, ''jujud-machine-1'': {''command'': ''check_jujud-machine-1''}, ''snap.juju-db.daemon'': {''command'': ''check_snap.juju-db.daemon''}, ''check_conntrack'': ''check_conntrack'', ''check_disk_root'': ''check_disk_root'', ''check_load'': ''check_load'', ''check_swap_activity'': ''check_swap_activity'', ''check_mem'': ''check_mem'', ''check_arp_cache'': ''check_arp_cache'', ''check_ro_filesystem'': ''check_ro_filesystem''}}}, ''version'': ''0.3''}' private-address: 18.133.193.77 target-id: juj-controller-juju-controller-1

On a host with the correct info:

relation-get -r monitors:75 - nrpe-controller/0 egress-subnets: (public address/32) ingress-address: 172.31.29.247 # (private address) machine_id: "0" model_id: b0a3c2ff-739d-4c45-8032-dbb9b043a593 monitors: '{''monitors'': {''remote'': {''nrpe'': {''juju_health'': {''command'': ''check_juju_health''}, ''jujud-machine-0'': {''command'': ''check_jujud-machine-0''}, ''snap.juju-db.daemon'': {''command'': ''check_snap.juju-db.daemon''}, ''check_conntrack'': ''check_conntrack'', ''check_disk_root'': ''check_disk_root'', ''check_load'': ''check_load'', ''check_swap_activity'': ''check_swap_activity'', ''check_mem'': ''check_mem'', ''check_arp_cache'': ''check_arp_cache'', ''check_ro_filesystem'': ''check_ro_filesystem''}}}, ''version'': ''0.3''}' private-address: 172.31.29.247 target-id: juju-controller-juju-controller-0

The only difference between the units is that the one with the correct address has a public address starting with 3.x and private starting 172.x, and the ones with incorrect address have public addresses starting 18.x

network-get output for the relation:

juju run -u nrpe/1 "network-get -r monitors:7 monitors" bind-addresses:


Imported from Launchpad using lp2gh.

sudeephb commented 8 months ago

(by xavpaice) https://bugs.launchpad.net/juju/+bug/1863916 maybe relevant for background if it's a regression of some description.

sudeephb commented 8 months ago

(by xavpaice) Also of note: The bind address in nrpe.cfg is the public address, which results in:

Sep 10 05:34:52 ip-172-31-29-247 nrpe[397095]: Starting up daemon Sep 10 05:34:52 ip-172-31-29-247 nrpe[397095]: Bind to port 5666 on (public address) failed: Cannot assign requested address. Sep 10 05:34:52 ip-172-31-29-247 nrpe[397095]: Cannot bind to any address. Sep 10 05:34:52 ip-172-31-29-247 systemd[1]: nagios-nrpe-server.service: Main process exited, code=exited, status=1/FAILURE -- Subject: Unit process exited