Navigation

Get All Hosts in a Group

Get all MongoDB hosts in a group. Use the CLUSTER-ID query parameter to only get the hosts that belong to the specified cluster. The response sorts the hosts alphabetically by HOSTNAME:PORT.

Base URL: {opsManagerHost}:{port}

Resource

GET /groups/{GROUP-ID}/hosts
GET /groups/{GROUP-ID}/hosts?clusterId={CLUSTER-ID}

Request Path Parameters

Parameter Required/Optional Description
GROUP-ID Required ID of the group that owns this MongoDB host.

Request Query Parameters

Name Type Description Default
pageNum integer Page number (1-based). 1
itemsPerPage integer Maximum number of items to return, up to a maximum of 100. 100
pretty boolean Display response in human-readable format. false
CLUSTER-ID Required ID of the cluster in which this MongoDB process belongs. None

Request Body Parameters

This endpoint does not use HTTP request body parameters.

Response Elements

Response Document

The response JSON document includes an array of result objects, an array of link objects and a count of the total number of result objects retrieved.

Name Type Description
results array of objects This array includes one object for each item detailed in the results Embedded Document section.
links array of objects This array includes one or more links to sub-resources and/or related resources. The relations between URLs are explained in the Web Linking Specification.
totalCount number The count of the total number of items in the result set. It may be greater than the number of objects in the results array if the entire result set is paginated.

results Embedded Document

Each result is one host.

Name Type Description
aliases array of strings A list of alternate hostname:port combinations that Ops Manager discovered for the MongoDB process.
alertsEnabled boolean true if this MongoDB process has alerts enabled.
authMechanismName string

The authentication mechanism used to connect to this MongoDB process. This displays only one of the following values:

  • MONGODB_CR (deprecated)
  • SCRAM_SHA_1
  • GSSAPI
  • PLAIN
  • MONGODB_X509
  • NONE
clusterId string The ID of the cluster to which the MongoDB process belongs.
created date Date Ops Manager created or first discovered this MongoDB process.
deactivated boolean false if the host is running; true if the host is deactivated.
displayName string The MongoDB process’s display name in Ops Manager. If the MongoDB process does not have a display name set, Ops Manager displays the hostname.
groupId string ID of the group that owns this alert configuration.
hasStartupWarnings boolean true if this MongoDB process had startup warnings.
hidden boolean true if host is displayed in the Ops Manager UI. Hosts set to true are omitted from API responses.
hostEnabled boolean true if the MongoDB process currently enabled.
hostname string The primary hostname as Ops Manager can best determine.
id string Unique identifier.
ipAddress string IP address associated with the hostname of this MongoDB process. Additional accessible IP addresses may be displayed in the aliases array.
journalingEnabled boolean true if journaling is enabled for this MongoDB process.
lastDataSizeBytes number The uncompressed size of the host’s databases on disk in bytes excluding indexes. lastDataSizeBytes does not include the data in the local database.
lastIndexSizeBytes number The uncompressed size of the host’s database indexes on disk in bytes. This number does not include the size of the index for the local database.
lastPing date The point in time when the last ping for this MongoDB process was received in ISO 8601 date and time format in UTC.
lastRestart date The point in time when this process last restarted in ISO 8601 date and time format in UTC. If the MongoDB process has never been restarted, the lastRestart field is omitted.
links array This array includes one or more links to sub-resources and/or related resources. The relations between URLs are explained in the Web Linking Specification. At minimum, a links array contains one link called self.
logsEnabled boolean true if Ops Manager is collecting logs for this MongoDB process.
lowUlimit boolean true if this MongoDB process’s host has a low ulimit setting.
muninEnabled boolean

true if Munin is used to collect hardware statistics for this MongoDB process.

Note

Use of Munin for hardware monitoring is deprecated. For more information on Munin and Ops Manager, see Configure Hardware Monitoring with munin-node.

muninPort number

Port number Munin uses to collect hardware statistics for this MongoDB process.

Note

Use of Munin for hardware monitoring is deprecated. For more information on Munin and Ops Manager, see Configure Hardware Monitoring with munin-node.

port number Port on which the MongoDB process listens.
profilerEnabled boolean true if Ops Manager collects profile information from this MongoDB process.
replicaSetName string Name of the replica set this process belongs to. Only present if this process is part of a replica set.
replicaStateName string Current state of this MongoDB process within a replica set. Only present if this process is part of a replica set. See Replica Set Member States for possible values.
shardName string Name of the shard this process belongs to. Only present if the process is part of a sharded cluster.
sslEnabled boolean true if SSL/TLS and is enabled for this MongoDB process.
typeName string

Type for this MongoDB process. Possible values are:

  • STANDALONE
  • REPLICA_PRIMARY
  • REPLICA_SECONDARY
  • REPLICA_ARBITER
  • RECOVERING
  • MASTER
  • SLAVE
  • SHARD_MONGOS
  • SHARD_CONFIG
  • SHARD_STANDALONE
  • SHARD_PRIMARY
  • SHARD_SECONDARY
  • NO_DATA

The type for new hosts added to Ops Manager will be NO_DATA until the Monitoring Agent receives its first ping.

uptimeMsec number Number of milliseconds since this process last restarted.
version string Version of MongoDB running for this process.

Example Request

curl --user "{USERNAME}:{APIKEY}" --digest \
 --header "Accept: application/json" \
 --header "Content-Type: application/json" \
 --include \
 --request GET "https://{OPSMANAGER-HOST}:{PORT}/api/public/v1.0/groups/{GROUP-ID}/hosts?pretty=true"

Example Response

Response Header

HTTP/1.1 401 Unauthorized
Content-Type: application/json;charset=ISO-8859-1
Date: {DATE-IN-UNIX-FORMAT}
WWW-Authenticate: Digest realm="MMS Public API", domain="", nonce="{NONCE}", algorithm=MD5, op="auth", stale=false
Content-Length: {REQUEST-LENGTH}
Connection: keep-alive
HTTP/1.1 200 OK
Vary: Accept-Encoding
Content-Type: application/json
Strict-Transport-Security: max-age=300
Date: {DATE-IN-UNIX-FORMAT}
Connection: keep-alive
Content-Length: {REQUEST-LENGTH}

Response Body

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{
  "totalCount" : 2,
  "results" : [
    {
      "id" : "{HOST-ID}",
      "groupId" : "{GROUP-ID}",
      "clusterId" : "{CLUSTER-ID}",
      "hostname" : "{HOSTNAME}",
      "port" : 26000,
      "typeName": "REPLICA_PRIMARY",
      "lastPing" : "2016-08-18T11:23:41Z",
      "ipAddress": "127.0.0.1",
      "version" : "3.2.0",
      "hasStartupWarnings" : false,
      "sslEnabled" : true,
      "logsEnabled" : false,
      "created" : "2014-04-22T19:56:50Z",
      "uptimeMsec": 1827300394,
      "deactivated" : false,
      "lastDataSizeBytes" : 633208918,
      "lastIndexSizeBytes" : 101420524,
      "replicaSetName": "rs1",
      "replicaStateName" : "PRIMARY",
      "hostEnabled" : true,
      "journalingEnabled" : false,
      "alertsEnabled" : true,
      "hidden" : false,
      "muninEnabled" : false,
      "profilerEnabled" : false,
      "lowUlimit" : false,
      "authMechanismName" : "SCRAM-SHA-1",
      "username" : "mongo",
      "aliases": [ "{HOSTNAME}:26000", "{IP-ADDRESS}:26000" ],
      "displayName": "{DISPLAY-NAME}",
      "links" : [  ]
    },
    {

    }
  ]
}
←   Hosts Get Host by ID  →