Fix documentation formatting issue
[ganeti-local] / doc / design-monitoring-agent.rst
index 1d41e64..e20c8c3 100644 (file)
@@ -48,12 +48,6 @@ The monitoring agent system will report on the following basic information:
 - Node OS resources report (memory, CPU, network interfaces)
 - Information from a plugin system
 
-Format of the query
--------------------
-
-The query will be an HTTP GET request on a particular port. At the
-beginning it will only be possible to query the full status report.
-
 Format of the report
 --------------------
 
@@ -72,14 +66,14 @@ the data collectors:
   report. Built-in data collectors (as opposed to those implemented as
   plugins) should have "B" as the version number.
 
-``formatVersion``
+``format_version``
   The format of what is represented in the "data" field for each data
   collector might change over time. Every time this happens, the
   format_version should be changed, so that who reads the report knows
   what format to expect, and how to correctly interpret it.
 
 ``timestamp``
-  The time when the reported data were gathered. Is has to be expressed
+  The time when the reported data were gathered. It has to be expressed
   in nanoseconds since the unix epoch (0:00:00 January 01, 1970). If not
   enough precision is available (or needed) it can be padded with
   zeroes. If a report object needs multiple timestamps, it can add more
@@ -109,7 +103,7 @@ Here follows a minimal example of a report::
   {
       "name" : "TheCollectorIdentifier",
       "version" : "1.2",
-      "formatVersion" : 1,
+      "format_version" : 1,
       "timestamp" : 1351607182000000000,
       "category" : null,
       "kind" : 0,
@@ -118,7 +112,7 @@ Here follows a minimal example of a report::
   {
       "name" : "AnotherDataCollector",
       "version" : "B",
-      "formatVersion" : 7,
+      "format_version" : 7,
       "timestamp" : 1351609526123854000,
       "category" : "storage",
       "kind" : 1,
@@ -176,9 +170,9 @@ in its ``data`` section, at least the following field:
 
   ``code``
     It assumes a numeric value, encoded in such a way to allow using a bitset
-    to easily distinguish which states are currently present in the whole cluster.
-    If the bitwise OR of all the ``status`` fields is 0, the cluster is
-    completely healty.
+    to easily distinguish which states are currently present in the whole
+    cluster. If the bitwise OR of all the ``status`` fields is 0, the cluster
+    is completely healty.
     The status codes are as follows:
 
     ``0``
@@ -191,20 +185,21 @@ in its ``data`` section, at least the following field:
       There is no need of external intervention.
 
     ``2``
-      The collector can determine that something is wrong and Ganeti has no
-      way to fix it autonomously. External intervention is required.
-
-    ``4``
       The collector has failed to understand whether the status is good or
       bad. Further analysis is required. Interpret this status as a
       potentially dangerous situation.
 
+    ``4``
+      The collector can determine that something is wrong and Ganeti has no
+      way to fix it autonomously. External intervention is required.
+
   ``message``
     A message to better explain the reason of the status.
     The exact format of the message string is data collector dependent.
 
-    The field is mandatory, but the content can be ``null`` if the code is
-    ``0`` (working as intended) or ``1`` (being fixed automatically).
+    The field is mandatory, but the content can be an empty string if the
+    ``code`` is ``0`` (working as intended) or ``1`` (being fixed
+    automatically).
 
     If the status code is ``2``, the message should specify what has gone
     wrong.
@@ -229,11 +224,9 @@ As such we propose that:
   "reason" attached to it (at opcode level). This can be used for
   example to distinguish an admin request, from a scheduled maintenance
   or an automated tool's work. If this reason is not passed, Ganeti will
-  just use the information it has about the source of the request: for
-  example a cli shutdown operation will have "cli:shutdown" as a reason,
-  a cli failover operation will have "cli:failover". Operations coming
-  from the remote API will use "rapi" instead of "cli". Of course
-  setting a real site-specific reason is still preferred.
+  just use the information it has about the source of the request.
+  This reason information will be structured according to the
+  :doc:`Ganeti reason trail <design-reason-trail>` design document.
 - RPCs that affect the instance status will be changed so that the
   "reason" and the version of the config object they ran on is passed to
   them. They will then export the new expected instance status, together
@@ -253,7 +246,8 @@ upon.
 
 The instance status will be on each node, for the instances it is
 primary for, and its ``data`` section of the report will contain a list
-of instances, with at least the following fields for each instance:
+of instances, named ``instances``, with at least the following fields for
+each instance:
 
 ``name``
   The name of the instance.
@@ -275,18 +269,9 @@ of instances, with at least the following fields for each instance:
   The timestamp of the last known change to the instance state.
 
 ``state_reason``
-  The last known reason for state change, described according to the
-  following subfields:
-
-  ``text``
-    Either a user-provided reason (if any), or the name of the command that
-    triggered the state change, as a fallback.
-
-  ``jobID``
-    The ID of the job that caused the state change.
-
-  ``source``
-    Where the state change was triggered (RAPI, CLI).
+  The last known reason for state change of the instance, described according
+  to the JSON representation of a reason trail, as detailed in the :doc:`reason
+  trail design document <design-reason-trail>`.
 
 ``status``
   It represents the status of the instance, and its format is the same as that
@@ -311,33 +296,24 @@ collector will be:
 ``1``
   otherwise.
 
-Storage status
-++++++++++++++
+Storage collectors
+++++++++++++++++++
 
-The storage status collectors will be a series of data collectors
-(drbd, rbd, plain, file) that will gather data about all the storage types
-for the current node (this is right now hardcoded to the enabled storage
-types, and in the future tied to the enabled storage pools for the nodegroup).
+The storage collectors will be a series of data collectors
+that will gather data about storage for the current node. The collection
+will be performed at different granularity and abstraction levels, from
+the physical disks, to partitions, logical volumes and to the specific
+storage types used by Ganeti itself (drbd, rbd, plain, file).
 
 The ``name`` of each of these collector will reflect what storage type each of
 them refers to.
 
 The ``category`` field of these collector will be ``storage``.
 
-The ``kind`` field will be ``1`` (`Status reporting collectors`_).
-
-The ``data`` section of the report will provide at least the following fields:
-
-``free``
-  The amount of free space (in KBytes).
+The ``kind`` field will depend on the specific collector.
 
-``used``
-  The amount of used space (in KBytes).
-
-``total``
-  The total visible space (in KBytes).
-
-Each specific storage type might provide more type-specific fields.
+Each ``storage`` collector's ``data`` section will provide collector-specific
+fields.
 
 In case of error, the ``message`` subfield of the ``status`` field of the
 report of the instance status collector will disclose the nature of the error
@@ -345,6 +321,78 @@ as a type specific information. Examples of these are "backend pv unavailable"
 for lvm storage, "unreachable" for network based storage or "filesystem error"
 for filesystem based implementations.
 
+Diskstats collector
+*******************
+
+This storage data collector will gather information about the status of the
+disks installed in the system, as listed in the /proc/diskstats file. This means
+that not only physical hard drives, but also ramdisks and loopback devices will
+be listed.
+
+Its ``kind`` in the report will be ``0`` (`Performance reporting collectors`_).
+
+Its ``category`` field in the report will contain the value ``storage``.
+
+When executed in verbose mode, the ``data`` section of the report of this
+collector will be a list of items, each representing one disk, each providing
+the following fields:
+
+``major``
+  The major number of the device.
+
+``minor``
+  The minor number of the device.
+
+``name``
+  The name of the device.
+
+``readsNum``
+  This is the total number of reads completed successfully.
+
+``mergedReads``
+  Reads which are adjacent to each other may be merged for efficiency. Thus
+  two 4K reads may become one 8K read before it is ultimately handed to the
+  disk, and so it will be counted (and queued) as only one I/O. This field
+  specifies how often this was done.
+
+``secRead``
+  This is the total number of sectors read successfully.
+
+``timeRead``
+  This is the total number of milliseconds spent by all reads.
+
+``writes``
+  This is the total number of writes completed successfully.
+
+``mergedWrites``
+  Writes which are adjacent to each other may be merged for efficiency. Thus
+  two 4K writes may become one 8K read before it is ultimately handed to the
+  disk, and so it will be counted (and queued) as only one I/O. This field
+  specifies how often this was done.
+
+``secWritten``
+  This is the total number of sectors written successfully.
+
+``timeWrite``
+  This is the total number of milliseconds spent by all writes
+
+``ios``
+  The number of I/Os currently in progress.
+  The only field that should go to zero, it is incremented as requests are
+  given to appropriate struct request_queue and decremented as they finish.
+
+``timeIO``
+  The number of milliseconds spent doing I/Os. This field increases so long
+  as field ``IOs`` is nonzero.
+
+``wIOmillis``
+  The weighted number of milliseconds spent doing I/Os.
+  This field is incremented at each I/O start, I/O completion, I/O merge,
+  or read of these stats by the number of I/Os in progress (field ``IOs``)
+  times the number of milliseconds spent doing I/O since the last update of
+  this field. This can provide an easy measure of both I/O completion time
+  and the backlog that may be accumulating.
+
 DRBD status
 ***********
 
@@ -569,6 +617,11 @@ node RAID is outside the scope of this, and can be implemented as a
 plugin) but we can easily just report the information above, since it's
 standard enough across all systems.
 
+Format of the query
+-------------------
+
+.. include:: monitoring-query-format.rst
+
 Instance disk status propagation
 --------------------------------
 
@@ -647,7 +700,6 @@ impact functionality.
 The libekg library should be looked at for easily providing metrics in
 json format.
 
-
 Implementation order
 --------------------