Prometheus use http_sd_configs

Share a configuration example using http_sd_configs

scrape_configs:
  - job_name: icmp
    metrics_path: /probe

    http_sd_configs:
    - url: https://private-domain/v1/network/icmp/global
      refresh_interval: 300s
      basic_auth:
        username: op_mon_pm_r
        password: oo

    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - source_labels: [ __meta_blackbox_instance ]
        target_label: __address__
      - source_labels: [ __meta_params_module ]
        target_label: __param_module
      - source_labels: [ __meta_zone  ]
        target_label: zone
      - source_labels: [ __meta_blackbox_instance ]
        target_label: src

The message structure returned by the request interface

This is snmp service discovery based on network devices

scrape_configs:
  - job_name: snmp
    scrape_interval: 60s
    scrape_timeout: 60s
    metrics_path: /snmp

    http_sd_configs:
      - url: https://private-domain/v1/network/snmp/ops
        refresh_interval: 600s
        basic_auth:
          username: op_mon_pm_r
          password:  oo

    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - source_labels: [ __meta_instance_mib ]
        target_label: __param_module
      - source_labels: [ __meta_name  ]
        target_label: name
      - source_labels: [ __meta_instance_src ]
        replacement: $1:9116
        target_label: __address__

This is based on the configuration discovery of Node_exporter

  - job_name: host
    http_sd_configs:
    - url: https://private-domain/v1/instance/pig/tencent
      refresh_interval: 300s
      basic_auth:
        username: op_mon_pm_r
        password: oo

    relabel_configs:
      - source_labels: [ __address__  ]
        replacement: $1:9100
        target_label: __address__