Skip to content

Commit

Permalink
cephadm: open ports in firewall when adopting monitoring stack daemons
Browse files Browse the repository at this point in the history
Otherwise we risk the prometheus/alertmanager/grafana
not functioning properly after adoption due to the necessary
port in the firewall not being open.

Fixes: https://tracker.ceph.com/issues/59443

Signed-off-by: Adam King <adking@redhat.com>
  • Loading branch information
adk3798 committed May 2, 2023
1 parent 50daa16 commit 7d601e0
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/cephadm/cephadm.py
Original file line number Diff line number Diff line change
Expand Up @@ -7205,6 +7205,9 @@ def command_adopt_prometheus(ctx, daemon_id, fsid):
# type: (CephadmContext, str, str) -> None
daemon_type = 'prometheus'
(uid, gid) = extract_uid_gid_monitoring(ctx, daemon_type)
# should try to set the ports we know cephadm defaults
# to for these services in the firewall.
ports = Monitoring.port_map['prometheus']

_stop_and_disable(ctx, 'prometheus')

Expand All @@ -7226,7 +7229,7 @@ def command_adopt_prometheus(ctx, daemon_id, fsid):

make_var_run(ctx, fsid, uid, gid)
c = get_container(ctx, fsid, daemon_type, daemon_id)
deploy_daemon(ctx, fsid, daemon_type, daemon_id, c, uid, gid)
deploy_daemon(ctx, fsid, daemon_type, daemon_id, c, uid, gid, redeploy=True, ports=ports)
update_firewalld(ctx, daemon_type)


Expand All @@ -7235,6 +7238,9 @@ def command_adopt_grafana(ctx, daemon_id, fsid):

daemon_type = 'grafana'
(uid, gid) = extract_uid_gid_monitoring(ctx, daemon_type)
# should try to set the ports we know cephadm defaults
# to for these services in the firewall.
ports = Monitoring.port_map['grafana']

_stop_and_disable(ctx, 'grafana-server')

Expand Down Expand Up @@ -7280,7 +7286,7 @@ def command_adopt_grafana(ctx, daemon_id, fsid):

make_var_run(ctx, fsid, uid, gid)
c = get_container(ctx, fsid, daemon_type, daemon_id)
deploy_daemon(ctx, fsid, daemon_type, daemon_id, c, uid, gid)
deploy_daemon(ctx, fsid, daemon_type, daemon_id, c, uid, gid, redeploy=True, ports=ports)
update_firewalld(ctx, daemon_type)


Expand All @@ -7289,6 +7295,9 @@ def command_adopt_alertmanager(ctx, daemon_id, fsid):

daemon_type = 'alertmanager'
(uid, gid) = extract_uid_gid_monitoring(ctx, daemon_type)
# should try to set the ports we know cephadm defaults
# to for these services in the firewall.
ports = Monitoring.port_map['alertmanager']

_stop_and_disable(ctx, 'prometheus-alertmanager')

Expand All @@ -7310,7 +7319,7 @@ def command_adopt_alertmanager(ctx, daemon_id, fsid):

make_var_run(ctx, fsid, uid, gid)
c = get_container(ctx, fsid, daemon_type, daemon_id)
deploy_daemon(ctx, fsid, daemon_type, daemon_id, c, uid, gid)
deploy_daemon(ctx, fsid, daemon_type, daemon_id, c, uid, gid, redeploy=True, ports=ports)
update_firewalld(ctx, daemon_type)


Expand Down

0 comments on commit 7d601e0

Please sign in to comment.