Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] How to collect information from containers with multiple port mappings and data volumes? #2695

Open
whls opened this issue Sep 9, 2024 · 0 comments
Labels
question Further information is requested

Comments

@whls
Copy link

whls commented Sep 9, 2024

Question

According to the Docker monitoring template , I added indicators for the collection container mapping port and data volume, but only one port mapping and one data volume were collected, how can I collect information from containers with multiple port mappings and data volumes?

My Docker monitoring template:
fields:
- field: privateport
i18n:
zh-CN: 私有端口
en-US: privateport
type: 1
- field: publicport
i18n:
zh-CN: 公有端口
en-US: publicport
type: 1
- field: mountssource
i18n:
zh-CN: 挂载源
en-US: mountssource
type: 1
- field: mountsdestination
i18n:
zh-CN: 挂载目标
en-US: mountsdestination
type: 1
- field: volumename
i18n:
zh-CN: 数据卷名
en-US: volumename
type: 1
aliasFields:
- Id
- $.Names[0]
- Image
- Command
- $.HostConfig.NetworkMode
- $.NetworkSettings.Networks..IPAddress
- $.Ports[0].PrivatePort
- $.Ports[0].PublicPort
- $.Mounts[0].Type
- $.Mounts[0].Source
- $.Mounts[0].Destination
- $.Mounts[0].Name
- State
- Status
calculates:
- id = Id
- name=#$.Names[0]
- image = Image
- command = Command
- networkmode = $.HostConfig.NetworkMode
- ipaddress = $.NetworkSettings.Networks.
.IPAddress
- privateport = $.Ports[0].PrivatePort
- publicport = $.Ports[0].PublicPort
- mountstype = $.Mounts[0].Type
- mountssource = $.Mounts[0].Source
- mountsdestination = $.Mounts[0].Destination
- volumename = $.Mounts[0].Name
- state = State
- status = Status
# Protocols used for monitoring and collection eg: sql, ssh, http, telnet, wmi, snmp, sdk
# 监控采集使用协议 eg: sql, ssh, http, telnet, wmi, snmp, sdk
protocol: http
# When the protocol is the http protocol, the specific collection configuration
# 当protocol为http协议时具体的采集配置
http:
# Host host: ipv4 ipv6 domain name
# 主机host: ipv4 ipv6 域名
host: ^^host^^
# port
# 端口
port: ^^port^^
# url request interface path
# url请求接口路径
url: /containers/json?all=true
# # request method GET POST PUT DELETE PATCH
# 请求方式 GET POST PUT DELETE PATCH
method: GET
# Whether to enable ssl/tls, that is, http or https, the default is false
# 是否启用ssl/tls,即是http还是https,默认false
ssl: ^^ssl^^
# Response data analysis method: default-system rules, jsonPath-jsonPath script, website-api usability metric monitoring
# 响应数据解析方式: default-系统规则,jsonPath-jsonPath脚本,website-api可用性指标监控
parseType: jsonPath
parseScript: '$.*'

@whls whls added the question Further information is requested label Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant