mongocli ops-manager serverUsage project hosts list
The serverUsage projects hosts list
command retrieves all host
assignments for one project. You can also retrieve this information
using the Ops Manager
UI or
API.
Syntax
mongocli ops-manager|om serverUsage project|s host|s list|ls [--projectId <project-ID>] [--startDate <start-date>] [--endDate <end-date>]
Note
Use -h
or --help
to view the command-line help for
this command.
Options
Option | Type | Description | Required? |
---|---|---|---|
--projectId | string | Unique identifier of the project. If omitted, uses the project ID in the profile or environment variable. | no |
--startDate | string | ISO 8601 formatted date when the list of host assignments
starts. | yes |
--endDate | string | ISO 8601 formatted date when the list of host assignments ends. | yes |
Output
If the command succeeds, it returns the following output in the default format. If the command returns errors, see Troubleshooting for recommended solutions.
HOSTNAME SERVER TYPE MEM SIZE MB CHARGEABLE <fqdn> <host-server-type> <memory-size> <true-or-false>
The default output is a subset of the fields returned by this command. For the complete list of JSON fields returned by the command, see the Public API reference for your MongoDB service:
Example
The following command retrieves the retrieves all host assignments for one project using the default profile, which contains credentials to access the project and the project ID. The output is returned in the default format.
mongocli om serverUsage projects hosts list --endDate 2020-01-01 --startDate 2021-01-01
The previous command prints the following to the terminal.
HOSTNAME SERVER TYPE MEM SIZE MB CHARGEABLE repl-0.example.com PRODUCTION_SERVER 178 true repl-1.example.com PRODUCTION_SERVER 178 true repl-2.example.com RAM_POOL 178 true
The following command retrieves the retrieves all host assignments for one project using the default profile, which contains credentials to access the project and the project ID. The output is returned in JSON format.
mongocli om serverUsage projects hosts list --endDate 2020-01-01 --startDate 2021-01-01 --output json
The previous command prints the following to the terminal in JSON format.
{ "links": [ { "rel": "self", "href": "http://om.example.com/api/public/v1.0/usage/groups/5f1f39ffc902201990f53873/hosts?endDate=2020-01-01\u0026startDate=2021-01-01\u0026pageNum=1\u0026itemsPerPage=100" }, ], "results":[{ "hostname":"repl-0.example.com", }, "serverType": { "name": "PRODUCTION_SERVER", "label": "Production Server" }, "isChargeable": true, "memSizeMB": 178 }, { "hostname":"repl-2.example.com", }, "serverType": { "name": "PRODUCTION_SERVER", "label": "Production Server" }, "isChargeable": true, "memSizeMB": 178 }, "hostname":"repl-3.example.com", }, "serverType": { "name": "RAM_POOL", "label": "RAM Pool" }, "isChargeable": true, "memSizeMB": 178 }, ] "totalCount": 3, }