hello @xavpaice I tried to deploy fresh simple ubuntu, nrpe, nagios charm ( relation is ubuntu, nrpe and nrpe:monitors, nagios:monitors)
nagios has config-hooks error ERROR msg : global name 'self' is not defined which seems that caused from https://git.launchpad.net/nagios- charm/commit/?id=38f049516d4865a1e3c1fec5289f6f189fff0631 + host_context = hookenv.config('nagios_host_context') + principal_unitname = hookenv.principal_unit() + # Fallback to using "primary" if it exists. + if not principal_unitname: + for relunit in self[self.name]: + if relunit.get('primary', 'False').lower() == 'true': + principal_unitname = relunit['__unit__'] + break no error in your test env? -- You received this bug notification because you are a member of Nagios Charm developers, which is subscribed to Nagios Charm. https://bugs.launchpad.net/bugs/1712977 Title: config-changed hook fails: nrpe_helpers.py:nagios_hostname in _metadata_unit with FileNotFoundError error for metadata.yaml of related unit on another host Status in Charm Helpers: Fix Released Status in Nagios Charm: Fix Released Status in NRPE Charm: Fix Released Bug description: Due to recent changes, nrpe_helpers.py:nagios_hostname calls charmhelpers.core.hookenv.principal_unit to get the parent unit's hostname. On Juju 2.1 or earlier, it does this by walking all relations of the unit and inspecting it's metadata file using _metadata_unit. This fails because it attempts to inspect units on another host, i.e. the parent nagios unit and _metadata_unit fires a FileNotFoundError exception for the file that doesn't exist. You can simulate this on Juju 2.2 by commenting out the Juju 2.2 checks at the start and deploying the nagios and nrpe charms on separate machines. Traceback (most recent call last): File "/var/lib/juju/agents/unit-nrpe-0/charm/hooks/config-changed", line 3, in <module> services.manage() File "/var/lib/juju/agents/unit-nrpe-0/charm/hooks/services.py", line 27, in manage nrpe_helpers.NagiosInfo(), File "/var/lib/juju/agents/unit-nrpe-0/charm/hooks/nrpe_helpers.py", line 202, in __init__ self['nagios_hostname'] = self.principle_relation.nagios_hostname() File "/var/lib/juju/agents/unit-nrpe-0/charm/hooks/nrpe_helpers.py", line 163, in nagios_hostname principle_unitname = hookenv.principal_unit() File "/var/lib/juju/agents/unit-nrpe-0/charm/hooks/charmhelpers/core/hookenv.py", line 219, in principal_unit md = _metadata_unit(unit) File "/var/lib/juju/agents/unit-nrpe-0/charm/hooks/charmhelpers/core/hookenv.py", line 513, in _metadata_unit with open(os.path.join(basedir, unitdir, 'charm', 'metadata.yaml')) as md: FileNotFoundError: [Errno 2] No such file or directory: '/var/lib/juju/agents/unit-nagios-0/charm/metadata.yaml' To manage notifications about this bug go to: https://bugs.launchpad.net/charm-helpers/+bug/1712977/+subscriptions -- Mailing list: https://launchpad.net/~nagios-charmers Post to : [email protected] Unsubscribe : https://launchpad.net/~nagios-charmers More help : https://help.launchpad.net/ListHelp

