콘텐츠로 이동

Haproxy

Haproxy 메트릭 정보를 수집합니다.

설치 배포

버전 요구사항

  • HAProxy 2.0
  • HAProxy Enterprise 2.0r1
  • HAProxy ALOHA 11.5

1. Haproxy 메트릭 활성화

Haproxy 설정 파일을 조정하여 다음 모듈 설정을 추가합니다:

frontend prometheus
  bind *:8405
  mode http
  http-request use-service prometheus-exporter if { path /metrics }
  no log
......

prometheus-exporter를 통해 메트릭 정보를 노출하며, 포트는 8405이고 path는 /metrics입니다.

Haproxy 서비스를 재시작합니다. 8405 포트에 접근하여 메트릭 정보를 가져올 수 있으며, 예시는 다음과 같습니다:

# HELP haproxy_process_nbthread Number of started threads (global.nbthread)
# TYPE haproxy_process_nbthread gauge
haproxy_process_nbthread 8
# HELP haproxy_process_nbproc Number of started worker processes (historical, always 1)
# TYPE haproxy_process_nbproc gauge
haproxy_process_nbproc 1
# HELP haproxy_process_relative_process_id Relative worker process number (1)
# TYPE haproxy_process_relative_process_id gauge
haproxy_process_relative_process_id 1
# HELP haproxy_process_uptime_seconds How long ago this worker process was started (seconds)
# TYPE haproxy_process_uptime_seconds gauge
haproxy_process_uptime_seconds 1364
...

2. DataKit 수집기 설정

2.1 DataKit 설치

2.2 수집기 설정

Haproxymetrics url을 직접 노출할 수 있으므로, prom 수집기를 통해 바로 수집할 수 있습니다.

DataKit 설치 디렉터리conf.d/samples로 이동한 뒤, prom.conf.samplehaproxy.conf로 복사합니다.

cp prom.conf.sample haproxy.conf

haproxy.conf 내용을 다음과 같이 조정합니다:

  urls = ["http://localhost:8405/metrics"]

  source = "haproxy"

  interval = "10s"
  ...

기타 설정은 필요에 따라 조정

, 매개변수 설명:

  • urls:haproxy 메트릭 주소로, 여기에는 해당 구성 요소가 노출하는 메트릭 url을 입력합니다
  • source:수집기 별칭, 구분되도록 설정하는 것을 권장합니다
  • keep_exist_metric_name: 메트릭 이름 유지
  • interval:수집 간격

3. DataKit 재시작

DataKit 재시작

메트릭

haproxy 메트릭 집합

Metrics 설명 단위
backend_bytes_in_total 백엔드 총 수신 바이트 byte
backend_bytes_out_total 백엔드 총 송신 바이트 byte
backend_client_aborts_total 백엔드 클라이언트 중단 총수 count
backend_connect_time_average_seconds 백엔드 평균 연결 시간(초) seconds
backend_connection_attempts_total 백엔드 연결 시도 총수 count
backend_connection_errors_total 백엔드 연결 오류 총수 count
backend_connection_reuses_total 백엔드 연결 재사용 총수 count
backend_current_queue 백엔드 현재 큐 count
backend_current_sessions 백엔드 현재 세션 수 count
backend_internal_errors_total 백엔드 내부 오류 총수 count
backend_loadbalanced_total 백엔드 로드 밸런싱 총수 count
backend_max_queue 백엔드 최대 큐 count
backend_max_sessions 백엔드 최대 세션 수 count
backend_requests_denied_total 백엔드 거부된 요청 총수 count
backend_response_errors_total 백엔드 응답 오류 총수 count
backend_responses_denied_total 백엔드 거부된 응답 총수 count
backend_retry_warnings_total 백엔드 재시도 경고 총수 count
backend_server_aborts_total 백엔드 서버 중단 총수 count
backend_sessions_total 백엔드 세션 총수 count
frontend_bytes_in_total 프런트엔드 총 수신 바이트 byte
frontend_bytes_out_total 프런트엔드 총 송신 바이트 byte
frontend_connections_total 프런트엔드 연결 총수 count
frontend_current_sessions 프런트엔드 현재 활성 세션 수 count
frontend_denied_connections_total 프런트엔드 거부된 연결 총수 count
frontend_denied_sessions_total 프런트엔드 거부된 세션 총수 count
frontend_intercepted_requests_total 프런트엔드 가로챈 요청 총수 count
frontend_internal_errors_total 프런트엔드 내부 오류 총수 count
frontend_limit_session_rate 프런트엔드 세션 속도 제한 count
frontend_limit_sessions 프런트엔드 세션 제한 수 count
frontend_max_sessions 프런트엔드 최대 세션 수 count
frontend_request_errors_total 프런트엔드 요청 오류 총수 count
frontend_requests_denied_total 프런트엔드 거부된 요청 총수 count
frontend_responses_denied_total 프런트엔드 거부된 응답 총수 count
frontend_sessions_total 프런트엔드 세션 총수 count
server_bytes_in_total 서버 총 수신 바이트 byte
server_bytes_out_total 서버 총 송신 바이트 byte
server_response_errors_total 서버 응답 오류 총수 count
server_response_time_average_seconds 서버 평균 응답 시간(초) seconds
server_responses_denied_total 서버 거부된 응답 총수 count
server_retry_warnings_total 서버 재시도 경고 총수 count
server_safe_idle_connections_current 서버 현재 안전 유휴 연결 수 count
server_server_aborts_total 서버 서버 중단 총수 count
server_sessions_total 서버 세션 총수 count
server_used_connections_current 서버 현재 사용 중인 연결 수 count
server_uweight 서버 비가중치 count
server_weight 서버 가중치 count

더 많은 메트릭 설명은 haproxy 공식 문서를 참고하세요.

문서 평가

이 페이지가 도움이 되었나요?