docker监控指标
最后更新于:2022-04-01 21:48:25
* docker remote stats api request
http://192.168.1.158:2375/containers/178f21cd76699f37a378b1ecfd26114eb689cd95bd003f27630d3ea124ae4438/stats
* 监控指标讲解
https://www.datadoghq.com/blog/how-to-collect-docker-metrics/
* 指标监控api
https://github.com/docker/docker/blob/master/api/client/container/stats_helpers.go
```json
{
"read":"2016-06-15T08:34:26.43436643+08:00",
"precpu_stats":{
"cpu_usage":{
"total_usage":33798383633,
"percpu_usage":[
10073518026,
11604821627,
5523203364,
6596840616
],
"usage_in_kernelmode":14780000000,
"usage_in_usermode":13840000000
},
"system_cpu_usage":17605982500000000,
"throttling_data":{
"periods":0,
"throttled_periods":0,
"throttled_time":0
}
},
"cpu_stats":{
"cpu_usage":{
"total_usage":33798849951,
"percpu_usage":[
10073810949,
11604871361,
5523298557,
6596869084
],
"usage_in_kernelmode":14780000000,
"usage_in_usermode":13840000000
},
"system_cpu_usage":17605986490000000,
"throttling_data":{
"periods":0,
"throttled_periods":0,
"throttled_time":0
}
},
"memory_stats":{
"usage":91930624,
"max_usage":93376512,
"stats":{
"active_anon":91705344,
"active_file":4096,
"cache":286720,
"dirty":0,
"hierarchical_memory_limit":1073741824,
"inactive_anon":0,
"inactive_file":221184,
"mapped_file":208896,
"pgfault":43720,
"pgmajfault":0,
"pgpgin":23315,
"pgpgout":20289,
"rss":91643904,
"rss_huge":79691776,
"total_active_anon":91705344,
"total_active_file":4096,
"total_cache":286720,
"total_dirty":0,
"total_inactive_anon":0,
"total_inactive_file":221184,
"total_mapped_file":208896,
"total_pgfault":43720,
"total_pgmajfault":0,
"total_pgpgin":23315,
"total_pgpgout":20289,
"total_rss":91643904,
"total_rss_huge":79691776,
"total_unevictable":0,
"total_writeback":0,
"unevictable":0,
"writeback":0
},
"failcnt":0,
"limit":1073741824
},
"blkio_stats":{
"io_service_bytes_recursive":[
{
"major":8,
"minor":0,
"op":"Read",
"value":0
},
{
"major":8,
"minor":0,
"op":"Write",
"value":8192
},
{
"major":8,
"minor":0,
"op":"Sync",
"value":8192
},
{
"major":8,
"minor":0,
"op":"Async",
"value":0
},
{
"major":8,
"minor":0,
"op":"Total",
"value":8192
},
{
"major":252,
"minor":0,
"op":"Read",
"value":0
},
{
"major":252,
"minor":0,
"op":"Write",
"value":8192
},
{
"major":252,
"minor":0,
"op":"Sync",
"value":8192
},
{
"major":252,
"minor":0,
"op":"Async",
"value":0
},
{
"major":252,
"minor":0,
"op":"Total",
"value":8192
}
],
"io_serviced_recursive":[
{
"major":8,
"minor":0,
"op":"Read",
"value":0
},
{
"major":8,
"minor":0,
"op":"Write",
"value":5
},
{
"major":8,
"minor":0,
"op":"Sync",
"value":5
},
{
"major":8,
"minor":0,
"op":"Async",
"value":0
},
{
"major":8,
"minor":0,
"op":"Total",
"value":5
},
{
"major":252,
"minor":0,
"op":"Read",
"value":0
},
{
"major":252,
"minor":0,
"op":"Write",
"value":5
},
{
"major":252,
"minor":0,
"op":"Sync",
"value":5
},
{
"major":252,
"minor":0,
"op":"Async",
"value":0
},
{
"major":252,
"minor":0,
"op":"Total",
"value":5
}
],
"io_queue_recursive":[
],
"io_service_time_recursive":[
],
"io_wait_time_recursive":[
],
"io_merged_recursive":[
],
"io_time_recursive":[
],
"sectors_recursive":[
]
},
"pids_stats":{
},
"networks":{
"eth0":{
"rx_bytes":1116,
"rx_packets":14,
"rx_errors":0,
"rx_dropped":0,
"tx_bytes":648,
"tx_packets":8,
"tx_errors":0,
"tx_dropped":0
},
"eth1":{
"rx_bytes":7204,
"rx_packets":122,
"rx_errors":0,
"rx_dropped":0,
"tx_bytes":7046,
"tx_packets":89,
"tx_errors":0,
"tx_dropped":0
}
}
}
```
';