]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
prometheus: Properly split the port off IPv6 addresses 36984/head
authorMatthew Oliver <moliver@suse.com>
Thu, 13 Aug 2020 00:41:44 +0000 (10:41 +1000)
committerKonstantin Shalygin <k0ste@k0ste.ru>
Fri, 4 Sep 2020 03:56:10 +0000 (10:56 +0700)
commitcb097946cfceb976870145da52546f93397a606a
tree24af2297d0be30dd7496f7b56f0e4f2b2f74b248
parentfee7b7e4d8927d79c886fba1b53276175c503b4b
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
(cherry picked from commit 985cce055bcee60b843806291458517c7ee890a3)
src/pybind/mgr/prometheus/module.py