mongocli ops-manager agents list
The agents list
command retrieves all agents of a provided type for
the specified Ops Manager project.
You must have at least GROUP_READ_ONLY
privileges for a project to
retrieve the agents for that project.
Syntax
mongocli ops-manager|om agents list|ls <type> [ --output|-o <output-format> ] [ --profile|-P <profile-name> ] [ --projectId <id-of-project> ]
Arguments
Argument | Type | Description | Required? |
---|---|---|---|
<type> | string | Agent type to retrieve. Accepted values are:
| yes |
Options
Option | Type | Description | Required? |
--output , -o | string | Command output format. Valid values are:
If omitted, the command returns output in the default format. | no |
--profile , -P | string | Name of the profile where the public and private
keys for the project are saved. If omitted, uses the
default profile. To learn more about creating a
profile, see Configure the MongoDB CLI. | no |
--projectId | string | Unique identifier of the project. If omitted, uses the project ID in the profile or environment variable. | no |
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 TYPE STATE <agent-1-hostname> <type> <agent-1-state> <agent-2-hostname> <type> <agent-2-state> <agent-3-hostname> <type> <agent-3-state>
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 Automation Agents for a project using the default profile, which contains credentials and the project ID. The output is returned in the default format.
mongocli om agents list AUTOMATION
The previous command prints the following to the terminal.
HOSTNAME TYPE STATE db1.example.com AUTOMATION ACTIVE db2.example.com AUTOMATION NO_PROCESSES db3.example.com AUTOMATION NO_PROCESSES
The following command retrieves Automation Agents for a project using the default profile, which contains credentials and the project ID. The output is returned in JSON format.
mongocli om agents list AUTOMATION --output json
The previous command prints the following to the terminal in JSON format.
{ "links": [ { "rel": "self", "href": "http://om.example.com:8080/api/public/v1.0/groups/5f1f39ffc902201990f53873/agents/AUTOMATION?pageNum=1\u0026itemsPerPage=100" } ], "results": [ { "typeName": "AUTOMATION", "hostname": "db1.example.com", "confCount": 274209, "lastConf": "2020-08-28T16:27:30Z", "stateName": "ACTIVE", "pingCount": 0, "isManaged": false, "lastPing": "", "tag": null }, { "typeName": "AUTOMATION", "hostname": "db2.example.com", "confCount": 274140, "lastConf": "2020-08-28T16:27:30Z", "stateName": "NO_PROCESSES", "pingCount": 0, "isManaged": false, "lastPing": "", "tag": null }, { "typeName": "AUTOMATION", "hostname": "db3.example.com", "confCount": 274115, "lastConf": "2020-08-28T16:27:30Z", "stateName": "NO_PROCESSES", "pingCount": 0, "isManaged": false, "lastPing": "", "tag": null } ], "totalCount": 3 }