Skip to content

Commit 5c4bbd6

Browse files
author
Dave
authored
DOCSP-20688 additional mongostat examples (#68)
* DOCSP-20688 Additional mongostat examples * Staging Fixes * Staging Fixes * Review feedback * Review feedback
1 parent e1a7c3e commit 5c4bbd6

File tree

1 file changed

+69
-31
lines changed

1 file changed

+69
-31
lines changed

source/mongostat.txt

Lines changed: 69 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -401,15 +401,16 @@ Options
401401

402402
.. option:: -o=<field list>
403403

404-
When specified, :program:`mongostat` includes **only** the specified fields
405-
in the :program:`mongostat` output.
404+
When output fields are specified with :option:`-o`, only the
405+
specified fields are included in the :program:`mongostat` output.
406406

407407
Use dot notation to specify
408408
:dbcommand:`serverStatus fields <serverStatus>`, as in
409409
:serverstatus:`metrics.document.inserted`.
410410

411-
To specify a custom name for a field, use ``<field>=<customName>``,
412-
as in:
411+
A custom field name can include spaces. If you include a space, do
412+
not put additional quotes around the field name. To specify a custom
413+
name for a field, use ``<field>=<customName>``, as in:
413414

414415
.. code-block:: sh
415416

@@ -425,21 +426,22 @@ Options
425426
call.
426427

427428
:ref:`ex-mongostat-rate` illustrates how to use
428-
:binary:`~bin.mongostat` with :option:`-o <mongostat -o>` and the :method:`.rate()`
429-
method.
429+
:binary:`~bin.mongostat` with :option:`-o <mongostat -o>` and the
430+
:method:`.rate()` method.
430431

431432
.. method:: .diff()
432433

433434
Use :method:`.diff()` to view how much a serverStatus field has
434-
changed since the previous :binary:`~bin.mongostat` call. The interval
435-
between calls is specified by ``<sleeptime>``.
435+
changed since the previous :binary:`~bin.mongostat` call. The
436+
interval between calls is specified by ``<sleeptime>``.
436437

437438
:ref:`ex-mongostat-diff` illustrates how to use
438-
:binary:`~bin.mongostat` with :option:`-o <mongostat -o>` and the :method:`.diff()`
439-
method.
439+
:binary:`~bin.mongostat` with :option:`-o <mongostat -o>` and the
440+
:method:`.diff()` method.
440441

441-
:program:`mongostat` supports specifying *either* :option:`-o <mongostat -o>` or :option:`-O <mongostat -O>`:
442-
you cannot include both options.
442+
:program:`mongostat` supports specifying *either* :option:`-o
443+
<mongostat -o>` or :option:`-O <mongostat -O>`: you cannot include
444+
both options.
443445

444446
See :ref:`ex-mongostat-specify-columns` for an example of
445447
:option:`-o <mongostat -o>`.
@@ -448,14 +450,16 @@ Options
448450
.. option:: -O=<field list>
449451

450452
When specified, :program:`mongostat` includes the specified
451-
:dbcommand:`serverStatus` fields after the default :program:`mongostat` output.
453+
:dbcommand:`serverStatus` fields after the default
454+
:program:`mongostat` output.
452455

453456
Use dot notation to specify
454457
:dbcommand:`serverStatus fields <serverStatus>`, as in
455458
:serverstatus:`metrics.document.inserted`.
456459

457-
To specify a custom name for a field, use ``<field>=<customName>``,
458-
as in:
460+
A custom field name can include spaces. If you include a space, do
461+
not put additional quotes around the field name. To specify a custom
462+
name for a field, use ``<field>=<customName>``, as in:
459463

460464
.. code-block:: sh
461465

@@ -721,18 +725,19 @@ behavior:
721725
Add Fields to :binary:`~bin.mongostat` Output
722726
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
723727

724-
:option:`-O <mongostat -O>` allows you to specify fields from
728+
:option:`-O <mongostat -O>` allows you to specify fields from the
725729
:dbcommand:`serverStatus` output to add to the default
726-
:binary:`~bin.mongostat` output. The following example adds the :serverstatus:`host`
727-
and :serverstatus:`version` fields as well as the :serverstatus:`network.numRequests` field,
728-
which will display as "network requests", to the default
730+
:binary:`~bin.mongostat` output. If you include a space in your
731+
custom filed name, do not put additional quotes around the field name.
732+
733+
The following example adds fields to the default
729734
:binary:`~bin.mongostat` output:
730735

731736
.. code-block:: sh
732737

733738
mongostat -O='host,version,network.numRequests=network requests'
734739

735-
The :binary:`~bin.mongostat` output would then resemble:
740+
The :binary:`~bin.mongostat` output resembles:
736741

737742
.. code-block:: sh
738743

@@ -741,29 +746,62 @@ The :binary:`~bin.mongostat` output would then resemble:
741746
*0 *0 *0 *0 0 1|0 0.0% 0.0% 0 2.51G 19.0M 0|0 0|0 157b 39.3k 2 Oct 11 12:14:46.879 localhost:37017 3.3.14 95
742747
*0 *0 *0 *0 0 1|0 0.0% 0.0% 0 2.51G 19.0M 0|0 0|0 157b 39.2k 2 Oct 11 12:14:47.884 localhost:37017 3.3.14 99
743748

749+
The following fields are added to the default output:
750+
751+
- :serverstatus:`host`
752+
- :serverstatus:`version`
753+
- :serverstatus:`network.numRequests`
754+
755+
The :serverstatus:`network.numRequests` field has a custom field name,
756+
"network requests".
757+
744758
.. _ex-mongostat-specify-columns:
745759

746760
Specify :binary:`~bin.mongostat` Output Fields
747761
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
748762

749-
:option:`-o <mongostat -o>` specifies the columns :binary:`~bin.mongostat` includes in its
750-
output. You can specify any :dbcommand:`serverStatus` field as a
751-
:binary:`~bin.mongostat` output column. The following example specifies the
752-
:serverstatus:`host`, :serverstatus:`time <localTime>`, and :serverstatus:`metrics.document.inserted` fields:
763+
:option:`-o <mongostat -o>` specifies the columns
764+
:binary:`~bin.mongostat` includes in its output. You can specify any
765+
:dbcommand:`serverStatus` field as a :binary:`~bin.mongostat` output
766+
column.
767+
768+
The following example uses custom fields for :binary:`mongostat`:
753769

754770
.. code-block:: sh
755771

756-
mongostat -o='host,time,metrics.document.inserted'
772+
mongostat --port 27500 -o='host,opcounters.insert.rate()=Insert Rate,opcounters.query.rate()=Query Rate,opcounters.command.rate()=Command Rate,wiredTiger.cache.pages requested from the cache=Pages Req,metrics.document.inserted=inserted rate'
757773

758-
The :binary:`~bin.mongostat` output would then resemble:
774+
The :binary:`~bin.mongostat` output resembles:
759775

760776
.. code-block:: sh
761777

762-
host time metrics.document.inserted
763-
localhost:37017 Oct 11 12:21:17.370 0
764-
localhost:37017 Oct 11 12:21:18.371 0
765-
localhost:37017 Oct 11 12:21:19.371 0
766-
localhost:37017 Oct 11 12:21:20.368 0
778+
host Insert Rate Query Rate Command Rate Pages Req Inserted Rate
779+
localhost:27500 180 1 8 2999446 9638
780+
localhost:27500 40 3 12 2999601 9678
781+
localhost:27500 181 2 9 3000207 9859
782+
localhost:27500 39 2 12 3000362 9899
783+
localhost:27500 181 2 11 3000969 10080
784+
localhost:27500 39 2 10 3001124 10120
785+
786+
The counters and corresponding custom field names are:
787+
788+
.. list-table::
789+
:widths: 30 70
790+
:header-rows: 1
791+
792+
* - Counter
793+
- Custom Field Name
794+
* - opcounters.insert.rate
795+
- Insert Rate
796+
* - opcounters.query.rate
797+
- Query Rate
798+
* - opcounters.command.rate
799+
- Command Rate
800+
* - wiredTiger.cache.pages requested from the cache
801+
- Pages Req
802+
* - metrics.document.inserted
803+
- Inserted Rate
804+
767805

768806
.. _ex-mongostat-rate:
769807

0 commit comments

Comments
 (0)