From 19fcec84d8d7d21e796c7624e521b60d28ee21ed Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 20:45:59 +0200 Subject: Adding upstream version 16.2.11+ds. Signed-off-by: Daniel Baumann --- doc/mgr/administrator.rst | 179 +++ doc/mgr/alerts.rst | 58 + doc/mgr/ceph_api/index.rst | 90 ++ doc/mgr/cli_api.rst | 39 + doc/mgr/crash.rst | 83 ++ doc/mgr/dashboard.rst | 1619 +++++++++++++++++++++ doc/mgr/dashboard_plugins/debug.inc.rst | 43 + doc/mgr/dashboard_plugins/feature_toggles.inc.rst | 56 + doc/mgr/dashboard_plugins/motd.inc.rst | 36 + doc/mgr/diskprediction.rst | 59 + doc/mgr/hello.rst | 39 + doc/mgr/index.rst | 50 + doc/mgr/influx.rst | 165 +++ doc/mgr/insights.rst | 52 + doc/mgr/iostat.rst | 32 + doc/mgr/localpool.rst | 37 + doc/mgr/mds_autoscaler.rst | 23 + doc/mgr/modules.rst | 476 ++++++ doc/mgr/nfs.rst | 612 ++++++++ doc/mgr/orchestrator.rst | 240 +++ doc/mgr/orchestrator_modules.rst | 332 +++++ doc/mgr/prometheus.rst | 388 +++++ doc/mgr/restful.rst | 189 +++ doc/mgr/rook.rst | 39 + doc/mgr/telegraf.rst | 88 ++ doc/mgr/telemetry.rst | 155 ++ doc/mgr/zabbix.rst | 153 ++ 27 files changed, 5332 insertions(+) create mode 100644 doc/mgr/administrator.rst create mode 100644 doc/mgr/alerts.rst create mode 100644 doc/mgr/ceph_api/index.rst create mode 100644 doc/mgr/cli_api.rst create mode 100644 doc/mgr/crash.rst create mode 100644 doc/mgr/dashboard.rst create mode 100644 doc/mgr/dashboard_plugins/debug.inc.rst create mode 100644 doc/mgr/dashboard_plugins/feature_toggles.inc.rst create mode 100644 doc/mgr/dashboard_plugins/motd.inc.rst create mode 100644 doc/mgr/diskprediction.rst create mode 100644 doc/mgr/hello.rst create mode 100644 doc/mgr/index.rst create mode 100644 doc/mgr/influx.rst create mode 100644 doc/mgr/insights.rst create mode 100644 doc/mgr/iostat.rst create mode 100644 doc/mgr/localpool.rst create mode 100644 doc/mgr/mds_autoscaler.rst create mode 100644 doc/mgr/modules.rst create mode 100644 doc/mgr/nfs.rst create mode 100644 doc/mgr/orchestrator.rst create mode 100644 doc/mgr/orchestrator_modules.rst create mode 100644 doc/mgr/prometheus.rst create mode 100644 doc/mgr/restful.rst create mode 100644 doc/mgr/rook.rst create mode 100644 doc/mgr/telegraf.rst create mode 100644 doc/mgr/telemetry.rst create mode 100644 doc/mgr/zabbix.rst (limited to 'doc/mgr') diff --git a/doc/mgr/administrator.rst b/doc/mgr/administrator.rst new file mode 100644 index 000000000..62294580a --- /dev/null +++ b/doc/mgr/administrator.rst @@ -0,0 +1,179 @@ +.. _mgr-administrator-guide: + +ceph-mgr administrator's guide +============================== + +Manual setup +------------ + +Usually, you would set up a ceph-mgr daemon using a tool such +as ceph-ansible. These instructions describe how to set up +a ceph-mgr daemon manually. + +First, create an authentication key for your daemon:: + + ceph auth get-or-create mgr.$name mon 'allow profile mgr' osd 'allow *' mds 'allow *' + +Place that key into ``mgr data`` path, which for a cluster "ceph" +and mgr $name "foo" would be ``/var/lib/ceph/mgr/ceph-foo``. + +Start the ceph-mgr daemon:: + + ceph-mgr -i $name + +Check that the mgr has come up by looking at the output +of ``ceph status``, which should now include a mgr status line:: + + mgr active: $name + +Client authentication +--------------------- + +The manager is a new daemon which requires new CephX capabilities. If you upgrade +a cluster from an old version of Ceph, or use the default install/deploy tools, +your admin client should get this capability automatically. If you use tooling from +elsewhere, you may get EACCES errors when invoking certain ceph cluster commands. +To fix that, add a "mgr allow \*" stanza to your client's cephx capabilities by +`Modifying User Capabilities`_. + +High availability +----------------- + +In general, you should set up a ceph-mgr on each of the hosts +running a ceph-mon daemon to achieve the same level of availability. + +By default, whichever ceph-mgr instance comes up first will be made +active by the monitors, and the others will be standbys. There is +no requirement for quorum among the ceph-mgr daemons. + +If the active daemon fails to send a beacon to the monitors for +more than ``mon mgr beacon grace`` (default 30s), then it will be replaced +by a standby. + +If you want to pre-empt failover, you can explicitly mark a ceph-mgr +daemon as failed using ``ceph mgr fail ``. + +Performance and Scalability +--------------------------- + +All the mgr modules share a cache that can be enabled with +``ceph config set mgr mgr_ttl_cache_expire_seconds ``, where seconds +is the time to live of the cached python objects. + +It is recommended to enable the cache with a 10 seconds TTL when there are 500+ +osds or 10k+ pgs as internal structures might increase in size, and cause latency +issues when requesting large structures. As an example, an OSDMap with 1000 osds +has a aproximate size of 4MiB. With heavy load, on a 3000 osd cluster there has +been a 1.5x improvement enabling the cache. + +Furthermore, you can run ``ceph daemon mgr.${MGRNAME} perf dump`` to retrieve perf +counters of a mgr module. In ``mgr.cache_hit`` and ``mgr.cache_miss`` you'll find the +hit/miss ratio of the mgr cache. + +Using modules +------------- + +Use the command ``ceph mgr module ls`` to see which modules are +available, and which are currently enabled. Enable or disable modules +using the commands ``ceph mgr module enable `` and +``ceph mgr module disable `` respectively. + +If a module is *enabled* then the active ceph-mgr daemon will load +and execute it. In the case of modules that provide a service, +such as an HTTP server, the module may publish its address when it +is loaded. To see the addresses of such modules, use the command +``ceph mgr services``. + +Some modules may also implement a special standby mode which runs on +standby ceph-mgr daemons as well as the active daemon. This enables +modules that provide services to redirect their clients to the active +daemon, if the client tries to connect to a standby. + +Consult the documentation pages for individual manager modules for more +information about what functionality each module provides. + +Here is an example of enabling the :term:`Dashboard` module: + +:: + + $ ceph mgr module ls + { + "enabled_modules": [ + "restful", + "status" + ], + "disabled_modules": [ + "dashboard" + ] + } + + $ ceph mgr module enable dashboard + $ ceph mgr module ls + { + "enabled_modules": [ + "restful", + "status", + "dashboard" + ], + "disabled_modules": [ + ] + } + + $ ceph mgr services + { + "dashboard": "http://myserver.com:7789/", + "restful": "https://myserver.com:8789/" + } + + +The first time the cluster starts, it uses the ``mgr_initial_modules`` +setting to override which modules to enable. However, this setting +is ignored through the rest of the lifetime of the cluster: only +use it for bootstrapping. For example, before starting your +monitor daemons for the first time, you might add a section like +this to your ``ceph.conf``: + +:: + + [mon] + mgr_initial_modules = dashboard balancer + +Calling module commands +----------------------- + +Where a module implements command line hooks, the commands will +be accessible as ordinary Ceph commands. Ceph will automatically incorporate +module commands into the standard CLI interface and route them appropriately to +the module.:: + + ceph + +Configuration +------------- + +``mgr_module_path`` + +:Description: Path to load modules from +:Type: String +:Default: ``"/mgr"`` + +``mgr_data`` + +:Description: Path to load daemon data (such as keyring) +:Type: String +:Default: ``"/var/lib/ceph/mgr/$cluster-$id"`` + +``mgr_tick_period`` + +:Description: How many seconds between mgr beacons to monitors, and other + periodic checks. +:Type: Integer +:Default: ``5`` + +``mon_mgr_beacon_grace`` + +:Description: How long after last beacon should a mgr be considered failed +:Type: Integer +:Default: ``30`` + +.. _Modifying User Capabilities: ../../rados/operations/user-management/#modify-user-capabilities diff --git a/doc/mgr/alerts.rst b/doc/mgr/alerts.rst new file mode 100644 index 000000000..319d9d927 --- /dev/null +++ b/doc/mgr/alerts.rst @@ -0,0 +1,58 @@ +Alerts module +============= + +The alerts module can send simple alert messages about cluster health +via e-mail. In the future, it will support other notification methods +as well. + +:note: This module is *not* intended to be a robust monitoring + solution. The fact that it is run as part of the Ceph cluster + itself is fundamentally limiting in that a failure of the + ceph-mgr daemon prevents alerts from being sent. This module + can, however, be useful for standalone clusters that exist in + environments where existing monitoring infrastructure does not + exist. + +Enabling +-------- + +The *alerts* module is enabled with:: + + ceph mgr module enable alerts + +Configuration +------------- + +To configure SMTP, all of the following config options must be set:: + + ceph config set mgr mgr/alerts/smtp_host ** + ceph config set mgr mgr/alerts/smtp_destination ** + ceph config set mgr mgr/alerts/smtp_sender ** + +By default, the module will use SSL and port 465. To change that,:: + + ceph config set mgr mgr/alerts/smtp_ssl false # if not SSL + ceph config set mgr mgr/alerts/smtp_port ** # if not 465 + +To authenticate to the SMTP server, you must set the user and password:: + + ceph config set mgr mgr/alerts/smtp_user ** + ceph config set mgr mgr/alerts/smtp_password ** + +By default, the name in the ``From:`` line is simply ``Ceph``. To +change that (e.g., to identify which cluster this is),:: + + ceph config set mgr mgr/alerts/smtp_from_name 'Ceph Cluster Foo' + +By default, the module will check the cluster health once per minute +and, if there is a change, send a message. To change that +frequency,:: + + ceph config set mgr mgr/alerts/interval ** # e.g., "5m" for 5 minutes + +Commands +-------- + +To force an alert to be send immediately,:: + + ceph alerts send diff --git a/doc/mgr/ceph_api/index.rst b/doc/mgr/ceph_api/index.rst new file mode 100644 index 000000000..f4e6836b0 --- /dev/null +++ b/doc/mgr/ceph_api/index.rst @@ -0,0 +1,90 @@ +.. _mgr-ceph-api: + +================ +Ceph RESTful API +================ + +Introduction +============ +The **Ceph RESTful API** (henceforth **Ceph API**) is provided by the +:ref:`mgr-dashboard` module. The Ceph API +service is available at the same URL as the regular Ceph Dashboard, under the +``/api`` base path (please refer to :ref:`dashboard-host-name-and-port`):: + + http://:/api + +or, if HTTPS is enabled (please refer to :ref:`dashboard-ssl-tls-support`):: + + https://:/api + +The Ceph API leverages the following standards: + +* `HTTP 1.1 `_ for API syntax and semantics, +* `JSON `_ for content encoding, +* `HTTP Content Negotiation `_ and `MIME `_ for versioning, +* `OAuth 2.0 `_ and `JWT `_ for authentication and authorization. + +.. warning:: + Some endpoints are still under active development, and should be carefully + used since new Ceph releases could bring backward incompatible changes. + + +Authentication and Authorization +================================ + +Requests to the Ceph API pass through two access control checkpoints: + +* **Authentication**: ensures that the request is performed on behalf of an existing and valid user account. +* **Authorization**: ensures that the previously authenticated user can in fact perform a specific action (create, read, update or delete) on the target endpoint. + +So, prior to start consuming the Ceph API, a valid JSON Web Token (JWT) has to +be obtained, and it may then be reused for subsequent requests. The +``/api/auth`` endpoint will provide the valid token: + +.. code-block:: sh + + $ curl -X POST "https://example.com:8443/api/auth" \ + -H "Accept: application/vnd.ceph.api.v1.0+json" \ + -H "Content-Type: application/json" \ + -d '{"username": , "password": }' + + { "token": "", ...} + +The token obtained must be passed together with every API request in the +``Authorization`` HTTP header:: + + curl -H "Authorization: Bearer " ... + +Authentication and authorization can be further configured from the +Ceph CLI, the Ceph-Dashboard UI and the Ceph API itself (please refer to +:ref:`dashboard-user-role-management`). + +Versioning +========== + +One of the main goals of the Ceph API is to keep a stable interface. For this +purpose, Ceph API is built upon the following principles: + +* **Mandatory**: in order to avoid implicit defaults, all endpoints require an explicit default version (starting with ``1.0``). +* **Per-endpoint**: as this API wraps many different Ceph components, this allows for a finer-grained change control. + * **Content/MIME Type**: the version expected from a specific endpoint is stated by the ``Accept: application/vnd.ceph.api.v.+json`` HTTP header. If the current Ceph API server is not able to address that specific major version, a `415 - Unsupported Media Type `_ response will be returned. +* **Semantic Versioning**: with a ``major.minor`` version: + * Major changes are backward incompatible: they might result in non-additive changes to the request and/or response formats of a specific endpoint. + * Minor changes are backward/forward compatible: they basically consists of additive changes to the request or response formats of a specific endpoint. + +An example: + +.. code-block:: bash + + $ curl -X GET "https://example.com:8443/api/osd" \ + -H "Accept: application/vnd.ceph.api.v1.0+json" \ + -H "Authorization: Bearer " + + +Specification +============= + +.. openapi:: ../../../src/pybind/mgr/dashboard/openapi.yaml + :group: + :examples: + :encoding: utf-8 diff --git a/doc/mgr/cli_api.rst b/doc/mgr/cli_api.rst new file mode 100644 index 000000000..81a99ae44 --- /dev/null +++ b/doc/mgr/cli_api.rst @@ -0,0 +1,39 @@ +CLI API Commands Module +======================= + +The CLI API module exposes most ceph-mgr python API via CLI. Furthermore, this API can be +benchmarked for further testing. + +Enabling +-------- + +The *cli api commands* module is enabled with:: + + ceph mgr module enable cli_api + +To check that it is enabled, run:: + + ceph mgr module ls | grep cli_api + +Usage +-------- + +To run a mgr module command, run:: + + ceph mgr cli + +For example, use the following command to print the list of servers:: + + ceph mgr cli list_servers + +List all available mgr module commands with:: + + ceph mgr cli --help + +To benchmark a command, run:: + + ceph mgr cli_benchmark + +For example, use the following command to benchmark the command to get osd_map:: + + ceph mgr cli_benchmark 100 10 get osd_map diff --git a/doc/mgr/crash.rst b/doc/mgr/crash.rst new file mode 100644 index 000000000..e12a8c6f8 --- /dev/null +++ b/doc/mgr/crash.rst @@ -0,0 +1,83 @@ +Crash Module +============ +The crash module collects information about daemon crashdumps and stores +it in the Ceph cluster for later analysis. + +Daemon crashdumps are dumped in /var/lib/ceph/crash by default; this can +be configured with the option 'crash dir'. Crash directories are named by +time and date and a randomly-generated UUID, and contain a metadata file +'meta' and a recent log file, with a "crash_id" that is the same. +This module allows the metadata about those dumps to be persisted in +the monitors' storage. + +Enabling +-------- + +The *crash* module is enabled with:: + + ceph mgr module enable crash + +Commands +-------- +:: + + ceph crash post -i + +Save a crash dump. The metadata file is a JSON blob stored in the crash +dir as ``meta``. As usual, the ceph command can be invoked with ``-i -``, +and will read from stdin. + +:: + + ceph crash rm + +Remove a specific crash dump. + +:: + + ceph crash ls + +List the timestamp/uuid crashids for all new and archived crash info. + +:: + + ceph crash ls-new + +List the timestamp/uuid crashids for all newcrash info. + +:: + + ceph crash stat + +Show a summary of saved crash info grouped by age. + +:: + + ceph crash info + +Show all details of a saved crash. + +:: + + ceph crash prune + +Remove saved crashes older than 'keep' days. must be an integer. + +:: + + ceph crash archive + +Archive a crash report so that it is no longer considered for the ``RECENT_CRASH`` health check and does not appear in the ``crash ls-new`` output (it will still appear in the ``crash ls`` output). + +:: + + ceph crash archive-all + +Archive all new crash reports. + + +Options +------- + +* ``mgr/crash/warn_recent_interval`` [default: 2 weeks] controls what constitutes "recent" for the purposes of raising the ``RECENT_CRASH`` health warning. +* ``mgr/crash/retain_interval`` [default: 1 year] controls how long crash reports are retained by the cluster before they are automatically purged. diff --git a/doc/mgr/dashboard.rst b/doc/mgr/dashboard.rst new file mode 100644 index 000000000..ca5dd7fb8 --- /dev/null +++ b/doc/mgr/dashboard.rst @@ -0,0 +1,1619 @@ +.. _mgr-dashboard: + +Ceph Dashboard +============== + +Overview +-------- + +The Ceph Dashboard is a built-in web-based Ceph management and monitoring +application through which you can inspect and administer various aspects +and resources within the cluster. It is implemented as a :ref:`ceph-manager-daemon` module. + +The original Ceph Dashboard that was shipped with Ceph Luminous started +out as a simple read-only view into run-time information and performance +data of Ceph clusters. It used a very simple architecture to achieve the +original goal. However, there was growing demand for richer web-based +management capabilities, to make it easier to administer Ceph for users that +prefer a WebUI over the CLI. + +The new :term:`Ceph Dashboard` module adds web-based monitoring and +administration to the Ceph Manager. The architecture and functionality of this new +module are derived from +and inspired by the `openATTIC Ceph management and monitoring tool +`_. Development is actively driven by the +openATTIC team at `SUSE `_, with support from +companies including `Red Hat `_ and members of the Ceph +community. + +The dashboard module's backend code uses the CherryPy framework and implements +a custom REST API. The WebUI implementation is based on +Angular/TypeScript and includes both functionality from the original dashboard +and new features originally developed for the standalone version +of openATTIC. The Ceph Dashboard module is implemented as an +application that provides a graphical representation of information and statistics +through a web server hosted by ``ceph-mgr``. + +Feature Overview +^^^^^^^^^^^^^^^^ + +The dashboard provides the following features: + +* **Multi-User and Role Management**: The dashboard supports multiple user + accounts with different permissions (roles). User accounts and roles + can be managed via both the command line and the WebUI. The dashboard + supports various methods to enhance password security. Password + complexity rules may be configured, requiring users to change their password + after the first login or after a configurable time period. See + :ref:`dashboard-user-role-management` for details. +* **Single Sign-On (SSO)**: The dashboard supports authentication + via an external identity provider using the SAML 2.0 protocol. See + :ref:`dashboard-sso-support` for details. +* **SSL/TLS support**: All HTTP communication between the web browser and the + dashboard is secured via SSL. A self-signed certificate can be created with + a built-in command, but it's also possible to import custom certificates + signed and issued by a CA. See :ref:`dashboard-ssl-tls-support` for details. +* **Auditing**: The dashboard backend can be configured to log all ``PUT``, ``POST`` + and ``DELETE`` API requests in the Ceph audit log. See :ref:`dashboard-auditing` + for instructions on how to enable this feature. +* **Internationalization (I18N)**: The language used for dashboard text can be + selected at run-time. + +The Ceph Dashboard offers the following monitoring and management capabilities: + +* **Overall cluster health**: Display performance and capacity metrics as well + as cluster status. +* **Embedded Grafana Dashboards**: Ceph Dashboard + `Grafana`_ dashboards may be embedded in external applications and web pages + to surface information and performance metrics gathered by + the :ref:`mgr-prometheus` module. See + :ref:`dashboard-grafana` for details on how to configure this functionality. +* **Cluster logs**: Display the latest updates to the cluster's event and + audit log files. Log entries can be filtered by priority, date or keyword. +* **Hosts**: Display a list of all cluster hosts along with their + storage drives, which services are running, and which version of Ceph is + installed. +* **Performance counters**: Display detailed service-specific statistics for + each running service. +* **Monitors**: List all Mons, their quorum status, and open sessions. +* **Monitoring**: Enable creation, re-creation, editing, and expiration of + Prometheus' silences, list the alerting configuration and all + configured and firing alerts. Show notifications for firing alerts. +* **Configuration Editor**: Display all available configuration options, + their descriptions, types, default and currently set values. These may be edited as well. +* **Pools**: List Ceph pools and their details (e.g. applications, + pg-autoscaling, placement groups, replication size, EC profile, CRUSH + rulesets, quotas etc.) +* **OSDs**: List OSDs, their status and usage statistics as well as + detailed information like attributes (OSD map), metadata, performance + counters and usage histograms for read/write operations. Mark OSDs + up/down/out, purge and reweight OSDs, perform scrub operations, modify + various scrub-related configuration options, select profiles to + adjust the level of backfilling activity. List all drives associated with an + OSD. Set and change the device class of an OSD, display and sort OSDs by + device class. Deploy OSDs on new drives and hosts. +* **Device management**: List all hosts known by the orchestrator. List all + drives attached to a host and their properties. Display drive + health predictions and SMART data. Blink enclosure LEDs. +* **iSCSI**: List all hosts that run the TCMU runner service, display all + images and their performance characteristics (read/write ops, traffic). + Create, modify, and delete iSCSI targets (via ``ceph-iscsi``). Display the + iSCSI gateway status and info about active initiators. + See :ref:`dashboard-iscsi-management` for instructions on how to configure + this feature. +* **RBD**: List all RBD images and their properties (size, objects, features). + Create, copy, modify and delete RBD images (incl. snapshots) and manage RBD + namespaces. Define various I/O or bandwidth limitation settings on a global, + per-pool or per-image level. Create, delete and rollback snapshots of selected + images, protect/unprotect these snapshots against modification. Copy or clone + snapshots, flatten cloned images. +* **RBD mirroring**: Enable and configure RBD mirroring to a remote Ceph server. + List active daemons and their status, pools and RBD images including + sync progress. +* **CephFS**: List active file system clients and associated pools, + including usage statistics. Evict active CephFS clients. Manage CephFS + quotas and snapshots. Browse a CephFS directory structure. +* **Object Gateway**: List all active object gateways and their performance + counters. Display and manage (add/edit/delete) object gateway users and their + details (e.g. quotas) as well as the users' buckets and their details (e.g. + placement targets, owner, quotas, versioning, multi-factor authentication). + See :ref:`dashboard-enabling-object-gateway` for configuration instructions. +* **NFS**: Manage NFS exports of CephFS file systems and RGW S3 buckets via NFS + Ganesha. See :ref:`dashboard-nfs-ganesha-management` for details on how to + enable this functionality. +* **Ceph Manager Modules**: Enable and disable Ceph Manager modules, manage + module-specific configuration settings. + +Overview of the Dashboard Landing Page +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Displays overall cluster status, performance, and capacity metrics. Shows instant +feedback for changes in the cluster and provides easy access to subpages of the +dashboard. + +.. _dashboard-landing-page-status: + +Status +"""""" + +* **Cluster Status**: Displays overall cluster health. In case of any error it + displays a short description of the error and provides a link to the logs. +* **Hosts**: Displays the total number of hosts associated to the cluster and + links to a subpage that lists and describes each. +* **Monitors**: Displays mons and their quorum status and + open sessions. Links to a subpage that lists and describes each. +* **OSDs**: Displays object storage daemons (ceph-osds) and + the numbers of OSDs running (up), in service + (in), and out of the cluster (out). Provides links to + subpages providing a list of all OSDs and related management actions. +* **Managers**: Displays active and standby Ceph Manager + daemons (ceph-mgr). +* **Object Gateway**: Displays active object gateways (RGWs) and + provides links to subpages that list all object gateway daemons. +* **Metadata Servers**: Displays active and standby CephFS metadata + service daemons (ceph-mds). +* **iSCSI Gateways**: Display iSCSI gateways available, + active (up), and inactive (down). Provides a link to a subpage + showing a list of all iSCSI Gateways. + +.. _dashboard-landing-page-capacity: + +Capacity +"""""""" + +* **Raw Capacity**: Displays the capacity used out of the total + physical capacity provided by storage nodes (OSDs). +* **Objects**: Displays the number and status of RADOS objects + including the percentages of healthy, misplaced, degraded, and unfound + objects. +* **PG Status**: Displays the total number of placement groups and + their status, including the percentage clean, working, + warning, and unknown. +* **Pools**: Displays pools and links to a subpage listing details. +* **PGs per OSD**: Displays the number of placement groups assigned to + object storage daemons. + +.. _dashboard-landing-page-performance: + +Performance +""""""""""" + +* **Client READ/Write**: Displays an overview of + client input and output operations. +* **Client Throughput**: Displays the data transfer rates to and from Ceph clients. +* **Recovery throughput**: Displays rate of cluster healing and balancing operations. +* **Scrubbing**: Displays light and deep scrub status. + +Supported Browsers +^^^^^^^^^^^^^^^^^^ + +Ceph Dashboard is primarily tested and developed using the following web +browsers: + ++---------------------------------------------------------------+---------------------------------------+ +| Browser | Versions | ++===============================================================+=======================================+ +| `Chrome `_ and | latest 2 major versions | +| `Chromium `_ based browsers | | ++---------------------------------------------------------------+---------------------------------------+ +| `Firefox `_ | latest 2 major versions | ++---------------------------------------------------------------+---------------------------------------+ +| `Firefox ESR `_ | latest major version | ++---------------------------------------------------------------+---------------------------------------+ + +While Ceph Dashboard might work in older browsers, we cannot guarantee compatibility and +recommend keeping your browser up to date. + +Enabling +-------- + +If you have installed ``ceph-mgr-dashboard`` from distribution packages, the +package management system should take care of installing all required +dependencies. + +If you're building Ceph from source and want to start the dashboard from your +development environment, please see the files ``README.rst`` and ``HACKING.rst`` +in the source directory ``src/pybind/mgr/dashboard``. + +Within a running Ceph cluster, the Ceph Dashboard is enabled with: + +.. prompt:: bash $ + + ceph mgr module enable dashboard + +Configuration +------------- + +.. _dashboard-ssl-tls-support: + +SSL/TLS Support +^^^^^^^^^^^^^^^ + +All HTTP connections to the dashboard are secured with SSL/TLS by default. + +To get the dashboard up and running quickly, you can generate and install a +self-signed certificate: + +.. prompt:: bash $ + + ceph dashboard create-self-signed-cert + +Note that most web browsers will complain about self-signed certificates +and require explicit confirmation before establishing a secure connection to the +dashboard. + +To properly secure a deployment and to remove the warning, a +certificate that is issued by a certificate authority (CA) should be used. + +For example, a key pair can be generated with a command similar to: + +.. prompt:: bash $ + + openssl req -new -nodes -x509 \ + -subj "/O=IT/CN=ceph-mgr-dashboard" -days 3650 \ + -keyout dashboard.key -out dashboard.crt -extensions v3_ca + +The ``dashboard.crt`` file should then be signed by a CA. Once that is done, you +can enable it for Ceph manager instances by running the following commands: + +.. prompt:: bash $ + + ceph dashboard set-ssl-certificate -i dashboard.crt + ceph dashboard set-ssl-certificate-key -i dashboard.key + +If unique certificates are desired for each manager instance, +the name of the instance can be included as follows (where ``$name`` is the name +of the ``ceph-mgr`` instance, usually the hostname): + +.. prompt:: bash $ + + ceph dashboard set-ssl-certificate $name -i dashboard.crt + ceph dashboard set-ssl-certificate-key $name -i dashboard.key + +SSL can also be disabled by setting this configuration value: + +.. prompt:: bash $ + + ceph config set mgr mgr/dashboard/ssl false + +This might be useful if the dashboard will be running behind a proxy which does +not support SSL for its upstream servers or other situations where SSL is not +wanted or required. See :ref:`dashboard-proxy-configuration` for more details. + +.. warning:: + + Use caution when disabling SSL as usernames and passwords will be sent to the + dashboard unencrypted. + + +.. note:: + + You must restart Ceph manager processes after changing the SSL + certificate and key. This can be accomplished by either running ``ceph mgr + fail mgr`` or by disabling and re-enabling the dashboard module (which also + triggers the manager to respawn itself): + + .. prompt:: bash $ + + ceph mgr module disable dashboard + ceph mgr module enable dashboard + +.. _dashboard-host-name-and-port: + +Host Name and Port +^^^^^^^^^^^^^^^^^^ + +Like most web applications, the dashboard binds to a TCP/IP address and TCP port. + +By default, the ``ceph-mgr`` daemon hosting the dashboard (i.e., the currently +active manager) will bind to TCP port 8443 or 8080 when SSL is disabled. + +If no specific address has been configured, the web app will bind to ``::``, +which corresponds to all available IPv4 and IPv6 addresses. + +These defaults can be changed via the configuration key facility on a +cluster-wide level (so they apply to all manager instances) as follows: + +.. prompt:: bash $ + + ceph config set mgr mgr/dashboard/server_addr $IP + ceph config set mgr mgr/dashboard/server_port $PORT + ceph config set mgr mgr/dashboard/ssl_server_port $PORT + +Since each ``ceph-mgr`` hosts its own instance of the dashboard, it may be +necessary to configure them separately. The IP address and port for a specific +manager instance can be changed with the following commands: + +.. prompt:: bash $ + + ceph config set mgr mgr/dashboard/$name/server_addr $IP + ceph config set mgr mgr/dashboard/$name/server_port $PORT + ceph config set mgr mgr/dashboard/$name/ssl_server_port $PORT + +Replace ``$name`` with the ID of the ceph-mgr instance hosting the dashboard. + +.. note:: + + The command ``ceph mgr services`` will show you all endpoints that are + currently configured. Look for the ``dashboard`` key to obtain the URL for + accessing the dashboard. + +Username and Password +^^^^^^^^^^^^^^^^^^^^^ + +In order to be able to log in, you need to create a user account and associate +it with at least one role. We provide a set of predefined *system roles* that +you can use. For more details please refer to the `User and Role Management`_ +section. + +To create a user with the administrator role you can use the following +commands: + +.. prompt:: bash $ + + ceph dashboard ac-user-create -i administrator + +Account Lock-out +^^^^^^^^^^^^^^^^ + +It disables a user account if a user repeatedly enters the wrong credentials +for multiple times. It is enabled by default to prevent brute-force or dictionary +attacks. The user can get or set the default number of lock-out attempts using +these commands respectively: + +.. prompt:: bash $ + + ceph dashboard get-account-lockout-attempts + ceph dashboard set-account-lockout-attempts + +.. warning:: + + This feature can be disabled by setting the default number of lock-out attempts to 0. + However, by disabling this feature, the account is more vulnerable to brute-force or + dictionary based attacks. This can be disabled by: + + .. prompt:: bash $ + + ceph dashboard set-account-lockout-attempts 0 + +Enable a Locked User +^^^^^^^^^^^^^^^^^^^^ + +If a user account is disabled as a result of multiple invalid login attempts, then +it needs to be manually enabled by the administrator. This can be done by the following +command: + +.. prompt:: bash $ + + ceph dashboard ac-user-enable + +Accessing the Dashboard +^^^^^^^^^^^^^^^^^^^^^^^ + +You can now access the dashboard using your (JavaScript-enabled) web browser, by +pointing it to any of the host names or IP addresses and the selected TCP port +where a manager instance is running: e.g., ``http(s)://<$IP>:<$PORT>/``. + +The dashboard page displays and requests a previously defined username and +password. + +.. _dashboard-enabling-object-gateway: + +Enabling the Object Gateway Management Frontend +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +When RGW is deployed with cephadm, the RGW credentials used by the +dashboard will be automatically configured. You can also manually force the +credentials to be set up with: + +.. prompt:: bash $ + + ceph dashboard set-rgw-credentials + +This will create an RGW user with uid ``dashboard`` for each realm in +the system. + +If you've configured a custom 'admin' resource in your RGW admin API, you should set it here also: + +.. prompt:: bash $ + + ceph dashboard set-rgw-api-admin-resource + +If you are using a self-signed certificate in your Object Gateway setup, +you should disable certificate verification in the dashboard to avoid refused +connections, e.g. caused by certificates signed by unknown CA or not matching +the host name: + +.. prompt:: bash $ + + ceph dashboard set-rgw-api-ssl-verify False + +If the Object Gateway takes too long to process requests and the dashboard runs +into timeouts, you can set the timeout value to your needs: + +.. prompt:: bash $ + + ceph dashboard set-rest-requests-timeout + +The default value is 45 seconds. + +.. _dashboard-iscsi-management: + +Enabling iSCSI Management +^^^^^^^^^^^^^^^^^^^^^^^^^ + +The Ceph Dashboard can manage iSCSI targets using the REST API provided by the +``rbd-target-api`` service of the :ref:`ceph-iscsi`. Please make sure that it is +installed and enabled on the iSCSI gateways. + +.. note:: + + The iSCSI management functionality of Ceph Dashboard depends on the latest + version 3 of the `ceph-iscsi `_ project. + Make sure that your operating system provides the correct version, otherwise + the dashboard will not enable the management features. + +If the ``ceph-iscsi`` REST API is configured in HTTPS mode and its using a self-signed +certificate, you need to configure the dashboard to avoid SSL certificate +verification when accessing ceph-iscsi API. + +To disable API SSL verification run the following command: + +.. prompt:: bash $ + + ceph dashboard set-iscsi-api-ssl-verification false + +The available iSCSI gateways must be defined using the following commands: + +.. prompt:: bash $ + + ceph dashboard iscsi-gateway-list + # Gateway URL format for a new gateway: ://:@[:port] + ceph dashboard iscsi-gateway-add -i [] + ceph dashboard iscsi-gateway-rm + + +.. _dashboard-grafana: + +Enabling the Embedding of Grafana Dashboards +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +`Grafana`_ pulls data from `Prometheus `_. Although +Grafana can use other data sources, the Grafana dashboards we provide contain +queries that are specific to Prometheus. Our Grafana dashboards therefore +require Prometheus as the data source. The Ceph :ref:`mgr-prometheus` +module exports its data in the Prometheus exposition format. These Grafana +dashboards rely on metric names from the Prometheus module and `Node exporter +`_. The Node exporter is a +separate application that provides machine metrics. + +.. note:: + + Prometheus' security model presumes that untrusted users have access to the + Prometheus HTTP endpoint and logs. Untrusted users have access to all the + (meta)data Prometheus collects that is contained in the database, plus a + variety of operational and debugging information. + + However, Prometheus' HTTP API is limited to read-only operations. + Configurations can *not* be changed using the API and secrets are not + exposed. Moreover, Prometheus has some built-in measures to mitigate the + impact of denial of service attacks. + + Please see `Prometheus' Security model + ` for more detailed + information. + +Installation and Configuration using cephadm +"""""""""""""""""""""""""""""""""""""""""""" + +Grafana and Prometheus can be installed using :ref:`cephadm`. They will +automatically be configured by ``cephadm``. Please see +:ref:`mgr-cephadm-monitoring` documentation for more details on how to use +``cephadm`` for installing and configuring Prometheus and Grafana. + +Manual Installation and Configuration +""""""""""""""""""""""""""""""""""""" + +The following process describes how to configure Grafana and Prometheus +manually. After you have installed Prometheus, Grafana, and the Node exporter +on appropriate hosts, proceed with the following steps. + +#. Enable the Ceph Exporter which comes as Ceph Manager module by running: + + .. prompt:: bash $ + + ceph mgr module enable prometheus + + More details can be found in the documentation of the :ref:`mgr-prometheus`. + +#. Add the corresponding scrape configuration to Prometheus. This may look + like:: + + global: + scrape_interval: 5s + + scrape_configs: + - job_name: 'prometheus' + static_configs: + - targets: ['localhost:9090'] + - job_name: 'ceph' + static_configs: + - targets: ['localhost:9283'] + - job_name: 'node-exporter' + static_configs: + - targets: ['localhost:9100'] + + .. note:: + + Please note that in the above example, Prometheus is configured + to scrape data from itself (port 9090), the Ceph manager module + `prometheus` (port 9283), which exports Ceph internal data, and the Node + Exporter (port 9100), which provides OS and hardware metrics for each host. + + Depending on your configuration, you may need to change the hostname in + or add additional configuration entries for the Node + Exporter. It is unlikely that you will need to change the default TCP ports. + + Moreover, you don't *need* to have more than one target for Ceph specific + data, provided by the `prometheus` mgr module. But it is recommended to + configure Prometheus to scrape Ceph specific data from all existing Ceph + managers. This enables a built-in high availability mechanism, so that + services run on a manager host will be restarted automatically on a different + manager host if one Ceph Manager goes down. + +#. Add Prometheus as data source to Grafana `using the Grafana Web UI `_. + + .. IMPORTANT:: + The data source must be named "Dashboard1". + +#. Install the `vonage-status-panel and grafana-piechart-panel` plugins using: + + .. prompt:: bash $ + + grafana-cli plugins install vonage-status-panel + grafana-cli plugins install grafana-piechart-panel + +#. Add Dashboards to Grafana: + + Dashboards can be added to Grafana by importing dashboard JSON files. + Use the following command to download the JSON files: + + .. prompt:: bash $ + + wget https://raw.githubusercontent.com/ceph/ceph/main/monitoring/ceph-mixin/dashboards_out/.json + + You can find various dashboard JSON files `here `_. + + For Example, for ceph-cluster overview you can use: + + .. prompt:: bash $ + + wget https://raw.githubusercontent.com/ceph/ceph/main/monitoring/ceph-mixin/dashboards_out/ceph-cluster.json + + You may also author your own dashboards. + +#. Configure anonymous mode in ``/etc/grafana/grafana.ini``:: + + [auth.anonymous] + enabled = true + org_name = Main Org. + org_role = Viewer + + In newer versions of Grafana (starting with 6.2.0-beta1) a new setting named + ``allow_embedding`` has been introduced. This setting must be explicitly + set to ``true`` for the Grafana integration in Ceph Dashboard to work, as the + default is ``false``. + + :: + + [security] + allow_embedding = true + +Enabling RBD-Image monitoring +""""""""""""""""""""""""""""" + +Monitoring of RBD images is disabled by default, as it can significantly impact +performance. For more information please see :ref:`prometheus-rbd-io-statistics`. +When disabled, the overview and details dashboards will be empty in Grafana and +metrics will not be visible in Prometheus. + +Configuring Dashboard +""""""""""""""""""""" + +After you have set up Grafana and Prometheus, you will need to configure the +connection information that the Ceph Dashboard will use to access Grafana. + +You need to tell the dashboard on which URL the Grafana instance is +running/deployed: + +.. prompt:: bash $ + + ceph dashboard set-grafana-api-url # default: '' + +The format of url is : `::` + +.. note:: + + The Ceph Dashboard embeds Grafana dashboards via ``iframe`` HTML elements. + If Grafana is configured without SSL/TLS support, most browsers will block the + embedding of insecure content if SSL support is + enabled for the dashboard (which is the default). If you + can't see the embedded Grafana dashboards after enabling them as outlined + above, check your browser's documentation on how to unblock mixed content. + Alternatively, consider enabling SSL/TLS support in Grafana. + +If you are using a self-signed certificate for Grafana, +disable certificate verification in the dashboard to avoid refused connections, +which can be a result of certificates signed by an unknown CA or that do not +match the host name: + +.. prompt:: bash $ + + ceph dashboard set-grafana-api-ssl-verify False + +You can also access Grafana directly to monitor your cluster. + +.. note:: + + Ceph Dashboard configuration information can also be unset. For example, to + clear the Grafana API URL we configured above: + + .. prompt:: bash $ + + ceph dashboard reset-grafana-api-url + +Alternative URL for Browsers +"""""""""""""""""""""""""""" + +The Ceph Dashboard backend requires the Grafana URL to be able to verify the +existence of Grafana Dashboards before the frontend even loads them. Due to the +nature of how Grafana is implemented in Ceph Dashboard, this means that two +working connections are required in order to be able to see Grafana graphs in +Ceph Dashboard: + +- The backend (Ceph Mgr module) needs to verify the existence of the requested + graph. If this request succeeds, it lets the frontend know that it can safely + access Grafana. +- The frontend then requests the Grafana graphs directly from the user's + browser using an iframe. The Grafana instance is accessed directly without any + detour through Ceph Dashboard. + +Now, it might be the case that your environment makes it difficult for the +user's browser to directly access the URL configured in Ceph Dashboard. To solve +this issue, a separate URL can be configured which will solely be used to tell +the frontend (the user's browser) which URL it should use to access Grafana. +This setting won't ever be changed automatically, unlike the GRAFANA_API_URL +which is set by :ref:`cephadm` (only if cephadm is used to deploy monitoring +services). + +To change the URL that is returned to the frontend issue the following command: + +.. prompt:: bash $ + + ceph dashboard set-grafana-frontend-api-url + +If no value is set for that option, it will simply fall back to the value of the +GRAFANA_API_URL option. If set, it will instruct the browser to use this URL to +access Grafana. + +.. _dashboard-sso-support: + +Enabling Single Sign-On (SSO) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The Ceph Dashboard supports external authentication of users via the +`SAML 2.0 `_ protocol. You need to +first create user accounts and associate them with desired roles, as +authorization is performed by the Dashboard. However, the authentication +process can be performed by an existing Identity Provider (IdP). + +.. note:: + + Ceph Dashboard SSO support relies on onelogin's + `python-saml `_ library. + Please ensure that this library is installed on your system, either by using + your distribution's package management or via Python's `pip` installer. + +To configure SSO on Ceph Dashboard, you should use the following command: + +.. prompt:: bash $ + + ceph dashboard sso setup saml2 {} {} {} {} + +Parameters: + +* ****: Base URL where Ceph Dashboard is accessible (e.g., `https://cephdashboard.local`) +* ****: URL to remote (`http://`, `https://`) or local (`file://`) path or content of the IdP metadata XML (e.g., `https://myidp/metadata`, `file:///home/myuser/metadata.xml`). +* **** *(optional)*: Attribute that should be used to get the username from the authentication response. Defaults to `uid`. +* **** *(optional)*: Use this when more than one entity id exists on the IdP metadata. +* ** / ** *(optional)*: File path of the certificate that should be used by Ceph Dashboard (Service Provider) for signing and encryption. + +.. note:: + + The issuer value of SAML requests will follow this pattern: ****/auth/saml2/metadata + +To display the current SAML 2.0 configuration, use the following command: + +.. prompt:: bash $ + + ceph dashboard sso show saml2 + +.. note:: + + For more information about `onelogin_settings`, please check the `onelogin documentation `_. + +To disable SSO: + +.. prompt:: bash $ + + ceph dashboard sso disable + +To check if SSO is enabled: + +.. prompt:: bash $ + + ceph dashboard sso status + +To enable SSO: + +.. prompt:: bash $ + + ceph dashboard sso enable saml2 + +.. _dashboard-alerting: + +Enabling Prometheus Alerting +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +To use Prometheus for alerting you must define `alerting rules +`_. +These are managed by the `Alertmanager +`_. +If you are not yet using the Alertmanager, `install it +`_ as it receives +and manages alerts from Prometheus. + +Alertmanager capabilities can be consumed by the dashboard in three different +ways: + +#. Use the notification receiver of the dashboard. + +#. Use the Prometheus Alertmanager API. + +#. Use both sources simultaneously. + +All three methods notify you about alerts. You won't be notified +twice if you use both sources, but you need to consume at least the Alertmanager API +in order to manage silences. + +1. Use the notification receiver of the dashboard + + This allows you to get notifications as `configured + `_ from the Alertmanager. + You will get notified inside the dashboard once a notification is send out, + but you are not able to manage alerts. + + Add the dashboard receiver and the new route to your Alertmanager + configuration. This should look like:: + + route: + receiver: 'ceph-dashboard' + ... + receivers: + - name: 'ceph-dashboard' + webhook_configs: + - url: '/api/prometheus_receiver' + + + Ensure that the Alertmanager considers your SSL certificate in terms + of the dashboard as valid. For more information about the correct + configuration checkout the ` documentation + `_. + +2. Use the API of Prometheus and the Alertmanager + + This allows you to manage alerts and silences and will enable the "Active + Alerts", "All Alerts" as well as the "Silences" tabs in the "Monitoring" + section of the "Cluster" menu entry. + + Alerts can be sorted by name, job, severity, state and start time. + Unfortunately it's not possible to know when an alert was sent out through a + notification by the Alertmanager based on your configuration, that's why the + dashboard will notify the user on any visible change to an alert and will + notify the changed alert. + + Silences can be sorted by id, creator, status, start, updated and end time. + Silences can be created in various ways, it's also possible to expire them. + + #. Create from scratch + + #. Based on a selected alert + + #. Recreate from expired silence + + #. Update a silence (which will recreate and expire it (default Alertmanager behaviour)) + + To use it, specify the host and port of the Alertmanager server: + + .. prompt:: bash $ + + ceph dashboard set-alertmanager-api-host # default: '' + + For example: + + .. prompt:: bash $ + + ceph dashboard set-alertmanager-api-host 'http://localhost:9093' + + To be able to see all configured alerts, you will need to configure the URL to + the Prometheus API. Using this API, the UI will also help you in verifying + that a new silence will match a corresponding alert. + + + .. prompt:: bash $ + + ceph dashboard set-prometheus-api-host # default: '' + + For example: + + .. prompt:: bash $ + + ceph dashboard set-prometheus-api-host 'http://localhost:9090' + + After setting up the hosts, refresh your browser's dashboard window or tab. + +3. Use both methods + + The behaviors of both methods are configured in a way that they + should not disturb each other, through annoying duplicated notifications + may pop up. + +If you are using a self-signed certificate in your Prometheus or your +Alertmanager setup, you should disable certificate verification in the +dashboard to avoid refused connections caused by certificates signed by +an unknown CA or that do not match the host name. + +- For Prometheus: + +.. prompt:: bash $ + + ceph dashboard set-prometheus-api-ssl-verify False + +- For Alertmanager: + +.. prompt:: bash $ + + ceph dashboard set-alertmanager-api-ssl-verify False + +.. _dashboard-user-role-management: + +User and Role Management +------------------------ + +Password Policy +^^^^^^^^^^^^^^^ + +By default the password policy feature is enabled, which includes the +following checks: + +- Is the password longer than N characters? +- Are the old and new password the same? + +The password policy feature can be switched on or off completely: + +.. prompt:: bash $ + + ceph dashboard set-pwd-policy-enabled + +The following individual checks can also be switched on or off: + +.. prompt:: bash $ + + ceph dashboard set-pwd-policy-check-length-enabled + ceph dashboard set-pwd-policy-check-oldpwd-enabled + ceph dashboard set-pwd-policy-check-username-enabled + ceph dashboard set-pwd-policy-check-exclusion-list-enabled + ceph dashboard set-pwd-policy-check-complexity-enabled + ceph dashboard set-pwd-policy-check-sequential-chars-enabled + ceph dashboard set-pwd-policy-check-repetitive-chars-enabled + +Additionally the following options are available to configure password +policy. + +- Minimum password length (defaults to 8): + +.. prompt:: bash $ + + ceph dashboard set-pwd-policy-min-length + +- Minimum password complexity (defaults to 10): + + .. prompt:: bash $ + + ceph dashboard set-pwd-policy-min-complexity + + Password complexity is calculated by classifying each character in + the password. The complexity count starts by 0. A character is rated by + the following rules in the given order. + + - Increase by 1 if the character is a digit. + - Increase by 1 if the character is a lower case ASCII character. + - Increase by 2 if the character is an upper case ASCII character. + - Increase by 3 if the character is a special character like ``!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~``. + - Increase by 5 if the character has not been classified by one of the previous rules. + +- A list of comma separated words that are not allowed to be used in a + password: + + .. prompt:: bash $ + + ceph dashboard set-pwd-policy-exclusion-list [,...] + + +User Accounts +^^^^^^^^^^^^^ + +The Ceph Dashboard supports multiple user accounts. Each user account +consists of a username, a password (stored in encrypted form using ``bcrypt``), +an optional name, and an optional email address. + +If a new user is created via the Web UI, it is possible to set an option that the +user must assign a new password when they log in for the first time. + +User accounts are stored in the monitors' configuration database, and are +available to all ``ceph-mgr`` instances. + +We provide a set of CLI commands to manage user accounts: + +- *Show User(s)*: + + .. prompt:: bash $ + + ceph dashboard ac-user-show [] + +- *Create User*: + + .. prompt:: bash $ + + ceph dashboard ac-user-create [--enabled] [--force-password] [--pwd_update_required] -i [] [] [] [] + + To bypass password policy checks use the `force-password` option. + Add the option `pwd_update_required` so that a newly created user has + to change their password after the first login. + +- *Delete User*: + + .. prompt:: bash $ + + ceph dashboard ac-user-delete + +- *Change Password*: + + .. prompt:: bash $ + + ceph dashboard ac-user-set-password [--force-password] -i + +- *Change Password Hash*: + + .. prompt:: bash $ + + ceph dashboard ac-user-set-password-hash -i + + The hash must be a bcrypt hash and salt, e.g. ``$2b$12$Pt3Vq/rDt2y9glTPSV.VFegiLkQeIpddtkhoFetNApYmIJOY8gau2``. + This can be used to import users from an external database. + +- *Modify User (name, and email)*: + + .. prompt:: bash $ + + ceph dashboard ac-user-set-info + +- *Disable User*: + + .. prompt:: bash $ + + ceph dashboard ac-user-disable + +- *Enable User*: + + .. prompt:: bash $ + + ceph dashboard ac-user-enable + +User Roles and Permissions +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +User accounts are associated with a set of roles that define which +dashboard functionality can be accessed. + +The Dashboard functionality/modules are grouped within a *security scope*. +Security scopes are predefined and static. The current available security +scopes are: + +- **hosts**: includes all features related to the ``Hosts`` menu + entry. +- **config-opt**: includes all features related to management of Ceph + configuration options. +- **pool**: includes all features related to pool management. +- **osd**: includes all features related to OSD management. +- **monitor**: includes all features related to monitor management. +- **rbd-image**: includes all features related to RBD image + management. +- **rbd-mirroring**: includes all features related to RBD mirroring + management. +- **iscsi**: includes all features related to iSCSI management. +- **rgw**: includes all features related to RADOS Gateway (RGW) management. +- **cephfs**: includes all features related to CephFS management. +- **nfs-ganesha**: includes all features related to NFS Ganesha management. +- **manager**: include all features related to Ceph Manager + management. +- **log**: include all features related to Ceph logs management. +- **grafana**: include all features related to Grafana proxy. +- **prometheus**: include all features related to Prometheus alert management. +- **dashboard-settings**: allows to change dashboard settings. + +A *role* specifies a set of mappings between a *security scope* and a set of +*permissions*. There are four types of permissions: + +- **read** +- **create** +- **update** +- **delete** + +See below for an example of a role specification, in the form of a Python dictionary:: + + # example of a role + { + 'role': 'my_new_role', + 'description': 'My new role', + 'scopes_permissions': { + 'pool': ['read', 'create'], + 'rbd-image': ['read', 'create', 'update', 'delete'] + } + } + +The above role dictates that a user has *read* and *create* permissions for +features related to pool management, and has full permissions for +features related to RBD image management. + +The Dashboard provides a set of predefined roles that we call +*system roles*, which can be used right away by a fresh Ceph Dashboard +installation. + +The list of system roles are: + +- **administrator**: allows full permissions for all security scopes. +- **read-only**: allows *read* permission for all security scopes except + dashboard settings. +- **block-manager**: allows full permissions for *rbd-image*, + *rbd-mirroring*, and *iscsi* scopes. +- **rgw-manager**: allows full permissions for the *rgw* scope +- **cluster-manager**: allows full permissions for the *hosts*, *osd*, + *monitor*, *manager*, and *config-opt* scopes. +- **pool-manager**: allows full permissions for the *pool* scope. +- **cephfs-manager**: allows full permissions for the *cephfs* scope. + +The list of available roles can be retrieved with the following command: + +.. prompt:: bash $ + + ceph dashboard ac-role-show [] + +You can also use the CLI to create new roles. The available commands are the +following: + +- *Create Role*: + + .. prompt:: bash $ + + ceph dashboard ac-role-create [] + +- *Delete Role*: + + .. prompt:: bash $ + + ceph dashboard ac-role-delete + +- *Add Scope Permissions to Role*: + + .. prompt:: bash $ + + ceph dashboard ac-role-add-scope-perms [...] + +- *Delete Scope Permission from Role*: + + .. prompt:: bash $ + + ceph dashboard ac-role-del-scope-perms + +To assign roles to users, the following commands are available: + +- *Set User Roles*: + + .. prompt:: bash $ + + ceph dashboard ac-user-set-roles [...] + +- *Add Roles To User*: + + .. prompt:: bash $ + + ceph dashboard ac-user-add-roles [...] + +- *Delete Roles from User*: + + .. prompt:: bash $ + + ceph dashboard ac-user-del-roles [...] + + +Example of User and Custom Role Creation +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +In this section we show a complete example of the commands that +create a user account that can manage RBD images, view and create Ceph pools, +and has read-only access to other scopes. + +1. *Create the user*: + + .. prompt:: bash $ + + ceph dashboard ac-user-create bob -i + +2. *Create role and specify scope permissions*: + + .. prompt:: bash $ + + ceph dashboard ac-role-create rbd/pool-manager + ceph dashboard ac-role-add-scope-perms rbd/pool-manager rbd-image read create update delete + ceph dashboard ac-role-add-scope-perms rbd/pool-manager pool read create + +3. *Associate roles to user*: + + .. prompt:: bash $ + + ceph dashboard ac-user-set-roles bob rbd/pool-manager read-only + +.. _dashboard-proxy-configuration: + +Proxy Configuration +------------------- + +In a Ceph cluster with multiple ``ceph-mgr`` instances, only the dashboard +running on the currently active ``ceph-mgr`` daemon will serve incoming requests. +Connections to the dashboard's TCP port on standby ``ceph-mgr`` instances +will receive an HTTP redirect (303) to the active manager's dashboard URL. +This enables you to point your browser to any ``ceph-mgr`` instance in +order to access the dashboard. + +If you want to establish a fixed URL to reach the dashboard or if you don't want +to allow direct connections to the manager nodes, you could set up a proxy that +automatically forwards incoming requests to the active ``ceph-mgr`` +instance. + +Configuring a URL Prefix +^^^^^^^^^^^^^^^^^^^^^^^^ + +If you are accessing the dashboard via a reverse proxy, +you may wish to service it under a URL prefix. To get the dashboard +to use hyperlinks that include your prefix, you can set the +``url_prefix`` setting: + +.. prompt:: bash $ + + ceph config set mgr mgr/dashboard/url_prefix $PREFIX + +so you can access the dashboard at ``http://$IP:$PORT/$PREFIX/``. + +Disable the redirection +^^^^^^^^^^^^^^^^^^^^^^^ + +If the dashboard is behind a load-balancing proxy like `HAProxy `_ +you might want to disable redirection to prevent situations in which +internal (unresolvable) URLs are published to the frontend client. Use the +following command to get the dashboard to respond with an HTTP error (500 by default) +instead of redirecting to the active dashboard: + +.. prompt:: bash $ + + ceph config set mgr mgr/dashboard/standby_behaviour "error" + +To reset the setting to default redirection, use the following command: + +.. prompt:: bash $ + + ceph config set mgr mgr/dashboard/standby_behaviour "redirect" + +Configure the error status code +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +When redirection is disabled, you may want to customize the HTTP status +code of standby dashboards. To do so you need to run the command: + +.. prompt:: bash $ + + ceph config set mgr mgr/dashboard/standby_error_status_code 503 + +Resolve IP address to hostname before redirect +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The redirect from a standby to the active dashboard is done via the IP +address. This is done because resolving IP addresses to hostnames can be error +prone in containerized environments. It is also the reason why the option is +disabled by default. +However, in some situations it might be helpful to redirect via the hostname. +For example if the configured TLS certificate matches only the hostnames. To +activate the redirection via the hostname run the following command:: + + $ ceph config set mgr mgr/dashboard/redirect_resolve_ip_addr True + +You can disable it again by:: + + $ ceph config set mgr mgr/dashboard/redirect_resolve_ip_addr False + +HAProxy example configuration +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Below you will find an example configuration for SSL/TLS passthrough using +`HAProxy `_. + +Please note that this configuration works under the following conditions. +If the dashboard fails over, the front-end client might receive a HTTP redirect +(303) response and will be redirected to an unresolvable host. This happens when +failover occurs between two HAProxy health checks. In this situation the +previously active dashboard node will now respond with a 303 which points to +the new active node. To prevent that situation you should consider disabling +redirection on standby nodes. + +:: + + defaults + log global + option log-health-checks + timeout connect 5s + timeout client 50s + timeout server 450s + + frontend dashboard_front + mode http + bind *:80 + option httplog + redirect scheme https code 301 if !{ ssl_fc } + + frontend dashboard_front_ssl + mode tcp + bind *:443 + option tcplog + default_backend dashboard_back_ssl + + backend dashboard_back_ssl + mode tcp + option httpchk GET / + http-check expect status 200 + server x : ssl check verify none + server y : ssl check verify none + server z : ssl check verify none + +.. _dashboard-auditing: + +Auditing API Requests +--------------------- + +The REST API can log PUT, POST and DELETE requests to the Ceph +audit log. This feature is disabled by default, but can be enabled with the +following command: + +.. prompt:: bash $ + + ceph dashboard set-audit-api-enabled + +If enabled, the following parameters are logged per each request: + +* from - The origin of the request, e.g. https://[::1]:44410 +* path - The REST API path, e.g. /api/auth +* method - e.g. PUT, POST or DELETE +* user - The name of the user, otherwise 'None' + +The logging of the request payload (the arguments and their values) is enabled +by default. Execute the following command to disable this behaviour: + +.. prompt:: bash $ + + ceph dashboard set-audit-api-log-payload + +A log entry may look like this:: + + 2018-10-22 15:27:01.302514 mgr.x [INF] [DASHBOARD] from='https://[::ffff:127.0.0.1]:37022' path='/api/rgw/user/klaus' method='PUT' user='admin' params='{"max_buckets": "1000", "display_name": "Klaus Mustermann", "uid": "klaus", "suspended": "0", "email": "klaus.mustermann@ceph.com"}' + +.. _dashboard-nfs-ganesha-management: + +NFS-Ganesha Management +---------------------- + +The dashboard requires enabling the NFS module which will be used to manage +NFS clusters and NFS exports. For more information check :ref:`mgr-nfs`. + +Plug-ins +-------- + +Plug-ins extend the functionality of the Ceph Dashboard in a modular +and loosely coupled fashion. + +.. _Grafana: https://grafana.com/ + +.. include:: dashboard_plugins/feature_toggles.inc.rst +.. include:: dashboard_plugins/debug.inc.rst +.. include:: dashboard_plugins/motd.inc.rst + + +Troubleshooting the Dashboard +----------------------------- + +Locating the Dashboard +^^^^^^^^^^^^^^^^^^^^^^ + +If you are unsure of the location of the Ceph Dashboard, run the following command: + +.. prompt:: bash $ + + ceph mgr services | jq .dashboard + +:: + + "https://host:port" + +The command returns the URL where the Ceph Dashboard is located: ``https://:/`` + +.. note:: + + Many Ceph tools return results in JSON format. We suggest that + you install the `jq `_ command-line + utility to faciliate working with JSON data. + + +Accessing the Dashboard +^^^^^^^^^^^^^^^^^^^^^^^ + +If you are unable to access the Ceph Dashboard, run the following +commands: + +#. Verify the Ceph Dashboard module is enabled: + + .. prompt:: bash $ + + ceph mgr module ls | jq .enabled_modules + + Ensure the Ceph Dashboard module is listed in the return value of the + command. Example snipped output from the command above:: + + [ + "dashboard", + "iostat", + "restful" + ] + +#. If it is not listed, activate the module with the following command: + + .. prompt:: bash $ + + ceph mgr module enable dashboard + +#. Check the Ceph Dashboard and/or ``ceph-mgr`` log files for any errors. + + * Check if ``ceph-mgr`` log messages are written to a file by: + + .. prompt:: bash $ + + ceph config get mgr log_to_file + + :: + + true + + * Get the location of the log file (it's ``/var/log/ceph/-.log`` + by default): + + .. prompt:: bash $ + + ceph config get mgr log_file + + :: + + /var/log/ceph/$cluster-$name.log + +#. Ensure the SSL/TSL support is configured properly: + + * Check if the SSL/TSL support is enabled: + + .. prompt:: bash $ + + ceph config get mgr mgr/dashboard/ssl + + * If the command returns ``true``, verify a certificate exists by: + + .. prompt:: bash $ + + ceph config-key get mgr/dashboard/crt + + and: + + .. prompt:: bash $ + + ceph config-key get mgr/dashboard/key + + * If it doesn't return ``true``, run the following command to generate a self-signed + certificate or follow the instructions outlined in + :ref:`dashboard-ssl-tls-support`: + + .. prompt:: bash $ + + ceph dashboard create-self-signed-cert + + +Trouble Logging into the Dashboard +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +If you are unable to log into the Ceph Dashboard and you receive the following +error, run through the procedural checks below: + +.. image:: ../images/dashboard/invalid-credentials.png + :align: center + +#. Check that your user credentials are correct. If you are seeing the + notification message above when trying to log into the Ceph Dashboard, it + is likely you are using the wrong credentials. Double check your username + and password, and ensure that your keyboard's caps lock is not enabled by accident. + +#. If your user credentials are correct, but you are experiencing the same + error, check that the user account exists: + + .. prompt:: bash $ + + ceph dashboard ac-user-show + + This command returns your user data. If the user does not exist, it will + print:: + + Error ENOENT: User does not exist + +#. Check if the user is enabled: + + .. prompt:: bash $ + + ceph dashboard ac-user-show | jq .enabled + + :: + + true + + Check if ``enabled`` is set to ``true`` for your user. If not the user is + not enabled, run: + + .. prompt:: bash $ + + ceph dashboard ac-user-enable + +Please see :ref:`dashboard-user-role-management` for more information. + + +A Dashboard Feature is Not Working +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +When an error occurs on the backend, you will usually receive an error +notification on the frontend. Run through the following scenarios to debug. + +#. Check the Ceph Dashboard and ``ceph-mgr`` logfile(s) for any errors. These can + found by searching for keywords, such as *500 Internal Server Error*, + followed by ``traceback``. The end of a traceback contains more details about + what exact error occurred. +#. Check your web browser's Javascript Console for any errors. + + +Ceph Dashboard Logs +^^^^^^^^^^^^^^^^^^^ + +Dashboard Debug Flag +"""""""""""""""""""" + +With this flag enabled, error traceback is included in backend responses. + +To enable this flag via the Ceph Dashboard, navigate from *Cluster* to *Manager +modules*. Select *Dashboard module* and click the edit button. Click the +*debug* checkbox and update. + +To enable it via the CLI, run the following command: + +.. prompt:: bash $ + + ceph dashboard debug enable + + +Setting Logging Level of Dashboard Module +""""""""""""""""""""""""""""""""""""""""" + +Setting the logging level to debug makes the log more verbose and helpful for +debugging. + +#. Increase the logging level of manager daemons: + + .. prompt:: bash $ + + ceph tell mgr config set debug_mgr 20 + +#. Adjust the logging level of the Ceph Dashboard module via the Dashboard or + CLI: + + * Navigate from *Cluster* to *Manager modules*. Select *Dashboard module* + and click the edit button. Modify the ``log_level`` configuration. + * To adjust it via the CLI, run the following command: + + .. prompt:: bash $ + + bin/ceph config set mgr mgr/dashboard/log_level debug + +3. High log levels can result in considerable log volume, which can +easily fill up your filesystem. Set a calendar reminder for an hour, a day, +or a week in the future to revert this temporary logging increase. This looks +something like this: + + .. prompt:: bash $ + + ceph config log + + :: + + ... + --- 11 --- 2020-11-07 11:11:11.960659 --- mgr.x/dashboard/log_level = debug --- + ... + + .. prompt:: bash $ + + ceph config reset 11 + +.. _centralized-logging: + + +Reporting issues from Dashboard +""""""""""""""""""""""""""""""" + +Ceph-Dashboard provides two ways to create an issue in the Ceph Issue Tracker, +either using the Ceph command line interface or by using the Ceph Dashboard +user interface. + +To create an issue in the Ceph Issue Tracker, a user needs to have an account +on the issue tracker. Under the ``my account`` tab in the Ceph Issue Tracker, +the user can see their API access key. This key is used for authentication +when creating a new issue. To store the Ceph API access key, in the CLI run: + +.. prompt:: bash $ + + ``ceph dashboard set-issue-tracker-api-key -i `` + +Then on successful update, you can create an issue using: + +.. prompt:: bash $ + + ``ceph dashboard create issue `` + +The available projects to create an issue on are: +#. dashboard +#. block +#. object +#. file_system +#. ceph_manager +#. orchestrator +#. ceph_volume +#. core_ceph + +The available tracker types are: +#. bug +#. feature + +The subject and description are then set by the user. + +The user can also create an issue using the Dashboard user interface. The settings +icon drop down menu on the top right of the navigation bar has the option to +``Raise an issue``. On clicking it, a modal dialog opens that has the option to +select the project and tracker from their respective drop down menus. The subject +and multiline description are added by the user. The user can then submit the issue. diff --git a/doc/mgr/dashboard_plugins/debug.inc.rst b/doc/mgr/dashboard_plugins/debug.inc.rst new file mode 100644 index 000000000..883419cbf --- /dev/null +++ b/doc/mgr/dashboard_plugins/debug.inc.rst @@ -0,0 +1,43 @@ +.. _dashboard-debug: + +Debug +^^^^^ + +This plugin allows to customize the behaviour of the dashboard according to the +debug mode. It can be enabled, disabled or checked with the following command: + +.. prompt:: bash $ + + ceph dashboard debug status + +:: + + Debug: 'disabled' + +.. prompt:: bash $ + + ceph dashboard debug enable + +:: + + Debug: 'enabled' + +.. prompt:: bash $ + + ceph dashboard debug disable + +:: + + Debug: 'disabled' + +By default, it's disabled. This is the recommended setting for production +deployments. If required, debug mode can be enabled without need of restarting. +Currently, disabled debug mode equals to CherryPy ``production`` environment, +while when enabled, it uses ``test_suite`` defaults (please refer to +`CherryPy Environments +`_ for more +details). + +It also adds request uuid (``unique_id``) to Cherrypy on versions that don't +support this. It additionally prints the ``unique_id`` to error responses and +log messages. diff --git a/doc/mgr/dashboard_plugins/feature_toggles.inc.rst b/doc/mgr/dashboard_plugins/feature_toggles.inc.rst new file mode 100644 index 000000000..7c96b0faa --- /dev/null +++ b/doc/mgr/dashboard_plugins/feature_toggles.inc.rst @@ -0,0 +1,56 @@ +.. _dashboard-feature-toggles: + +Feature Toggles +^^^^^^^^^^^^^^^ + +This plug-in allows to enable or disable some features from the Ceph Dashboard +on-demand. When a feature becomes disabled: + +- Its front-end elements (web pages, menu entries, charts, etc.) will become hidden. +- Its associated REST API endpoints will reject any further requests (404, Not Found Error). + +The main purpose of this plug-in is to allow ad-hoc customizations of the workflows exposed +by the dashboard. Additionally, it could allow for dynamically enabling experimental +features with minimal configuration burden and no service impact. + +The list of features that can be enabled/disabled is: + +- **Block (RBD)**: + - Image Management: ``rbd`` + - Mirroring: ``mirroring`` + - iSCSI: ``iscsi`` +- **Filesystem (Cephfs)**: ``cephfs`` +- **Objects (RGW)**: ``rgw`` (including daemon, user and bucket management). +- **NFS**: ``nfs-ganesha`` exports. + +By default all features come enabled. + +To retrieve a list of features and their current statuses: + +.. prompt:: bash $ + + ceph dashboard feature status + +:: + + Feature 'cephfs': 'enabled' + Feature 'iscsi': 'enabled' + Feature 'mirroring': 'enabled' + Feature 'rbd': 'enabled' + Feature 'rgw': 'enabled' + Feature 'nfs': 'enabled' + +To enable or disable the status of a single or multiple features: + +.. prompt:: bash $ + + ceph dashboard feature disable iscsi mirroring + +:: + + Feature 'iscsi': disabled + Feature 'mirroring': disabled + +After a feature status has changed, the API REST endpoints immediately respond to +that change, while for the front-end UI elements, it may take up to 20 seconds to +reflect it. diff --git a/doc/mgr/dashboard_plugins/motd.inc.rst b/doc/mgr/dashboard_plugins/motd.inc.rst new file mode 100644 index 000000000..0f9cc199a --- /dev/null +++ b/doc/mgr/dashboard_plugins/motd.inc.rst @@ -0,0 +1,36 @@ +.. _dashboard-motd: + +Message of the day (MOTD) +^^^^^^^^^^^^^^^^^^^^^^^^^ + +Displays a configured `message of the day` at the top of the Ceph Dashboard. + +The importance of a MOTD can be configured by its severity, which is +`info`, `warning` or `danger`. The MOTD can expire after a given time, +this means it will not be displayed in the UI anymore. Use the following +syntax to specify the expiration time: `Ns|m|h|d|w` for seconds, minutes, +hours, days and weeks. If the MOTD should expire after 2 hours, use `2h` +or `5w` for 5 weeks. Use `0` to configure a MOTD that does not expire. + +To configure a MOTD, run the following command: + +.. prompt:: bash $ + + ceph dashboard motd set + +To show the configured MOTD: + +.. prompt:: bash $ + + ceph dashboard motd get + +To clear the configured MOTD run: + +.. prompt:: bash $ + + ceph dashboard motd clear + +A MOTD with a `info` or `warning` severity can be closed by the user. The +`info` MOTD is not displayed anymore until the local storage cookies are +cleared or a new MOTD with a different severity is displayed. A MOTD with +a 'warning' severity will be displayed again in a new session. diff --git a/doc/mgr/diskprediction.rst b/doc/mgr/diskprediction.rst new file mode 100644 index 000000000..af34a037c --- /dev/null +++ b/doc/mgr/diskprediction.rst @@ -0,0 +1,59 @@ +.. _diskprediction: + +===================== +Diskprediction Module +===================== + +The *diskprediction* module leverages Ceph device health check to collect disk health metrics and uses internal predictor module to produce the disk failure prediction and returns back to Ceph. It doesn't require any external server for data analysis and output results. Its internal predictor's accuracy is around 70%. + +Enabling +======== + +Run the following command to enable the *diskprediction_local* module in the Ceph +environment:: + + ceph mgr module enable diskprediction_local + + +To enable the local predictor:: + + ceph config set global device_failure_prediction_mode local + +To disable prediction,:: + + ceph config set global device_failure_prediction_mode none + + +*diskprediction_local* requires at least six datasets of device health metrics to +make prediction of the devices' life expentancy. And these health metrics are +collected only if health monitoring is :ref:`enabled `. + +Run the following command to retrieve the life expectancy of given device. + +:: + + ceph device predict-life-expectancy + +Configuration +============= + +The module performs the prediction on a daily basis by default. You can adjust +this interval with:: + + ceph config set mgr mgr/diskprediction_local/predict_interval + +Debugging +========= + +If you want to debug the DiskPrediction module mapping to Ceph logging level, +use the following command. + +:: + + [mgr] + + debug mgr = 20 + +With logging set to debug for the manager the module will print out logging +message with prefix *mgr[diskprediction]* for easy filtering. + diff --git a/doc/mgr/hello.rst b/doc/mgr/hello.rst new file mode 100644 index 000000000..725355fc9 --- /dev/null +++ b/doc/mgr/hello.rst @@ -0,0 +1,39 @@ +Hello World Module +================== + +This is a simple module skeleton for documentation purposes. + +Enabling +-------- + +The *hello* module is enabled with:: + + ceph mgr module enable hello + +To check that it is enabled, run:: + + ceph mgr module ls + +After editing the module file (found in ``src/pybind/mgr/hello/module.py``), you can see changes by running:: + + ceph mgr module disable hello + ceph mgr module enable hello + +or:: + + init-ceph restart mgr + +To execute the module, run:: + + ceph hello + +The log is found at:: + + build/out/mgr.x.log + + +Documenting +----------- + +After adding a new mgr module, be sure to add its documentation to ``doc/mgr/module_name.rst``. +Also, add a link to your new module into ``doc/mgr/index.rst``. diff --git a/doc/mgr/index.rst b/doc/mgr/index.rst new file mode 100644 index 000000000..66fa19f86 --- /dev/null +++ b/doc/mgr/index.rst @@ -0,0 +1,50 @@ +.. _ceph-manager-daemon: + +=================== +Ceph Manager Daemon +=================== + +The :term:`Ceph Manager` daemon (ceph-mgr) runs alongside monitor daemons, +to provide additional monitoring and interfaces to external monitoring +and management systems. + +Since the 12.x (*luminous*) Ceph release, the ceph-mgr daemon is required for +normal operations. The ceph-mgr daemon is an optional component in +the 11.x (*kraken*) Ceph release. + +By default, the manager daemon requires no additional configuration, beyond +ensuring it is running. If there is no mgr daemon running, you will +see a health warning to that effect, and some of the other information +in the output of `ceph status` will be missing or stale until a mgr is started. + +Use your normal deployment tools, such as ceph-ansible or cephadm, to +set up ceph-mgr daemons on each of your mon nodes. It is not mandatory +to place mgr daemons on the same nodes as mons, but it is almost always +sensible. + +.. toctree:: + :maxdepth: 1 + + Installation and Configuration + Writing modules + Writing orchestrator plugins + Dashboard module + Ceph RESTful API + Alerts module + DiskPrediction module + Local pool module + RESTful module + Zabbix module + Prometheus module + Influx module + Hello module + Telegraf module + Telemetry module + Iostat module + Crash module + Insights module + Orchestrator module + Rook module + MDS Autoscaler module + NFS module + CLI API Commands module diff --git a/doc/mgr/influx.rst b/doc/mgr/influx.rst new file mode 100644 index 000000000..9a770530a --- /dev/null +++ b/doc/mgr/influx.rst @@ -0,0 +1,165 @@ +============= +Influx Module +============= + +The influx module continuously collects and sends time series data to an +influxdb database. + +The influx module was introduced in the 13.x *Mimic* release. + +-------- +Enabling +-------- + +To enable the module, use the following command: + +:: + + ceph mgr module enable influx + +If you wish to subsequently disable the module, you can use the equivalent +*disable* command: + +:: + + ceph mgr module disable influx + +------------- +Configuration +------------- + +For the influx module to send statistics to an InfluxDB server, it +is necessary to configure the servers address and some authentication +credentials. + +Set configuration values using the following command: + +:: + + ceph config set mgr mgr/influx/ + + +The most important settings are ``hostname``, ``username`` and ``password``. +For example, a typical configuration might look like this: + +:: + + ceph config set mgr mgr/influx/hostname influx.mydomain.com + ceph config set mgr mgr/influx/username admin123 + ceph config set mgr mgr/influx/password p4ssw0rd + +Additional optional configuration settings are: + +:interval: Time between reports to InfluxDB. Default 30 seconds. +:database: InfluxDB database name. Default "ceph". You will need to create this database and grant write privileges to the configured username or the username must have admin privileges to create it. +:port: InfluxDB server port. Default 8086 +:ssl: Use https connection for InfluxDB server. Use "true" or "false". Default false +:verify_ssl: Verify https cert for InfluxDB server. Use "true" or "false". Default true +:threads: How many worker threads should be spawned for sending data to InfluxDB. Default is 5 +:batch_size: How big batches of data points should be when sending to InfluxDB. Default is 5000 + +--------- +Debugging +--------- + +By default, a few debugging statements as well as error statements have been set to print in the log files. Users can add more if necessary. +To make use of the debugging option in the module: + +- Add this to the ceph.conf file.:: + + [mgr] + debug_mgr = 20 + +- Use this command ``ceph influx self-test``. +- Check the log files. Users may find it easier to filter the log files using *mgr[influx]*. + +-------------------- +Interesting counters +-------------------- + +The following tables describe a subset of the values output by +this module. + +^^^^^ +Pools +^^^^^ + ++---------------+-----------------------------------------------------+ +|Counter | Description | ++===============+=====================================================+ +|stored | Bytes stored in the pool not including copies | ++---------------+-----------------------------------------------------+ +|max_avail | Max available number of bytes in the pool | ++---------------+-----------------------------------------------------+ +|objects | Number of objects in the pool | ++---------------+-----------------------------------------------------+ +|wr_bytes | Number of bytes written in the pool | ++---------------+-----------------------------------------------------+ +|dirty | Number of bytes dirty in the pool | ++---------------+-----------------------------------------------------+ +|rd_bytes | Number of bytes read in the pool | ++---------------+-----------------------------------------------------+ +|stored_raw | Bytes used in pool including copies made | ++---------------+-----------------------------------------------------+ + +^^^^ +OSDs +^^^^ + ++------------+------------------------------------+ +|Counter | Description | ++============+====================================+ +|op_w | Client write operations | ++------------+------------------------------------+ +|op_in_bytes | Client operations total write size | ++------------+------------------------------------+ +|op_r | Client read operations | ++------------+------------------------------------+ +|op_out_bytes| Client operations total read size | ++------------+------------------------------------+ + + ++------------------------+--------------------------------------------------------------------------+ +|Counter | Description | ++========================+==========================================================================+ +|op_wip | Replication operations currently being processed (primary) | ++------------------------+--------------------------------------------------------------------------+ +|op_latency | Latency of client operations (including queue time) | ++------------------------+--------------------------------------------------------------------------+ +|op_process_latency | Latency of client operations (excluding queue time) | ++------------------------+--------------------------------------------------------------------------+ +|op_prepare_latency | Latency of client operations (excluding queue time and wait for finished)| ++------------------------+--------------------------------------------------------------------------+ +|op_r_latency | Latency of read operation (including queue time) | ++------------------------+--------------------------------------------------------------------------+ +|op_r_process_latency | Latency of read operation (excluding queue time) | ++------------------------+--------------------------------------------------------------------------+ +|op_w_in_bytes | Client data written | ++------------------------+--------------------------------------------------------------------------+ +|op_w_latency | Latency of write operation (including queue time) | ++------------------------+--------------------------------------------------------------------------+ +|op_w_process_latency | Latency of write operation (excluding queue time) | ++------------------------+--------------------------------------------------------------------------+ +|op_w_prepare_latency | Latency of write operations (excluding queue time and wait for finished) | ++------------------------+--------------------------------------------------------------------------+ +|op_rw | Client read-modify-write operations | ++------------------------+--------------------------------------------------------------------------+ +|op_rw_in_bytes | Client read-modify-write operations write in | ++------------------------+--------------------------------------------------------------------------+ +|op_rw_out_bytes | Client read-modify-write operations read out | ++------------------------+--------------------------------------------------------------------------+ +|op_rw_latency | Latency of read-modify-write operation (including queue time) | ++------------------------+--------------------------------------------------------------------------+ +|op_rw_process_latency | Latency of read-modify-write operation (excluding queue time) | ++------------------------+--------------------------------------------------------------------------+ +|op_rw_prepare_latency | Latency of read-modify-write operations (excluding queue time | +| | and wait for finished) | ++------------------------+--------------------------------------------------------------------------+ +|op_before_queue_op_lat | Latency of IO before calling queue (before really queue into ShardedOpWq)| +| | op_before_dequeue_op_lat | ++------------------------+--------------------------------------------------------------------------+ +|op_before_dequeue_op_lat| Latency of IO before calling dequeue_op(already dequeued and get PG lock)| ++------------------------+--------------------------------------------------------------------------+ + +Latency counters are measured in microseconds unless otherwise specified in the description. + diff --git a/doc/mgr/insights.rst b/doc/mgr/insights.rst new file mode 100644 index 000000000..37b8903f1 --- /dev/null +++ b/doc/mgr/insights.rst @@ -0,0 +1,52 @@ +Insights Module +=============== + +The insights module collects and exposes system information to the Insights Core +data analysis framework. It is intended to replace explicit interrogation of +Ceph CLIs and daemon admin sockets, reducing the API surface that Insights +depends on. The insights reports contains the following: + +* **Health reports**. In addition to reporting the current health of the + cluster, the insights module reports a summary of the last 24 hours of health + checks. This feature is important for catching cluster health issues that are + transient and may not be present at the moment the report is generated. Health + checks are deduplicated to avoid unbounded data growth. + +* **Crash reports**. A summary of any daemon crashes in the past 24 hours is + included in the insights report. Crashes are reported as the number of crashes + per daemon type (e.g. `ceph-osd`) within the time window. Full details of a + crash may be obtained using the `crash module`_. + +* Software version, storage utilization, cluster maps, placement group summary, + monitor status, cluster configuration, and OSD metadata. + +Enabling +-------- + +The *insights* module is enabled with:: + + ceph mgr module enable insights + +Commands +-------- +:: + + ceph insights + +Generate the full report. + +:: + + ceph insights prune-health + +Remove historical health data older than . Passing `0` for will +clear all health data. + +This command is useful for cleaning the health history before automated nightly +reports are generated, which may contain spurious health checks accumulated +while performing system maintenance, or other health checks that have been +resolved. There is no need to prune health data to reclaim storage space; +garbage collection is performed regularly to remove old health data from +persistent storage. + +.. _crash module: ../crash diff --git a/doc/mgr/iostat.rst b/doc/mgr/iostat.rst new file mode 100644 index 000000000..f9f849383 --- /dev/null +++ b/doc/mgr/iostat.rst @@ -0,0 +1,32 @@ +.. _mgr-iostat-overview: + +iostat +====== + +This module shows the current throughput and IOPS done on the Ceph cluster. + +Enabling +-------- + +To check if the *iostat* module is enabled, run:: + + ceph mgr module ls + +The module can be enabled with:: + + ceph mgr module enable iostat + +To execute the module, run:: + + ceph iostat + +To change the frequency at which the statistics are printed, use the ``-p`` +option:: + + ceph iostat -p + +For example, use the following command to print the statistics every 5 seconds:: + + ceph iostat -p 5 + +To stop the module, press Ctrl-C. diff --git a/doc/mgr/localpool.rst b/doc/mgr/localpool.rst new file mode 100644 index 000000000..fe8bd3942 --- /dev/null +++ b/doc/mgr/localpool.rst @@ -0,0 +1,37 @@ +Local Pool Module +================= + +The *localpool* module can automatically create RADOS pools that are +localized to a subset of the overall cluster. For example, by default, it will +create a pool for each distinct ``rack`` in the cluster. This can be useful for +deployments where it is desirable to distribute some data locally and other data +globally across the cluster. One use-case is measuring performance and testing +behavior of specific drive, NIC, or chassis models in isolation. + +Enabling +-------- + +The *localpool* module is enabled with:: + + ceph mgr module enable localpool + +Configuring +----------- + +The *localpool* module understands the following options: + +* **subtree** (default: `rack`): which CRUSH subtree type the module + should create a pool for. +* **failure_domain** (default: `host`): what failure domain we should + separate data replicas across. +* **pg_num** (default: `128`): number of PGs to create for each pool +* **num_rep** (default: `3`): number of replicas for each pool. + (Currently, pools are always replicated.) +* **min_size** (default: none): value to set min_size to (unchanged from Ceph's default if this option is not set) +* **prefix** (default: `by-$subtreetype-`): prefix for the pool name. + +These options are set via the config-key interface. For example, to +change the replication level to 2x with only 64 PGs, :: + + ceph config set mgr mgr/localpool/num_rep 2 + ceph config set mgr mgr/localpool/pg_num 64 diff --git a/doc/mgr/mds_autoscaler.rst b/doc/mgr/mds_autoscaler.rst new file mode 100644 index 000000000..46fc44155 --- /dev/null +++ b/doc/mgr/mds_autoscaler.rst @@ -0,0 +1,23 @@ +MDS Autoscaler Module +===================== + +The MDS Autoscaler Module monitors file systems to ensure sufficient MDS +daemons are available. It works by adjusting the placement specification for +the orchestrator backend of the MDS service. To enable, use: + +.. sh: + + ceph mgr module enable mds_autoscaler + +The module will monitor the following file system settings to inform +placement count adjustments: + +- ``max_mds`` file system setting +- ``standby_count_wanted`` file system setting + +The Ceph monitor daemons are still responsible for promoting or stopping MDS +according to these settings. The ``mds_autoscaler`` simply adjusts the +number of MDS which are spawned by the orchestrator. + +.. note: There is no CLI or module configurations as of now. Enable or disable + the module to turn on or off. diff --git a/doc/mgr/modules.rst b/doc/mgr/modules.rst new file mode 100644 index 000000000..8979b4e6a --- /dev/null +++ b/doc/mgr/modules.rst @@ -0,0 +1,476 @@ + + +.. _mgr-module-dev: + +ceph-mgr module developer's guide +================================= + +.. warning:: + + This is developer documentation, describing Ceph internals that + are only relevant to people writing ceph-mgr modules. + +Creating a module +----------------- + +In pybind/mgr/, create a python module. Within your module, create a class +that inherits from ``MgrModule``. For ceph-mgr to detect your module, your +directory must contain a file called `module.py`. + +The most important methods to override are: + +* a ``serve`` member function for server-type modules. This + function should block forever. +* a ``notify`` member function if your module needs to + take action when new cluster data is available. +* a ``handle_command`` member function if your module + exposes CLI commands. + +Some modules interface with external orchestrators to deploy +Ceph services. These also inherit from ``Orchestrator``, which adds +additional methods to the base ``MgrModule`` class. See +:ref:`Orchestrator modules ` for more on +creating these modules. + +Installing a module +------------------- + +Once your module is present in the location set by the +``mgr module path`` configuration setting, you can enable it +via the ``ceph mgr module enable`` command:: + + ceph mgr module enable mymodule + +Note that the MgrModule interface is not stable, so any modules maintained +outside of the Ceph tree are liable to break when run against any newer +or older versions of Ceph. + +Logging +------- + +Logging in Ceph manager modules is done as in any other Python program. Just +import the ``logging`` package and get a logger instance with the +``logging.getLogger`` function. + +Each module has a ``log_level`` option that specifies the current Python +logging level of the module. +To change or query the logging level of the module use the following Ceph +commands:: + + ceph config get mgr mgr//log_level + ceph config set mgr mgr//log_level + +The logging level used upon the module's start is determined by the current +logging level of the mgr daemon, unless if the ``log_level`` option was +previously set with the ``config set ...`` command. The mgr daemon logging +level is mapped to the module python logging level as follows: + +* <= 0 is CRITICAL +* <= 1 is WARNING +* <= 4 is INFO +* <= +inf is DEBUG + +We can unset the module log level and fallback to the mgr daemon logging level +by running the following command:: + + ceph config set mgr mgr//log_level '' + +By default, modules' logging messages are processed by the Ceph logging layer +where they will be recorded in the mgr daemon's log file. +But it's also possible to send a module's logging message to it's own file. + +The module's log file will be located in the same directory as the mgr daemon's +log file with the following name pattern:: + + ..log + +To enable the file logging on a module use the following command:: + + ceph config set mgr mgr//log_to_file true + +When the module's file logging is enabled, module's logging messages stop +being written to the mgr daemon's log file and are only written to the +module's log file. + +It's also possible to check the status and disable the file logging with the +following commands:: + + ceph config get mgr mgr//log_to_file + ceph config set mgr mgr//log_to_file false + + + + +Exposing commands +----------------- + +There are two approaches for exposing a command. The first one is to +use the ``@CLICommand`` decorator to decorate the method which handles +the command. like this + +.. code:: python + + @CLICommand('antigravity send to blackhole', + perm='rw') + def send_to_blackhole(self, oid: str, blackhole: Optional[str] = None, inbuf: Optional[str] = None): + ''' + Send the specified object to black hole + ''' + obj = self.find_object(oid) + if obj is None: + return HandleCommandResult(-errno.ENOENT, stderr=f"object '{oid}' not found") + if blackhole is not None and inbuf is not None: + try: + location = self.decrypt(blackhole, passphrase=inbuf) + except ValueError: + return HandleCommandResult(-errno.EINVAL, stderr='unable to decrypt location') + else: + location = blackhole + self.send_object_to(obj, location) + return HandleCommandResult(stdout=f'the black hole swallowed '{oid}'") + +The first parameter passed to ``CLICommand`` is the "name" of the command. +Since there are lots of commands in Ceph, we tend to group related commands +with a common prefix. In this case, "antigravity" is used for this purpose. +As the author is probably designing a module which is also able to launch +rockets into the deep space. + +The `type annotations `_ for the +method parameters are mandatory here, so the usage of the command can be +properly reported to the ``ceph`` CLI, and the manager daemon can convert +the serialized command parameters sent by the clients to the expected type +before passing them to the handler method. With properly implemented types, +one can also perform some sanity checks against the parameters! + +The names of the parameters are part of the command interface, so please +try to take the backward compatibility into consideration when changing +them. But you **cannot** change name of ``inbuf`` parameter, it is used +to pass the content of the file specified by ``ceph --in-file`` option. + +The docstring of the method is used for the description of the command. + +The manager daemon cooks the usage of the command from these ingredients, +like:: + + antigravity send to blackhole [] Send the specified object to black hole + +as part of the output of ``ceph --help``. + +In addition to ``@CLICommand``, you could also use ``@CLIReadCommand`` or +``@CLIWriteCommand`` if your command only requires read permissions or +write permissions respectively. + +The second one is to set the ``COMMANDS`` class attribute of your module to +a list of dicts like this:: + + COMMANDS = [ + { + "cmd": "foobar name=myarg,type=CephString", + "desc": "Do something awesome", + "perm": "rw", + # optional: + "poll": "true" + } + ] + +The ``cmd`` part of each entry is parsed in the same way as internal +Ceph mon and admin socket commands (see mon/MonCommands.h in +the Ceph source for examples). Note that the "poll" field is optional, +and is set to False by default; this indicates to the ``ceph`` CLI +that it should call this command repeatedly and output results (see +``ceph -h`` and its ``--period`` option). + +Each command is expected to return a tuple ``(retval, stdout, stderr)``. +``retval`` is an integer representing a libc error code (e.g. EINVAL, +EPERM, or 0 for no error), ``stdout`` is a string containing any +non-error output, and ``stderr`` is a string containing any progress or +error explanation output. Either or both of the two strings may be empty. + +Implement the ``handle_command`` function to respond to the commands +when they are sent: + + +.. py:currentmodule:: mgr_module +.. automethod:: MgrModule.handle_command + +Configuration options +--------------------- + +Modules can load and store configuration options using the +``set_module_option`` and ``get_module_option`` methods. + +.. note:: Use ``set_module_option`` and ``get_module_option`` to + manage user-visible configuration options that are not blobs (like + certificates). If you want to persist module-internal data or + binary configuration data consider using the `KV store`_. + +You must declare your available configuration options in the +``MODULE_OPTIONS`` class attribute, like this: + +:: + + MODULE_OPTIONS = [ + { + "name": "my_option" + } + ] + +If you try to use set_module_option or get_module_option on options not declared +in ``MODULE_OPTIONS``, an exception will be raised. + +You may choose to provide setter commands in your module to perform +high level validation. Users can also modify configuration using +the normal `ceph config set` command, where the configuration options +for a mgr module are named like `mgr//