Introduction

HAProxy is a high-performance, open-source load balancer and reverse proxy for TCP and HTTP applications. Monitoring HAProxy is essential for tracking key performance metrics such as request rates, response times, error rates, active sessions, and backend health.

To monitor HAProxy efficiently, we can use the OpenTelemetry HAProxy Receiver, which collects key HAProxy performance metrics and makes them available for analysis.

Kubernetes 2.0 ConfigMap

Users should update or append the existing ConfigMap named opsramp-workload-metric-user-config by adding application-specific fields. These fields may include authentication credentials, collection frequency, and other relevant configurations. To run OpenTelemetry Redis Receiver with Kubernetes, you need to create a ConfigMap and deploy it.

apiVersion: v1
kind: ConfigMap
metadata:
  name: haproxy-config
  namespace: default
data:
  haproxy.cfg: |
    global
        log stdout format raw local0
        stats socket /var/run/haproxy.sock mode 660 level admin
        maxconn 4000

    defaults
        mode http
        log global
        option httplog
        timeout connect 5s
        timeout client 50s
        timeout server 50s

    frontend http_front
        bind *:8080  # Changed from 80 to 8080
        default_backend http_back

    backend http_back
        balance roundrobin
        server server1 127.0.0.1:8080 check

    listen stats
        bind *:8081  # Changed from 8404 to 8081
        stats enable
        stats uri /stats
        stats refresh 10s

Supported Metrics

Supported metrics for this workload as provided by the Kubernetes 2.0 Agent.

MetricDescription
haproxy_bytes_inputTotal number of bytes received by HAProxy
haproxy_bytes_outputTotal number of bytes sent by HAProxy
haproxy_connections_errorsNumber of connection errors in HAProxy
haproxy_connections_rateRate of new connections in HAProxy
haproxy_connections_retriesNumber of connection retries in HAProxy
haproxy_requests_deniedNumber of denied requests in HAProxy
haproxy_requests_errorsNumber of requests that resulted in errors in HAProxy
haproxy_requests_queuedNumber of requests queued in HAProxy
haproxy_requests_rateRate of requests received by HAProxy
haproxy_requests_redispatchedNumber of requests redispatched by HAProxy
haproxy_requests_totalTotal number of requests received by HAProxy
haproxy_responses_deniedNumber of denied responses in HAProxy
haproxy_responses_errorsNumber of responses that resulted in errors in HAProxy
haproxy_server_selected_totalTotal number of times a server was selected in HAProxy
haproxy_sessions_averageAverage number of sessions in HAProxy
haproxy_sessions_countTotal number of active sessions in HAProxy
haproxy_sessions_rateRate of new sessions in HAProxy