← Back to team overview

nagios-charmers team mailing list archive

[Bug 1864192] Re: Thruk-agent passes blank relation info via general-info - juju-info

 

Although thruk agent should provide a proper ingress-address, that charm
uses an obsolete charming model and should be overhauled. Since this bug
can be fixed easily on the nagios side, I will remove the thruk agent
charm from the list of affected projects

** Merge proposal linked:
   https://code.launchpad.net/~aieri/charm-nagios/+git/nagios-charm/+merge/386291

** Changed in: charm-nagios
       Status: New => Fix Committed

** No longer affects: charm-thruk-agent

-- 
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/1864192

Title:
  Thruk-agent passes blank relation info via general-info - juju-info

Status in Nagios Charm:
  Fix Committed

Bug description:
  Summary:
  ==========================================================================
  Nagios receive blank relation data from thruk over the juju-info/general-info relation

  Steps to reproduce:
  ==========================================================================
  juju deploy nagios
  juju deploy thruk-agent
  juju add-relation nagios:juju-info thruk-agent:general-info

  Model excerpt
  ==========================================================================
  Platform: Xenial
  juju: 2.7.2-xenial-amd64

  nagios                     active           1  nagios            jujucharms   35  ubuntu
  thruk-agent                unknown          1  thruk-agent       jujucharms    6  ubuntu

  nagios:juju-info             thruk-agent:general-info    juju-info  subordinate
  nrpe-lxd:monitors            nagios:monitors             monitors   regular
  nrpe-physical-mgmt:monitors  nagios:monitors             monitors   regular
  nrpe-physical:monitors       nagios:monitors             monitors   regular
  thruk-agent:juju-info        nagios:nagios               juju-info  regular

  Expected Result (something like):
  ==========================================================================

  u=thruk-agent/1;r=general-info; juju run --unit $u "relation-ids $r|
  xargs -I_@ sh -c 'relation-list -r _@|xargs -I_U sh -c \"relation-get
  -r _@ - _U |sed s,^,_U:, 2>&1\"'"

  nagios/1:egress-subnets: 10.116.18.70/32
  nagios/1:ingress-address: 10.116.18.70
  nagios/1:private-address: 10.116.18.70

  Actual Result (from broken units):
  ==========================================================================

  u=thruk-agent/8;r=general-info; juju run --unit $u "relation-ids $r| xargs -I_@ sh -c 'relation-list -r _@|xargs -I_U sh -c \"relation-get -r _@ - _U |sed s,^,_U:, 2>&1\"'"
  nagios/7:{}

  Error thrown in nagios:
  ==========================================================================

  charm/hooks/common.py

  File "/var/lib/juju/agents/unit-nagios-0/charm/hooks/common.py", line 49, in ingress_address
     return relation_data['private-address']
  KeyError: 'private-address'

  https://git.launchpad.net/charm-nagios/tree/hooks/common.py#n46

  Workaround (modified code to cheat the problem)
  ==========================================================================

  def ingress_address(relation_data):
      for key in relation_data:
          log(key +': ' + relation_data[key])

      if 'ingress-address' in relation_data:
          return relation_data['ingress-address']

      if 'private-address' in relation_data:
          return relation_data['private-address']

      if relation_data['target-id'].startswith('thruk-agent'):
          log('Hack for blank nagios:thruk relation info: %s' % unit_get('private-address'))
          return unit_get('private-address')

      raise Exception('%s relation is empty, private-address not passed'
  % relation_data['target-id'])

  Additional debug
  ==========================================================================

  juju run -u thruk-agent/8 unit-get --format=json private-address
  [{"Stdout":"10.116.69.55\n","UnitId":"thruk-agent/8"}]

  juju run -u nagios/7 unit-get --format=json private-address
  [{"Stdout":"10.116.69.55\n","UnitId":"nagios/7"}]

  What we need
  ==========================================================================
  determine why thruk is sending empty relation data, and if not why is it empty after being provided via the interface.

To manage notifications about this bug go to:
https://bugs.launchpad.net/charm-nagios/+bug/1864192/+subscriptions