Navigation

Begin Monitoring One Host

Note

Groups and projects are synonymous terms. Your {GROUP-ID} is the same as your project id. For existing groups, your group/project id remains the same. This page uses the more familiar term group when referring to descriptions. The endpoint remains as stated in the document.

Start monitoring a new MongoDB process. The Monitoring Agent starts monitoring the MongoDB process on the hostname and port you specify. Cloud Manager knows only the information that you provide. The response document includes blank values until Cloud Manager completes discovery of the MongoDB processes configuration.

Base URL: https://cloud.mongodb.com/api/public/v1.0

Resource

POST /groups/{GROUP-ID}/hosts

Request Path Parameters

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

Request Query Parameters

This endpoint does not use HTTP request query parameters.

Request Body Parameters

Name Type Description
alertsEnabled boolean Set to true if alerts should be enabled for this MongoDB process.
authMechanismName string

Specify which authentication mechanism should be used to connect to this MongoDB process. Possible values are:

  • MONGODB_CR (deprecated)
  • SCRAM_SHA_1
  • GSSAPI
  • PLAIN
  • MONGODB_X509
  • NONE
hostname string (Required) Set the primary hostname Cloud Manager should use to connect to this MongoDB instance.
logsEnabled boolean Set to true if Cloud Manager should collect logs for this MongoDB process.
muninPort number

Set the 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 Cloud Manager, see Configure Hardware Monitoring with munin-node.

password string Set to the password associated with username for connecting to this MongoDB process. If the process’s authMechanismName is MONGODB_CR or SCRAM_SHA_1, then you must include this field when creating the process or updating credentials for this process. This field is never included in any Host API response.
port number (Required) Set to the port on which MongoDB process listens.
profilerEnabled boolean Set to true if Cloud Manager collects profile information from this MongoDB process.
sslEnabled boolean Set to true if SSL/TLS should be enabled for this MongoDB process. (Conditional: Set to true if the authMechanismName is MONGODB_X509 .)
username string (Conditional: Specify if authMechanismName is MONGODB_CR or SCRAM_SHA_1 .) Specify username for connecting to this MongoDB process.

Response Elements

Name Type Description
aliases array of strings A list of alternate hostname:port combinations that Cloud 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 Cloud 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 Cloud Manager. If the MongoDB process does not have a display name set, Cloud 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 Cloud Manager UI. Hosts set to true are omitted from API responses.
hiddenSecondary boolean true if this host is a hidden secondary.
hostEnabled boolean true if the MongoDB process currently enabled.
hostname string The primary hostname as Cloud 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 Cloud 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 Cloud 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 Cloud Manager, see Configure Hardware Monitoring with munin-node.

port number Port on which the MongoDB process listens.
profilerEnabled boolean true if Cloud 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.
slaveDelaySec number Number of seconds this replica set member’s data trails the primary. If this value is set to 0, the member is not configured as a delayed member. For additional details on slave delays, see Delayed Replica Set Members
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 Cloud 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 POST "https://cloud.mongodb.com/api/public/v1.0/groups/{GROUP-ID}/hosts?pretty=true" \
 --data '
   {
     "hostname": "server1.example.com",
     "port": 27017
   }'

Example Response

Response Header

HTTP/1.1 401 Unauthorized
Content-Type: application/json;charset=ISO-8859-1
Date: {dateInUnixFormat}
WWW-Authenticate: Digest realm="MMS Public API", domain="", nonce="{nonce}", algorithm=MD5, op="auth", stale=false
Content-Length: {requestLengthInBytes}
Connection: keep-alive
HTTP/1.1 201 Created
Vary: Accept-Encoding
Content-Type: application/json
Strict-Transport-Security: max-age=300
Date: {dateInUnixFormat}
Connection: keep-alive
Content-Length: {requestLengthInBytes}

Response Body

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
{
  "alertsEnabled" : true,
  "authMechanismName" : "NONE",
  "created" : "2014-04-22T19:56:50Z",
  "groupId" : "{GROUP-ID}",
  "hasStartupWarnings" : false,
  "hidden" : false,
  "hostEnabled" : true,
  "hostname" : "server1.example.com",
  "id" : "{HOST-ID}",
  "journalingEnabled" : false,
  "links" : [  ],
  "logsEnabled" : false,
  "lowUlimit" : false,
  "muninEnabled" : false,
  "port" : 27017,
  "profilerEnabled" : false,
  "sslEnabled" : false
}