From 5a90d64b343f158d43397c70c267deb4e7ef0e00 Mon Sep 17 00:00:00 2001 From: Zac Dover Date: Tue, 18 Apr 2023 16:28:50 +0200 Subject: [PATCH] doc/mgr: update prompts in prometheus.rst Update prompts in prometheus.rst so that they're unselectable. Signed-off-by: Zac Dover --- doc/mgr/prometheus.rst | 78 +++++++++++++++++++++++++++--------------- 1 file changed, 51 insertions(+), 27 deletions(-) diff --git a/doc/mgr/prometheus.rst b/doc/mgr/prometheus.rst index 62dcf5bfd45bd..a3ea3f1e81ceb 100644 --- a/doc/mgr/prometheus.rst +++ b/doc/mgr/prometheus.rst @@ -18,9 +18,11 @@ for all reporting entities are returned in text exposition format. Enabling prometheus output ========================== -The *prometheus* module is enabled with:: +The *prometheus* module is enabled with: - ceph mgr module enable prometheus +.. prompt:: bash $ + + ceph mgr module enable prometheus Configuration ------------- @@ -48,10 +50,10 @@ configurable with ``ceph config set``, with keys is registered with Prometheus's `registry `_. -:: - - ceph config set mgr mgr/prometheus/server_addr 0.0.0.0 - ceph config set mgr mgr/prometheus/server_port 9283 +.. prompt:: bash $ + + ceph config set mgr mgr/prometheus/server_addr 0.0.0. + ceph config set mgr mgr/prometheus/server_port 9283 .. warning:: @@ -66,9 +68,11 @@ recommended to use 15 seconds as scrape interval, though, in some cases it might be useful to increase the scrape interval. To set a different scrape interval in the Prometheus module, set -``scrape_interval`` to the desired value:: +``scrape_interval`` to the desired value: + +.. prompt:: bash $ - ceph config set mgr mgr/prometheus/scrape_interval 20 + ceph config set mgr mgr/prometheus/scrape_interval 20 On large clusters (>1000 OSDs), the time to fetch the metrics may become significant. Without the cache, the Prometheus manager module could, especially @@ -87,35 +91,47 @@ This behavior can be configured. By default, it will return a 503 HTTP status code (service unavailable). You can set other options using the ``ceph config set`` commands. -To tell the module to respond with possibly stale data, set it to ``return``:: +To tell the module to respond with possibly stale data, set it to ``return``: + +.. prompt:: bash $ ceph config set mgr mgr/prometheus/stale_cache_strategy return -To tell the module to respond with "service unavailable", set it to ``fail``:: +To tell the module to respond with "service unavailable", set it to ``fail``: + +.. prompt:: bash $ + + ceph config set mgr mgr/prometheus/stale_cache_strategy fail - ceph config set mgr mgr/prometheus/stale_cache_strategy fail +If you are confident that you don't require the cache, you can disable it: -If you are confident that you don't require the cache, you can disable it:: +.. prompt:: bash $ - ceph config set mgr mgr/prometheus/cache false + ceph config set mgr mgr/prometheus/cache false If you are using the prometheus module behind some kind of reverse proxy or loadbalancer, you can simplify discovering the active instance by switching -to ``error``-mode:: +to ``error``-mode: - ceph config set mgr mgr/prometheus/standby_behaviour error +.. prompt:: bash $ + + ceph config set mgr mgr/prometheus/standby_behaviour error If set, the prometheus module will respond with a HTTP error when requesting ``/`` from the standby instance. The default error code is 500, but you can configure -the HTTP response code with:: +the HTTP response code with: + +.. prompt:: bash $ - ceph config set mgr mgr/prometheus/standby_error_status_code 503 + ceph config set mgr mgr/prometheus/standby_error_status_code 503 Valid error codes are between 400-599. -To switch back to the default behaviour, simply set the config key to ``default``:: +To switch back to the default behaviour, simply set the config key to ``default``: - ceph config set mgr mgr/prometheus/standby_behaviour default +.. prompt:: bash $ + + ceph config set mgr mgr/prometheus/standby_behaviour default .. _prometheus-rbd-io-statistics: @@ -166,13 +182,17 @@ configuration parameter. The parameter is a comma or space separated list of ``pool[/namespace]`` entries. If the namespace is not specified the statistics are collected for all namespaces in the pool. -Example to activate the RBD-enabled pools ``pool1``, ``pool2`` and ``poolN``:: +Example to activate the RBD-enabled pools ``pool1``, ``pool2`` and ``poolN``: + +.. prompt:: bash $ - ceph config set mgr mgr/prometheus/rbd_stats_pools "pool1,pool2,poolN" + ceph config set mgr mgr/prometheus/rbd_stats_pools "pool1,pool2,poolN" -The wildcard can be used to indicate all pools or namespaces:: +The wildcard can be used to indicate all pools or namespaces: - ceph config set mgr mgr/prometheus/rbd_stats_pools "*" +.. prompt:: bash $ + + ceph config set mgr mgr/prometheus/rbd_stats_pools "*" The module makes the list of all available images scanning the specified pools and namespaces and refreshes it periodically. The period is @@ -181,18 +201,22 @@ parameter (in sec) and is 300 sec (5 minutes) by default. The module will force refresh earlier if it detects statistics from a previously unknown RBD image. -Example to turn up the sync interval to 10 minutes:: +Example to turn up the sync interval to 10 minutes: + +.. prompt:: bash $ - ceph config set mgr mgr/prometheus/rbd_stats_pools_refresh_interval 600 + ceph config set mgr mgr/prometheus/rbd_stats_pools_refresh_interval 600 Ceph daemon performance counters metrics ----------------------------------------- With the introduction of ``ceph-exporter`` daemon, the prometheus module will no longer export Ceph daemon perf counters as prometheus metrics by default. However, one may re-enable exporting these metrics by setting -the module option ``exclude_perf_counters`` to ``false``:: +the module option ``exclude_perf_counters`` to ``false``: + +.. prompt:: bash $ - ceph config set mgr mgr/prometheus/exclude_perf_counters false + ceph config set mgr mgr/prometheus/exclude_perf_counters false Statistic names and labels ========================== -- 2.39.5