mirror of
https://github.com/ceph/ceph
synced 2025-01-19 17:41:39 +00:00
Merge pull request #46218 from votdev/issue_55595_prometheus_external_url
cephadm: prometheus: The generatorURL in alerts is only using hostname Reviewed-by: Adam King <adking@redhat.com> Reviewed-by: Michael Fritch <mfritch@suse.com> Reviewed-by: Redouane Kachach <rkachach@redhat.com>
This commit is contained in:
commit
15648422de
@ -2546,6 +2546,10 @@ def get_daemon_args(ctx, fsid, daemon_type, daemon_id):
|
||||
if 'ports' in meta and meta['ports']:
|
||||
port = meta['ports'][0]
|
||||
r += [f'--web.listen-address={ip}:{port}']
|
||||
if daemon_type == 'prometheus':
|
||||
scheme = 'http'
|
||||
host = get_fqdn()
|
||||
r += [f'--web.external-url={scheme}://{host}:{port}']
|
||||
if daemon_type == 'alertmanager':
|
||||
config = get_parm(ctx.config_json)
|
||||
peers = config.get('peers', list()) # type: ignore
|
||||
|
@ -1079,6 +1079,14 @@ class TestMonitoring(object):
|
||||
version = cd.Monitoring.get_version(ctx, 'container_id', daemon_type)
|
||||
assert version == '0.16.1'
|
||||
|
||||
def test_prometheus_external_url(self):
|
||||
ctx = cd.CephadmContext()
|
||||
daemon_type = 'prometheus'
|
||||
daemon_id = 'home'
|
||||
fsid = 'aaf5a720-13fe-4a3b-82b9-2d99b7fd9704'
|
||||
args = cd.get_daemon_args(ctx, fsid, daemon_type, daemon_id)
|
||||
assert any([x.startswith('--web.external-url=http://') for x in args])
|
||||
|
||||
@mock.patch('cephadm.call')
|
||||
def test_get_version_node_exporter(self, _call):
|
||||
ctx = cd.CephadmContext()
|
||||
|
Loading…
Reference in New Issue
Block a user