From: Patrick Seidensal Date: Mon, 25 May 2020 13:43:38 +0000 (+0200) Subject: mgr/cephadm: custom images for monitoring components X-Git-Tag: v16.1.0~2218^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5d601bc781ab163599f3f17d788a36a1207d7624;p=ceph.git mgr/cephadm: custom images for monitoring components Namely, - Grafana - Prometheus - Alertmanager and - Node exporter. Fixes: https://tracker.ceph.com/issues/45463 Signed-off-by: Patrick Seidensal --- diff --git a/doc/cephadm/monitoring.rst b/doc/cephadm/monitoring.rst index 579949103081..eac55585077f 100644 --- a/doc/cephadm/monitoring.rst +++ b/doc/cephadm/monitoring.rst @@ -57,6 +57,45 @@ completed, you should see something like this from ``ceph orch ls``:: node-exporter 2/2 6s ago docker.io/prom/node-exporter:latest e5a616e4b9cf present prometheus 1/1 6s ago docker.io/prom/prometheus:latest e935122ab143 present +Using custom images +~~~~~~~~~~~~~~~~~~~ + +It is possible to install or upgrade monitoring components based on other +images. To do so, the name of the image to be used needs to be stored in the +configuration first. The following configuration options are available. + +- ``container_image_prometheus`` +- ``container_image_grafana`` +- ``container_image_alertmanager`` +- ``container_image_node_exporter`` + +Custom images can be set with the ``ceph config`` command:: + + ceph config set mgr mgr/cephadm/ + +For example:: + + ceph config set mgr mgr/cephadm/container_image_prometheus prom/prometheus:v1.4.1 + +.. note:: + + By setting a custom image, the default value will be overridden (but not + overwritten). The default value changes when updates become available. + By setting a custom image, you will not be able to update the component + you have set the custom image for automatically. You will need to + manually update the configuration (image name and tag) to be able to + install updates. + + If you choose to go with the recommendations instead, you can reset the + custom image you have set before. After that, the default value will be + used again. Use ``ceph config rm`` to reset the configuration option:: + + ceph config rm mgr mgr/cephadm/ + + For example:: + + ceph config rm mgr mgr/cephadm/container_image_prometheus + Disabling monitoring -------------------- diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index 9db98b977b93..385c171c3891 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -186,6 +186,26 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule): 'desc': 'Container image name, without the tag', 'runtime': True, }, + { + 'name': 'container_image_prometheus', + 'default': 'prom/prometheus:v2.18.1', + 'desc': 'Prometheus container image', + }, + { + 'name': 'container_image_grafana', + 'default': 'ceph/ceph-grafana:latest', + 'desc': 'Prometheus container image', + }, + { + 'name': 'container_image_alertmanager', + 'default': 'prom/alertmanager:v0.20.0', + 'desc': 'Prometheus container image', + }, + { + 'name': 'container_image_node_exporter', + 'default': 'prom/node-exporter:v0.18.1', + 'desc': 'Prometheus container image', + }, { 'name': 'warn_on_stray_hosts', 'type': 'bool', @@ -251,6 +271,10 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule): self.host_check_interval = 0 self.mode = '' self.container_image_base = '' + self.container_image_prometheus = '' + self.container_image_grafana = '' + self.container_image_alertmanager = '' + self.container_image_node_exporter = '' self.warn_on_stray_hosts = True self.warn_on_stray_daemons = True self.warn_on_failed_host_check = True @@ -891,6 +915,15 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule): 'key': 'container_image', }) image = image.strip() # type: ignore + elif daemon_type == 'prometheus': + image = self.container_image_prometheus + elif daemon_type == 'grafana': + image = self.container_image_grafana + elif daemon_type == 'alertmanager': + image = self.container_image_alertmanager + elif daemon_type == 'node-exporter': + image = self.container_image_node_exporter + self.log.debug('%s container image %s' % (entity, image)) final_args = []