- API >
- MMS Public API >
- Hosts
Hosts¶
On this page
Sample Entity¶
Entity Fields¶
Name | Type | Description |
---|---|---|
id | string | Unique identifier. |
groupId | string | ID of the group that owns this host. |
hostname | string | Primary hostname. A host typically has several aliases, so the primary is the best available name as decided by MMS. |
port | integer | Port that MongoDB process (mongod or mongos ) listens on. |
typeName | enum | Type for this host. 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 host’s type for new hosts added to MMS will be NO_DATA
until the Monitoring Agent receives its first ping. |
lastPing | date | When the last ping for this host was received. |
ipAddress | string | IP address of this host. |
version | string | Version of MongoDB running on this host. |
deactivated | boolean | Has this host been deactivated by MMS? A host will be marked as deactivated when MMS hasn’t received a ping from it in several days. |
hasStartupWarnings | boolean | Are there startup warnings for this host? |
sslEnabled | boolean | Is SSL enabled for this host? |
logsEnabled | boolean | Is MMS collecting logs for this host? |
lastReactivated | date | The last time this has was manually reactivated. |
uptimeMsec | long | Number of milliseconds since this host’s last restart. |
lastRestart | date | Date this host was last restarted. |
shardName | string | Name of the shard this host belongs to. Only present if the host is part of a sharded cluster. |
replicaSetName | string | Name of the replica set this host belongs to. Only present if this host is part of a replica set. |
replicaStateName | enum | Current state of this host within a replica set. Only present if this host is part of a replica set. See Replica Set Member States for possible values. |
created | date | Date this host was created or first discovered by MMS. |
hostEnabled | boolean | Is this host currently enabled? Hosts can be manually disabled in the MMS UI. |
journalingEnabled | boolean | Is journaling enabled for this host? |
alertsEnabled | boolean | Are alerts enabled for this host? |
muninEnabled | boolean | Are Munin stats being collected for this host? |
hidden | boolean | Is this host currently hidden? When MMS deactivates a host, it will also mark it as hidden. |
profilerEnabled | boolean | Is MMS collecting profile information from this host? |
lowUlimit | boolean | Does this host have a low ulimit setting? |
muninPort | integer | What port should be used to collect Munin stats from this host? |
authMechanismName | enum | The authentication mechanism used to connect to this host. Possible values
are: MONGODB_CR GSSAPI NONE |
username | string | Username for connecting to this host. Only present when the
authMechanismName is MONGODB_CR . |
password | string | Password for connecting to this host. If a host’s authMechanismName
is MONGODB_CR , then you must include this field when creating the
host or updating its credentials. However, it will never be exposed when
a host entity is returned. |
Links¶
Relation | Description |
---|---|
self | Me |
cluster | The cluster this host belongs to. Only present if the host is part of a replica set or master/slave. |
parentCluster | The parent cluster. Only present if the host is part of a sharded cluster. |
group | The group that this host belongs to. |
Operations¶
GET /api/public/v1.0/groups/GROUP-ID/hosts
- Get all hosts in a group. Use theclusterId
query parameter to only get the hosts that belong to the specified cluster. The resulting list is sorted alphabetically byhostname:port
.GET /api/public/v1.0/groups/GROUP-ID/hosts/HOST-ID
- Get a single host by ID.POST /api/public/v1.0/groups/GROUP-ID/hosts
- Create a new host in the group. Note that after a new host is created, MMS will not know much about it except what is provided. Thus, the document returned in the response will be missing many values until they are discovered, which could take several minutes. Only these fields may be specified when creating a host:hostname
- Required.port
- Required.username
- IfauthMechanismName
isMONGODB_CR
, this field is required. Otherwise it’s illegal.password
- IfauthMechanismName
isMONGODB_CR
, this field is required. Otherwise it’s illegal.sslEnabled
- Default isfalse
if omitted.logsEnabled
- Default isfalse
if omitted.alertsEnabled
- Default istrue
if omitted.profilerEnabled
- Default isfalse
if omitted.muninPort
- Default is 0 and Munin stats are not collected if omitted.authMechanismName
- Default isNONE
if omitted. If set toMONGODB_CR
then you must provide theusername
andpassword
.
PATCH /api/public/v1.0/groups/GROUP-ID/hosts/HOST-ID
- Update an existing host using the fields provided. Unspecified fields will preserve their current values.- Only these fields may be specified:
username password sslEnabled logsEnabled alertsEnabled profilerEnabled muninPort authMechanismName
- If
authMechanismName
isNONE
then any existing value forusername
andpassword
will be cleared out. ForMONGODB_CR
you must provide bothusername
andpassword
.
- Only these fields may be specified:
DELETE /api/public/v1.0/groups/GROUP-ID/hosts/HOST-ID
- Remove a host.
Examples¶
Create a new host:
curl -u "username:apiKey" -H "Content-Type: application/json" "https://mms.mongodb.com/api/public/v1.0/groups/5196d3628d022db4cbc26d9e/hosts" -X POST --digest --data @-
{
"hostname": "localhost",
"port": 27017
}
HTTP/1.1 201 Created
Location: https://mms.mongodb.com/api/public/v1.0/groups/5196d3628d022db4cbc26d9e/hosts/680ab316473d6b28f966364b947134fc
{
"id" : "4059580c20c4581872ef24d0b8f5dca0",
"groupId" : "5196d3628d022db4cbc26d9e",
"hostname" : "localhost",
"port" : 27017,
"deactivated" : false,
"hasStartupWarnings" : false,
"sslEnabled" : false,
"logsEnabled" : false,
"created" : "2014-04-22T19:56:50Z",
"hostEnabled" : true,
"journalingEnabled" : false,
"alertsEnabled" : true,
"hidden" : false,
"muninEnabled" : false,
"profilerEnabled" : false,
"lowUlimit" : false,
"authMechanismName" : "NONE",
"links" : [ ... ]
}
Update a host:
curl -u "username:apiKey" -H "Content-Type: application/json" "https://mms.mongodb.com/api/public/v1.0/groups/533c5895b91030606f21033a/hosts/680ab316473d6b28f966364b947134fc" --digest -i --data @- -X PATCH
{
"sslEnabled": true,
"username": "mongo",
"password": "M0ng0DB!:)"
}
HTTP/1.1 200 OK
{
"id" : "680ab316473d6b28f966364b947134fc",
"groupId" : "533c5895b91030606f21033a",
"hostname" : "localhost",
"port" : 26000,
"deactivated" : false,
"hasStartupWarnings" : false,
"sslEnabled" : true,
"logsEnabled" : false,
"created" : "2014-04-22T19:56:50Z",
"hostEnabled" : true,
"journalingEnabled" : false,
"alertsEnabled" : true,
"hidden" : false,
"muninEnabled" : false,
"profilerEnabled" : false,
"lowUlimit" : false,
"authMechanismName" : "MONGODB_CR",
"username" : "mongo",
"links" : [ ... ]
}
Get one host:
curl -u "username:apiKey" "https://mms.mongodb.com/api/public/v1.0/groups/533c5895b91030606f21033a/hosts/56e9378f601dc49360a40949c8a6df6c" --digest -i
HTTP/1.1 200 OK
{
"id" : "56e9378f601dc49360a40949c8a6df6c",
"groupId" : "533c5895b91030606f21033a",
"hostname" : "localhost",
"port" : 26000,
"deactivated" : false,
"hasStartupWarnings" : false,
"sslEnabled" : true,
"logsEnabled" : false,
"created" : "2014-04-22T19:56:50Z",
"hostEnabled" : true,
"journalingEnabled" : false,
"alertsEnabled" : true,
"hidden" : false,
"muninEnabled" : false,
"profilerEnabled" : false,
"lowUlimit" : false,
"authMechanismName" : "MONGODB_CR",
"username" : "mongo",
"links" : [ ... ]
}
Get all hosts:
curl -u "username:apiKey" "https://mms.mongodb.com/api/public/v1.0/groups/533c5895b91030606f21033a/hosts" --digest -i
HTTP/1.1 200 OK
{
"totalCount" : 2,
"results" : [ {
"id" : "56e9378f601dc49360a40949c8a6df6c",
"groupId" : "533c5895b91030606f21033a",
"hostname" : "localhost",
"port" : 26000,
"deactivated" : false,
"hasStartupWarnings" : false,
"sslEnabled" : true,
"logsEnabled" : false,
"created" : "2014-04-22T19:56:50Z",
"hostEnabled" : true,
"journalingEnabled" : false,
"alertsEnabled" : true,
"hidden" : false,
"muninEnabled" : false,
"profilerEnabled" : false,
"lowUlimit" : false,
"authMechanismName" : "MONGODB_CR",
"username" : "mongo",
"links" : [ ... ]
}, {
...
} ]
}
Delete a host:
curl -u "username:apiKey" "https://mms.mongodb.com/api/public/v1.0/groups/533c5895b91030606f21033a/hosts/680ab316473d6b28f966364b947134fc" --digest -i -X DELETE
HTTP/1.1 200 OK