From: Lenz Grimmer Date: Wed, 27 Feb 2019 12:49:47 +0000 (+0100) Subject: doc: Replaced "plugin" with "module" in the Mgr documentation X-Git-Tag: v14.1.1~117^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F26671%2Fhead;p=ceph.git doc: Replaced "plugin" with "module" in the Mgr documentation The documentation currently refers to Ceph Manager Modules as "plugins" in many places, while the command line interface uses "module" to enable/disable modules. Replaced all occurences of "plugin" with "module" in the docs, to avoid confusion and to be in alignment with the CLI. Also fixed the capitalizations of some module chapters. Fixes: https://tracker.ceph.com/issues/38481 Signed-off-by: Lenz Grimmer --- diff --git a/doc/mgr/crash.rst b/doc/mgr/crash.rst index 5639f32ebb2b..8a988103022e 100644 --- a/doc/mgr/crash.rst +++ b/doc/mgr/crash.rst @@ -1,13 +1,13 @@ -Crash plugin +Crash Module ============ -The crash plugin collects information about daemon crashdumps and stores +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 plugin allows the metadata about those dumps to be persisted in +This module allows the metadata about those dumps to be persisted in the monitors' storage. Enabling diff --git a/doc/mgr/diskprediction.rst b/doc/mgr/diskprediction.rst index e3af133144a6..779cda5d41e9 100644 --- a/doc/mgr/diskprediction.rst +++ b/doc/mgr/diskprediction.rst @@ -1,10 +1,10 @@ ===================== -DISKPREDICTION PLUGIN +Diskprediction Module ===================== -The *diskprediction* plugin supports two modes: cloud mode and local mode. In cloud mode, the disk and Ceph operating status information is collected from Ceph cluster and sent to a cloud-based DiskPrediction server over the Internet. DiskPrediction server analyzes the data and provides the analytics and prediction results of performance and disk health states for Ceph clusters. +The *diskprediction* module supports two modes: cloud mode and local mode. In cloud mode, the disk and Ceph operating status information is collected from Ceph cluster and sent to a cloud-based DiskPrediction server over the Internet. DiskPrediction server analyzes the data and provides the analytics and prediction results of performance and disk health states for Ceph clusters. -Local mode doesn't require any external server for data analysis and output results. In local mode, the *diskprediction* plugin uses an internal predictor module for disk prediction service, and then returns the disk prediction result to the Ceph system. +Local mode doesn't require any external server for data analysis and output results. In local mode, the *diskprediction* module uses an internal predictor module for disk prediction service, and then returns the disk prediction result to the Ceph system. | Local predictor: 70% accuracy | Cloud predictor for free: 95% accuracy @@ -39,7 +39,7 @@ The connection settings are used for connection between Ceph and DiskPrediction Local Mode ---------- -The *diskprediction* plugin 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. Thus, no connection settings are required in local mode. The local predictor module requires at least six datasets of device health metrics to implement the prediction. +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. Thus, no connection settings are required in local mode. The local predictor module requires at least six datasets of device health metrics to implement the prediction. Run the following command to use local predictor predict device life expectancy. @@ -86,7 +86,7 @@ Additional optional configuration settings are the following: Diskprediction Data =================== -The *diskprediction* plugin actively sends/retrieves the following data to/from DiskPrediction server. +The *diskprediction* module actively sends/retrieves the following data to/from DiskPrediction server. Metrics Data @@ -268,14 +268,14 @@ Osd: +----------------------+-----------------------------------------+ - Ceph each objects correlation information -- The plugin agent information -- The plugin agent cluster information -- The plugin agent host information +- The module agent information +- The module agent cluster information +- The module agent host information SMART Data ----------- -- Ceph physical device SMART data (provided by Ceph *devicehealth* plugin) +- Ceph physical device SMART data (provided by Ceph *devicehealth* module) Prediction Data @@ -348,6 +348,6 @@ use the following command. debug mgr = 20 -With logging set to debug for the manager the plugin will print out logging +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 index 2c55b66cf29a..725355fc9701 100644 --- a/doc/mgr/hello.rst +++ b/doc/mgr/hello.rst @@ -1,5 +1,5 @@ -hello world -=========== +Hello World Module +================== This is a simple module skeleton for documentation purposes. @@ -35,5 +35,5 @@ The log is found at:: Documenting ----------- -After adding a new mgr module/plugin, be sure to add its documentation to ``doc/mgr/plugin_name.rst``. -Also, add a link to your new plugin into ``doc/mgr/index.rst``. +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 index 3e913eff1525..ff2d5b9c9715 100644 --- a/doc/mgr/index.rst +++ b/doc/mgr/index.rst @@ -26,23 +26,23 @@ sensible. :maxdepth: 1 Installation and Configuration - Writing plugins + Writing modules Writing orchestrator plugins - Dashboard plugin - DiskPrediction plugin - Local pool plugin - RESTful plugin - Zabbix plugin - Prometheus plugin - Influx plugin - Hello plugin - Telegraf plugin - Telemetry plugin - Iostat plugin - Crash plugin - Orchestrator CLI plugin - Rook plugin - DeepSea plugin - Insights plugin - Ansible plugin + Dashboard module + DiskPrediction module + Local pool module + RESTful module + Zabbix module + Prometheus module + Influx module + Hello module + Telegraf module + Telemetry module + Iostat module + Crash module + Orchestrator CLI module + Rook module + DeepSea module + Insights module + Ansible module SSH orchestrator diff --git a/doc/mgr/influx.rst b/doc/mgr/influx.rst index 62c643b885d5..eab9494a96f0 100644 --- a/doc/mgr/influx.rst +++ b/doc/mgr/influx.rst @@ -1,11 +1,11 @@ ============= -Influx Plugin +Influx Module ============= -The influx plugin continuously collects and sends time series data to an +The influx module continuously collects and sends time series data to an influxdb database. -The influx plugin was introduced in the 13.x *Mimic* release. +The influx module was introduced in the 13.x *Mimic* release. -------- Enabling diff --git a/doc/mgr/insights.rst b/doc/mgr/insights.rst index b66de3de4e6f..37b8903f165a 100644 --- a/doc/mgr/insights.rst +++ b/doc/mgr/insights.rst @@ -1,7 +1,7 @@ -Insights plugin +Insights Module =============== -The insights plugin collects and exposes system information to the Insights Core +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: diff --git a/doc/mgr/iostat.rst b/doc/mgr/iostat.rst index 521c0bd7ace0..f9f8493831bc 100644 --- a/doc/mgr/iostat.rst +++ b/doc/mgr/iostat.rst @@ -3,7 +3,7 @@ iostat ====== -This plugin shows the current throughput and IOPS done on the Ceph cluster. +This module shows the current throughput and IOPS done on the Ceph cluster. Enabling -------- diff --git a/doc/mgr/localpool.rst b/doc/mgr/localpool.rst index b31ed6049fc9..4948dc756043 100644 --- a/doc/mgr/localpool.rst +++ b/doc/mgr/localpool.rst @@ -1,7 +1,7 @@ -Local pool plugin +Local Pool Module ================= -The *localpool* plugin can automatically create RADOS pools that are +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 some deployments that want to distribute some data locally as well as globally across the cluster . diff --git a/doc/mgr/modules.rst b/doc/mgr/modules.rst new file mode 100644 index 000000000000..662565c0f2a3 --- /dev/null +++ b/doc/mgr/modules.rst @@ -0,0 +1,389 @@ + + +.. _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 +------- + +``MgrModule`` instances have a ``log`` property which is a logger instance that +sends log messages into the Ceph logging layer where they will be recorded +in the mgr daemon's log file. + +Use it the same way you would any other python logger. The python +log levels debug, info, warn, err are mapped into the Ceph +severities 20, 4, 1 and 0 respectively. + +Exposing commands +----------------- + +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//