8.9.21. 라우터 지표 노출


기본 통계 포트인 1936에서 Prometheus 형식으로 기본적으로 HAProxy 라우터 지표를 노출할 수 있습니다. Prometheus와 같은 외부 메트릭 컬렉션 및 집계 시스템은 HAProxy 라우터 지표에 액세스할 수 있습니다. 브라우저에서 HAProxy 라우터 메트릭을 HTML 및 쉼표로 구분된 값(CSV) 형식으로 볼 수 있습니다.

사전 요구 사항

  • 기본 통계 포트인 1936에 액세스하도록 방화벽을 구성했습니다.

프로세스

  1. 다음 명령을 실행하여 라우터 Pod 이름을 가져옵니다.

    $ oc get pods -n openshift-ingress

    출력 예

    NAME                              READY   STATUS    RESTARTS   AGE
    router-default-76bfffb66c-46qwp   1/1     Running   0          11h

  2. 라우터 Pod가 /var/lib/haproxy/conf/metrics-auth/statsUsername/var/lib/haproxy/conf/metrics-auth/statsPassword 파일에 저장하는 라우터의 사용자 이름과 암호를 가져옵니다.

    1. 다음 명령을 실행하여 사용자 이름을 가져옵니다.

      $ oc rsh <router_pod_name> cat metrics-auth/statsUsername
    2. 다음 명령을 실행하여 암호를 가져옵니다.

      $ oc rsh <router_pod_name> cat metrics-auth/statsPassword
  3. 다음 명령을 실행하여 라우터 IP 및 메트릭 인증서를 가져옵니다.

    $ oc describe pod <router_pod>
  4. 다음 명령을 실행하여 Prometheus 형식으로 원시 통계를 가져옵니다.

    $ curl -u <user>:<password> http://<router_IP>:<stats_port>/metrics
  5. 다음 명령을 실행하여 메트릭에 안전하게 액세스합니다.

    $ curl -u user:password https://<router_IP>:<stats_port>/metrics -k
  6. 다음 명령을 실행하여 기본 stats 포트 1936에 액세스합니다.

    $ curl -u <user>:<password> http://<router_IP>:<stats_port>/metrics

    예 8.1. 출력 예

    ...
    # HELP haproxy_backend_connections_total Total number of connections.
    # TYPE haproxy_backend_connections_total gauge
    haproxy_backend_connections_total{backend="http",namespace="default",route="hello-route"} 0
    haproxy_backend_connections_total{backend="http",namespace="default",route="hello-route-alt"} 0
    haproxy_backend_connections_total{backend="http",namespace="default",route="hello-route01"} 0
    ...
    # HELP haproxy_exporter_server_threshold Number of servers tracked and the current threshold value.
    # TYPE haproxy_exporter_server_threshold gauge
    haproxy_exporter_server_threshold{type="current"} 11
    haproxy_exporter_server_threshold{type="limit"} 500
    ...
    # HELP haproxy_frontend_bytes_in_total Current total of incoming bytes.
    # TYPE haproxy_frontend_bytes_in_total gauge
    haproxy_frontend_bytes_in_total{frontend="fe_no_sni"} 0
    haproxy_frontend_bytes_in_total{frontend="fe_sni"} 0
    haproxy_frontend_bytes_in_total{frontend="public"} 119070
    ...
    # HELP haproxy_server_bytes_in_total Current total of incoming bytes.
    # TYPE haproxy_server_bytes_in_total gauge
    haproxy_server_bytes_in_total{namespace="",pod="",route="",server="fe_no_sni",service=""} 0
    haproxy_server_bytes_in_total{namespace="",pod="",route="",server="fe_sni",service=""} 0
    haproxy_server_bytes_in_total{namespace="default",pod="docker-registry-5-nk5fz",route="docker-registry",server="10.130.0.89:5000",service="docker-registry"} 0
    haproxy_server_bytes_in_total{namespace="default",pod="hello-rc-vkjqx",route="hello-route",server="10.130.0.90:8080",service="hello-svc-1"} 0
    ...
  7. 브라우저에 다음 URL을 입력하여 통계 창을 시작합니다.

    http://<user>:<password>@<router_IP>:<stats_port>
  8. 선택 사항: 브라우저에 다음 URL을 입력하여 CSV 형식으로 통계를 가져옵니다.

    http://<user>:<password>@<router_ip>:1936/metrics;csv
Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 문서 정보

Legal Notice

Theme

© 2026 Red Hat
맨 위로 이동