Navigation

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.

mongocli ops-manager|om agents list|ls <type>
[ --output|-o <output-format> ]
[ --profile|-P <profile-name> ]
[ --projectId <id-of-project> ]
Argument
Type
Description
Required?
<type>
string

Agent type to retrieve. Accepted values are:

  • AUTOMATION
  • MONITORING
  • BACKUP
yes
Option
Type
Description
Required?
--output, -o
string

Command output format. Valid values are:

  • json for output in JSON format
  • go-template for custom output using the Go template
  • go-template-file for custom output specified using the Go template file

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

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:

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
Give Feedback