假设我有通常侦听端口8080的服务,如果我指定
8080
prometheus.port=1234
它使用1234作为示例端口,但如果不指定它,我将得到8080作为我在标签上设置的值我猜大概是因为
1234
- source_labels: [__meta_dockerswarm_service_label_prometheus_port] regex: (\d+) target_label: __port__ replace: $1 action: replace
czq61nw11#
- target_label: __port__ replacement: 8080 action: replace - source_labels: [__meta_dockerswarm_service_label_prometheus_port] regex: (\d+) target_label: __port__ replacement: $1 action: replace
然后与以下内容结合使用以提供服务的端口号
- source_labels: [ __meta_dockerswarm_service_name ] target_label: service action: replace - source_labels: [ __address__ ] target_label: __address__ regex: (.+):(\d+) replacement: $1 action: replace - source_labels: [ __address__, __port__ ] target_label: __address__ regex: (.+);(\d+) replacement: $1:$2 action: replace
1条答案
按热度按时间czq61nw11#
然后与以下内容结合使用以提供服务的端口号