]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
prometheus: Properly split the port off IPv6 addresses 36594/head
authorMatthew Oliver <moliver@suse.com>
Thu, 13 Aug 2020 00:41:44 +0000 (10:41 +1000)
committerMatthew Oliver <moliver@suse.com>
Thu, 13 Aug 2020 00:41:44 +0000 (10:41 +1000)
commit985cce055bcee60b843806291458517c7ee890a3
treebdcd07d4d980ef5042704d4bcf239a5210223d58
parent34a4e1284d84b4940be5d13941a30569c5f6ee0a
prometheus: Properly split the port off IPv6 addresses

The Prometheus module when splitting the port nubmer for public and
client networks/ips doesn't take IPv6 addresses into account.

This patch fixes this by using `rsplit(':', 1)` rather then `split(':')`
which leads to bugs like:

  curl --silent http://localhost:9283/metrics | grep ceph_mon_metadata{
  ceph_mon_metadata{ceph_daemon="mon.mon2",hostname="mon2.example.net",public_addr="[2001",rank="0",ceph_version="ceph version 15.2.4 (7447c15c6ff58d7fce91843b705a268a1917325c) octopus (stable)"} 1.0

Note the public_addr above being split at the first ':' of an IPv6
address.

Signed-off-by: Matthew Oliver <moliver@suse.com>
Fixes: https://tracker.ceph.com/issues/46846
src/pybind/mgr/prometheus/module.py