IBM Cloud Docs
监控IBM Cloudant集群

监控IBM Cloudant集群

确保最佳性能的关键部分、 或排除任何故障、 监控受影响的系统。

监控 API 仅适用于IBM® Cloudant® for IBM Cloud®专用集群的企业客户,而不适用于IBM Cloud®公共客户。

你要能够回答这个问题:

修改配置或应用程序后,系统行为发生了哪些变化?

要回答这个问题 你需要数据。 数据来自系统监控。 可以使用 _active_tasks 端点在复制时监控系统、 端点进行监控,详情请参见 Active 任务 文档。

如需了解更详细的系统信息、 使用群集监控 API。

监测指标概览

监控群集时、 可以获取有关集群运行情况的数据。 详细信息,例如每秒处理的 HTTP 请求数量、 或每秒处理了多少文档、 都可以通过监控 API 获取。 API 只能由管理用户调用、 并应用于特定的监控端点。

例如 如果您想监控映射函数每秒处理的文件数量、 您可以将请求指向 map_doc 端点。

如需了解更多信息,请参阅可用 端点 的完整列表。

数据默认以 JSON 格式返回。 如果您愿意,也可以指定 raw 格式。

监测请求语法

向监控 API 提出的所有请求都采用以下形式:

curl -u $ADMIN_USER "https://$ADMIN_USER.cloudant.com/_api/v2/monitoring/$END_POINT?cluster=$CLUSTER[&format=(json|raw)]"

下表中描述了各个字段:

监控 API 请求字段
字段 含义
ADMIN_USER 账户名称。 账户必须具有管理权限。
CLUSTER 您感兴趣的集群。
DURATION 指定首选时间序列查询的持续时间。 Select from one of the following time intervals: ["5min", "30min", "1h", "12h", "24h", "1d", "3d", "7d", "1w", "1m", "3m", "6m", "12m", "1y"]. DURATION must be paired with either the START or END request.
END UTC时间戳(ISO-8601)或UTC纪元秒(UTC epoch second),用于指定时间序列查询的结束时间。 时间戳不能在 STARTEND 相同、ENDEND 之前或 STARTSTART 之后的情况下查询。
END_POINT 您要监控的群集 方面
START 以ISO-8601表示的 UTC 时间戳或整数秒,其中纪元格式指定了与 END 互斥的时间序列查询的起点。

有几个字段有默认值:

监控 API 请求字段的默认值
字段 缺省值
DURATION 5 分钟
END 无缺省值
START 当前时间

结果格式

默认情况下 监控结果以 JSON 格式 返回。 如果您愿意 您可以选择以 raw 格式 接收结果。

结果包括一个文本字符串,用于标识存储在提供 API 功能的服务器上的指标、 例如

sumSeries(net.cloudant.mycustomer001.db*.df.srv.used)

结果包括组群一级的数据。

IBM Cloudant以下列分辨率存储所查询的数据:过去 24 小时的数据为 10 秒;过去 7 天的数据为 1 分钟;过去 2 年的数据为 1 小时。 因此,为确保IBM Cloudant始终存储较高分辨率的区间长度,这些分辨率边界上的三角洲会被裁剪为一个区间的长度。

format=json(默认值)

除非另有说明、 返回的度量数据为 JSON 格式。 返回的每个值都由 [datapoint, timestamp] 个值组成。

请参阅以 JSON 格式返回的磁盘使用数据监控请求示例:

curl "https://$ACCOUNT.cloudant.com/_api/v2/monitoring/disk_use?cluster=myclustername&format=json"

查看以 JSON 格式申请磁盘使用数据后的结果示例:

[
	{
		"target": "sumSeries(net.cloudant.mycustomer001.db*.df.srv.used)",
		"datapoints": [
			[523562172416.0, 1391019360],
			[524413976576.0, 1391019420],
			[519036682240.0, 1391019480],
			[518762102784.0, 1391019540],
			[523719393280.0, 1391019600]
		]
	},
	{
		"target": "sumSeries(net.cloudant.mycustomer001.db*.df.srv.free)",
		"datapoints": [
			[6488926978048.0, 1391019360],
			[6487768301568.0, 1391019420],
			[6493145661440.0, 1391019480],
			[6493420257280.0, 1391019540],
			[4330660167680.0, 1391019600]
		]
	}
]

使用 format=raw

The raw format data contains a series of text strings, identifying the name of the metric and associated values.

文本字符串(例如 sumSeries(net.cloudant.mycustomer001.db*.df.srv.used))是度量名称。 接下来的两个数字是开始和结束时间、 以 UTC 时区秒数表示。 最后一个数字是步长,单位为秒。

| 字符后面的数字包含从所选端点获取的度量数据。 例如 从磁盘使用端点请求度量数据会返回 df 命令的输出、 磁盘使用量表示为存储的字节数。

请参阅以 raw 格式返回的磁盘使用数据监控请求示例:

curl "https://$ACCOUNT.cloudant.com/_api/v2/monitoring/disk_use?cluster=myclustername&format=raw"

查看以 raw 格式申请磁盘使用数据后的结果示例:

sumSeries(net.cloudant.mycustomer001.db*.df.srv.used),1391019780,1391020080,60|344708448256.0,345318227968.0,346120126464.0,346716471296.0,175483256832.0
sumSeries(net.cloudant.mycustomer001.db*.df.srv.free),1391019780,1391020080,60|6.49070326579e+12,6.4896982057e+12,6.48884414054e+12,6.48801589658e+12,4.32277107507e+12

监测终点

列出当前支持的所有监控端点、 向 monitoring 端点发出请求。

下表列出了 API 所支持的监控端点:

监控应用程序接口端点
端点 描述
connections 多个负载平衡器连接的状态。
disk_use df 命令测量的磁盘使用量。
kv_emits 每秒发射 key:value 的次数。
map_doc 地图功能每秒处理的文件数量。
network 接收和传输的字节数。
rate/status_code 按状态代码分组的请求率。
rate/verb 按 HTTP verb 分类的请求率。
rps 每秒的读取次数。
wps 每秒写入次数。

请参阅示例,了解如何获取当前支持的监控端点列表:

curl "https://$ACCOUNT.cloudant.com/_api/v2/monitoring"

请参阅列出可用监控端点的响应示例:

{
    "targets": [
        "node_disk_free_srv",
        "rps",
        "kv_emits",
        "smoosh_channels/slack_dbs",
        "smoosh_channels/upgrade_dbs",
        "smoosh_channels/ratio_dbs",
        "smoosh_channels/ratio_views",
        "smoosh_channels/slack_views",
        "smoosh_channels/upgrade_views",
        "uptime",
        "map_doc",
        "wps",
        "node_peak_cpu",
        "rate/status_code",
        "rate/verb",
        "disk_use",
        "node_mean_cpu",
        "memory",
        "os_proc_count",
        "run_queue",
        "node_disk_use_srv",
        "process_count",
        "response_time"
    ]
}

监测请求示例

connections

请参阅 connections 监控请求示例:

curl "https://$ACCOUNT.cloudant.com/_api/v2/monitoring/connections?cluster=myclustername&node=myloadbalancername&format=json"

响应包括以下连接状态的数据序列:

{
  "end": 1512989500,
  "start": 1512989170,
  "target_responses": [
     {
       "datapoints": [
            [
              0,
              1512989170
            ]
        ],
        "target": "myclustername.myloadbalancername Connections CLOSED"
      },
      {
        "datapoints": [
            [
              19,
              1512989170
            ]
        ],
        "target": "myclustername.myloadbalancername Connections CLOSE_WAIT"
      },
      {
        "datapoints": [
            [
              2,
              1512989170
            ]
        ],
        "target": "myclustername.myloadbalancername Connections CLOSING"
      },
      {
        "datapoints": [
            [
              280,
              1512989170
            ]
        ],
        "target": "myclustername.myloadbalancername Connections ESTABLISHED"
      },
      {
        "datapoints": [
            [
              7,
              1512989170
            ]
        ],
        "target": "myclustername.myloadbalancername Connections FIN_WAIT1"
      },
      {
        "datapoints": [
            [
              0,
              1512989170
            ]
        ],
        "target": "myclustername.myloadbalancername Connections FIN_WAIT2"
      },
      {
        "datapoints": [
            [
              0,
              1512989170
            ]
        ],
        "target": "myclustername.myloadbalancername Connections LAST_ACK"
      },
      {
        "datapoints": [
            [
              4,
              1512989170
            ]
        ],
        "target": "myclustername.myloadbalancername Connections LISTEN"
      },
      {
        "datapoints": [
            [
              1,
              1512989170
            ]
        ],
        "target": "myclustername.myloadbalancername Connections SYN_RECV"
      },
      {
        "datapoints": [
            [
              0,
              1512989170
            ]
        ],
        "target": "myclustername.myloadbalancername Connections SYN_SENT"
      },
      {
        "datapoints": [
            [
              28,
              1512989170
              ]
            ],
        "target": "myclustername.myloadbalancername Connections TIME_WAIT"
      }
   ]
}

您必须在请求中明确指定负载平衡器。

disk_use

请参阅 disk_use 监控请求示例:

curl "https://$ACCOUNT.cloudant.com/_api/v2/monitoring/disk_use?cluster=myclustername&format=json"

请参阅 disk_use 监控请求的结果示例(缩写):

{
	"start": 1435935759,
	"end": 1435936059,
	"target_responses": [
		{
			"target": "myclustername Used disk space (bytes)",
			"datapoints": [
				[
					6855438336.0,
					1435935780
				],
				[
					null,
					1435935795
				],
				[
					null,
					1435935810
				],
				...
				[
					null,
					1435936065
				]
			]
		},
		{
			"target": "myclustername Free disk space (bytes)",
			"datapoints": [
				[
					7141069422592.0,
					1435935780
				],
				[
					null,
					1435935795
				],
				[
					null,
					1435935810
				],
				...
				[
					null,
					1435936065
				]
			]
		}
	]
}

kv_emits

请参阅 kv_emits 监控请求示例:

curl "https://$ACCOUNT.cloudant.com/_api/v2/monitoring/kv_emits?cluster=myclustername&format=json"

请参阅 kv_emits 监控请求的结果示例(缩写):

{
	"start": 1436194248,
	"end": 1436194548,
	"target_responses": [
		{
			"target": "myclustername Key:value pairs emitted per second from map functions",
			"datapoints": [
				[
					0.0,
					1436194230
				],
				[
					0.0,
					1436194245
				],
				[
					0.8000000000001819,
					1436194260
				],
				...
				[
					null,
					1436194515
				]
			]
		}
	]
}

map_doc

请参阅 map_doc 监控请求示例:

curl "https://$ACCOUNT.cloudant.com/_api/v2/monitoring/map_doc?cluster=myclustername&format=json"

请参阅 map_doc 监控请求的结果示例(缩写):

{
	"start": 1436194475,
	"end": 1436194775,
	"target_responses": [
		{
			"target": "myclustername Documents per second through map functions",
			"datapoints": [
				[
					0.0,
					1436194480
				],
				[
					0.5,
					1436194495
				],
				[
					0.4000000000005457,
					1436194510
				],
				...
				[
					0.0,
					1436194765
				]
			]
		}
	]
}

network

curl "https://$ACCOUNT.cloudant.com/_api/v2/monitoring/network?cluster=myclustername&node=myloadbalancername&format=json"
{
  "end": 1512989748,
  "start": 1512989450,
  "target_responses": [
      {
        "datapoints": [
          [
           20247725.5,
           1512989450
          ]
        ],
        "target": "myclustername Octets tx Per Second"
      },
      {
         "datapoints": [
             [
               17697329.3046875,
               1512989450
             ]
         ],
         "target": "myclustername Octets rx Per Second"
       }
    ]
}

您必须在请求中明确指定负载平衡器。

rate/status_code

请参阅 rate/status_code 监控请求示例:

curl "https://$ACCOUNT.cloudant.com/_api/v2/monitoring/rate/status_code?cluster=myclustername&format=json"

请参阅 rate/status_code 监控请求的结果示例(缩写):

{
	"start": 1436194902,
	"end": 1436195202,
	"target_responses": [
		{
			"target": "myclustername 2xx",
			"datapoints": [
				[
					null,
					1436194910
				],
				[
					36.0,
					1436194920
				],
				...
				[
					0.0,
					1436195200
				]
			]
		},
		{
			"target": "myclustername 3xx",
			"datapoints": [
				[
					null,
					1436194910
				],
				[
					0.0,
					1436194920
				],
				...
				[
					null,
					1436195200
				]
			]
		},
		{
			"target": "myclustername 4xx",
			"datapoints": [
				[
					null,
					1436194910
				],
				[
					0.0,
					1436194920
				],
				...
				[
					0.0,
					1436195200
				]
			]
		},
		{
			"target": "myclustername 5xx",
			"datapoints": [
				[
					null,
					1436194910
				],
				[
					0.0,
					1436194920
				],
				...
				[
					null,
					1436195200
				]
			]
		}
	]
}

rate/verb

请参阅 rate/verb 监控请求示例:

curl "https://$ACCOUNT.cloudant.com/_api/v2/monitoring/rate/verb?cluster=myclustername&format=json"

请参阅 rate/verb 监控请求的结果示例(缩写):

{
	"start": 1436195497,
    "end": 1436195797,
	"target_responses": [
		{
			"target": "myclustername GET",
			"datapoints": [
				[
					null,
					1436195500
				],
				[
					36.0,
					1436195510
				],
				...
				[
					49.5,
					1436195790
				]
			]
		},
		{
			"target": "myclustername POST",
			"datapoints": [
				[
					null,
					1436195500
				],
				[
					0.0,
					1436195510
				],
				...
				[
					0.0,
					1436195790
				]
			]
		},
		{
			"target": "myclustername PUT",
			"datapoints": [
				[
					null,
					1436195500
				],
				[
					0.0,
					1436195510
				],
				...
				[
					0.0,
					1436195790
				]
			]
		},
		{
			"target": "myclustername DELETE",
			"datapoints": [
				[
					null,
					1436195500
				],
				[
					0.0,
					1436195510
				],
				...
				[
					0.0,
					1436195790
				]
			]
		},
		{
			"target": "myclustername COPY",
			"datapoints": [
				[
					null,
					1436195500
				],
				[
					0.0,
					1436195510
				],
				...
				[
					0.0,
					1436195790
				]
			]
		},
		{
			"target": "myclustername HEAD",
			"datapoints": [
				[
					null,
					1436195500
				],
				[
					0.0,
					1436195510
				],
				...
				[
					0.0,
					1436195790
				]
			]
		}
	]
}

response_time

请参阅 response_time 监控请求示例:

curl "https://$ACCOUNT.cloudant.com/_api/v2/monitoring/response_time?cluster=myclustername&format=json"

请参阅 response_time 监控请求的结果示例(缩写):

{
  "start": 1523984559,
  "end": 1523984859,
  "target_responses": [
    {
      "datapoints": [
        [
          118.1668472290039,
          1523984540
        ],
        [
          90.57628631591797,
          1523984550
        ],
        [
          142.6778106689453,
          1523984560
        ],
        [
          118.42487335205078,
          1523984570
        ],
        [
          120.38044738769531,
          1523984580
        ],
        [
          103.94148254394531,
          1523984590
        ],
        [
          126.64134979248047,
          1523984600
        ],
        [
          113.03324127197266,
          1523984610
        ],
        [
          136.9058074951172,
          1523984620
        ],
        [
          148.68711853027344,
          1523984630
        ],
        [
          121.22771453857422,
          1523984640
        ],
        [
          142.86459350585938,
          1523984650
        ],
        [
          103.75953674316406,
          1523984660
        ],
        [
          139.1707763671875,
          1523984670
        ],
        [
          118.29866027832031,
          1523984680
        ],
        [
          126.3541259765625,
          1523984690
        ],
        [
          115.5962905883789,
          1523984700
        ],
        [
          106.68751525878906,
          1523984710
        ],
        [
          144.12387084960938,
          1523984720
        ],
        [
          103.8598861694336,
          1523984730
        ],
        [
          136.84429931640625,
          1523984740
        ],
        [
          110.58084106445312,
          1523984750
        ],
        [
          94.69702911376953,
          1523984760
        ],
        [
          126.85747528076172,
          1523984770
        ],
        [
          100.8759994506836,
          1523984780
        ],
        [
          145.0876922607422,
          1523984790
        ],
        [
          100.77622985839844,
          1523984800
        ],
        [
          null,
          1523984810
        ],
        [
          null,
          1523984820
        ],
        [
          null,
          1523984830
        ]
      ],
      "target": "myclustername Response Time (ms)"
    }
  ]
}

rps

请参阅 rps 监控请求示例:

curl "https://$ACCOUNT.cloudant.com/_api/v2/monitoring/rps?cluster=myclustername&format=json"

请参阅 rps 监控请求的结果示例(缩写):

{
	"start": 1436195908,
	"end": 1436196208,
	"target_responses": [
		{
			"target": "myclustername Document Reads Per Second",
			"datapoints": [
				[
					0.20000000001164153,
					1436195910
				],
				[
					0.10000000000582077,
					1436195925
				],
				...
				[
					null,
					1436196195
				]
			]
		}
	]
}

wps

请参阅 wps 监控请求示例:

curl "https://$ACCOUNT.cloudant.com/_api/v2/monitoring/wps?cluster=myclustername&format=json"

请参阅 wps 监控请求的结果示例(缩写):

{
	"start": 1436195999,
	"end": 1436196299,
	"target_responses": [
		{
			"target": "myclustername Document Writes Per Second",
			"datapoints": [
				[
					1.2999999999992724,
					1436196000
				],
				[
					0.5,
					1436196015
				],
				...
				[
					null,
					1436196285
				]
			]
		}
	]
}