Navigation
You were redirected from a different version of the documentation. Click here to go back.

Create a Host

Base URL: https://<ops-manager-host>/

Start monitoring a new MongoDB process. The Monitoring Agent will start monitoring the MongoDB process on the hostname and port you specify. Ops Manager knows only the information that you provided. Thus, the document returned in the response document will include blank values while Ops Manager discovers the missing values.

Syntax

POST /api/public/v1.0/groups/{GROUP-ID}/hosts

Request Path Parameters

Parameter Required/Optional Description
groupId 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
hostname string Primary hostname. A MongoDB process typically has several aliases, so the primary is the best available name as decided by Ops Manager.
port number Port that MongoDB process (mongod or mongos) listens on.
username string Username for connecting to this MongoDB process. Only present when the authMechanismName is MONGODB_CR.
password string Password for connecting to this MongoDB process. If the process’s authMechanismName is MONGODB_CR, then you must include this field when creating the process or updating its credentials. However, it will never be exposed when a host entity is returned.
sslEnabled boolean Is SSL enabled for this MongoDB process? Must be true if the authMechanismName is MONGODB_X509.
logsEnabled boolean Is Ops Manager collecting logs for this MongoDB process?
alertsEnabled boolean Are alerts enabled for this MongoDB process?
profilerEnabled boolean Is Ops Manager collecting profile information from this MongoDB process?
muninPort number What port should be used to collect Munin stats from this MongoDB process?
authMechanismName string

The authentication mechanism used to connect to this MongoDB process. Possible values are:

  • MONGODB_CR
  • GSSAPI
  • PLAIN
  • MONGODB_X509
  • NONE

Response Elements

Name Type Description
id string Unique identifier.
groupId string ID of the group that owns this alert configuration.
clusterId string The ID of the cluster to which the MongoDB process belongs.
hostname string Primary hostname. A MongoDB process typically has several aliases, so the primary is the best available name as decided by Ops Manager.
port number Port that MongoDB process (mongod or mongos) listens on.
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.

lastPing date When the last ping for this MongoDB process was received.
ipAddress string IP address of this MongoDB process.
version string Version of MongoDB running for this process.
hasStartupWarnings boolean Are there startup warnings for this MongoDB process?
sslEnabled boolean Is SSL enabled for this MongoDB process? Must be true if the authMechanismName is MONGODB_X509.
logsEnabled boolean Is Ops Manager collecting logs for this MongoDB process?
uptimeMsec number Number of milliseconds since this process last restarted.
lastRestart date Date this process last restarted.
deactivated boolean Whether the host is currently active.
lastDataSizeBytes number The size of the host’s databases on disk. This number does not include the data in the local database.
lastIndexSizeBytes number The size of the host’s database indexes on disk. This number does not include the size of the index for the local database.
shardName string Name of the shard this process belongs to. Only present if the process is part of a sharded cluster.
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.
created date Date this MongoDB process was created or first discovered by Ops Manager.
hostEnabled boolean Is this process currently enabled? MongoDB processes can be manually disabled in the Ops Manager UI.
journalingEnabled boolean Is journaling enabled for this MongoDB process?
alertsEnabled boolean Are alerts enabled for this MongoDB process?
muninEnabled boolean Are Munin stats being collected for this MongoDB process?
profilerEnabled boolean Is Ops Manager collecting profile information from this MongoDB process?
lowUlimit boolean Does this MongoDB process’s server have a low ulimit setting?
muninPort number What port should be used to collect Munin stats from this MongoDB process?
authMechanismName string

The authentication mechanism used to connect to this MongoDB process. Possible values are:

  • MONGODB_CR
  • GSSAPI
  • PLAIN
  • MONGODB_X509
  • NONE
username string Username for connecting to this MongoDB process. Only present when the authMechanismName is MONGODB_CR.
password string Password for connecting to this MongoDB process. If the process’s authMechanismName is MONGODB_CR, then you must include this field when creating the process or updating its credentials. However, it will never be exposed when a host entity is returned.
aliases array of strings A list of alternate hostname:port combinations that Ops Manager has discovered for the MongoDB process.
displayName string The MongoDB process’s display name in Ops Manager. If this is not set, Ops Manager displays the hostname instead. To unset this, use an empty string ("") as the value of this field.
links array Array of links to related sub-resources. All links arrays in responses contain at least one link called self.

Example Request

curl -u "username:apiKey" -H "Content-Type: application/json" --digest -X POST "https://<ops-manager-host>/api/public/v1.0/groups/5196d3628d022db4cbc26d9e/hosts" --data '
{
  "hostname": "localhost",
  "port": 27017
}'

Example Response

HTTP/1.1 201 Created

{
  "id" : "4059580c20c4581872ef24d0b8f5dca0",
  "groupId" : "5196d3628d022db4cbc26d9e",
  "hostname" : "localhost",
  "port" : 27017,
  "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" : [ ... ]
}