Prometheus - VMAgent跨网采集metric

2025-01-21

通过在远程vpc部署proxy方式进行跨网采集

https://www.v2fly.org/guide/start.html

{
  "log": {
    "loglevel": "info"
    },
    "routing": {
        "domainStrategy": "AsIs",
        "rules": [
            {
                "ip": [
                    "geoip:private"
                ],
                "outboundTag": "direct",
                "type": "field"
            }
        ]
    },
    "inbounds": [
        {
            "port": 1111,
            "protocol": "http",
            "settings": {
                "auth": "noauth",
                "udp": true
            },
            "tag": "http"
        },
        {
            "port": 2222,
            "protocol": "socks",
            "settings": {
                "auth": "noauth",
                "udp": true
            },
            "tag": "socks"
        }
    ],
    "outbounds": [
        {
            "protocol": "freedom",
            "tag": "direct"
        }
    ]
}
docker run --restart=always -d --name v2ray -v /etc/v2ray/config.json:/etc/v2ray/config.json --net=host ccr.ccs.tencentyun.com/njq-apps/v2fly-core:20250121 run -c /etc/v2ray/config.json
scrape_configs:

- job_name: "test"
  scrape_interval: 15s
  consul_sd_configs:
  - server: 'consul.xx.com:8500'
    services: ["eee-prod-cvm-ap-aaa3"]
    relabel_configs:
    - source_labels: [__meta_consul_service_id]
      target_label:  "instanceId"
    - source_labels: [__address__]
      regex: ([^:]+)(?::\d+)?
      replacement: "$1"
      target_label: instance
      action: replace
      #proxy_url: "http://175.178.171.114:1111"
      proxy_url: "socks5://175.178.171.114:2222"
      metric_relabel_configs:
    - source_labels: [__name__]
      regex: "node_ipvs_backend_connections_inactive|node_ipvs_backend_connections_active|node_ipvs_backend_weight"
      action: drop

标题:Prometheus - VMAgent跨网采集metric
地址:https://blog.njqhome.com:8443/articles/2025/01/21/1737428170794.html