HAProxy is free, open source software that provides a high availability load balancer and proxy server for TCP and HTTP-based applications that spreads requests across multiple servers. It is written in C and has a reputation for being fast and efficient.
Prerequisites
- Add the following to the file path
/etc/haproxy/haproxy.cfg
:
listen stats
bind *:9000
mode http
stats enable
stats hide-version
stats show-node
stats realm Haproxy\ Statistics
stats uri /haproxy_stats
- For Virtual Machines, install the Linux Agent.
Configuring the credentials
Configure the credentials in the directory /opt/opsramp/agent/conf/app.d/creds.yaml
haproxy:
- name: haproxy
user: <username>
pwd: <Password>
encoding-type: plain
labels:
key1: val1
key2: val2
Configuring the application
Virtual machine
Configure the application in the directory /opt/opsramp/agent/conf/app/discovery/auto-detection.yaml
- name: haproxy
instance-checks:
service-check:
- haproxy
port-check:
- 9000
uri-check:
- "haproxy_stats"
If the URI check is not provided then by default,haproxy_stats
is considered.
Docker environment
Configure the application in the directory /opt/opsramp/agent/conf/app/discovery/auto-container-detection.yaml
- name: haproxy
container-checks:
image-check:
- haproxy
port-check:
- 9000
Kubernetes environment
Configure the application in config.yaml
- name: haproxy
container-checks:
image-check:
- haproxy
port-check:
- 9000
Validate
Go to Resources under the Infrastructure tab to check if your resources are onboarded and the metrics are collected.
Supported metrics
OpsRamp Metric | Metric Display Name | Unit |
---|---|---|
haproxy_status Checks the status of the backend servers (UP/DOWN) | Status | Status |
haproxy_requests_queue Number of requests in the server queue | Queued Requests | requests |
haproxy_session_current Current number of concurrent connections | Sessions Active | sessions |
haproxy_session_rate Number of sessions per second | Sessions | sessions / second |
haproxy_mbytes_rate_in The rate at which the data is received per server in MB | Data Received | MB / second |
haproxy_mbytes_rate_out The rate at which the data is sent per server in MB | Data Sent | MB / second |
haproxy_denied_rate_req The rate of denied requests | Denied Requests | denied req / second |
haproxy_denied_rate_resp The rate of denied responses | Denied Responses | denied resp / second |
haproxy_errors_rate_req The rate of request errors | Request Errors | req errors / second |
haproxy_errors_rate_conn The rate of connection errors | Connection Errors | conn errors / second |
haproxy_errors_rate_resp The rate of response errors | Response Errors | resp errors / second |
haproxy_warning_rate_retr The rate of retries (warning) | Warn Retries | warning retries / second |
haproxy_warning_rate_redis The rate of dispatches (warning) | Warn Redis patches | warning redispatches / second |
haproxy_requests_rate Rate of received HTTP requests | Requests | requests / second |
haproxy_lastchk_time Time taken to finish last health check | Last Health Check Time | millisecondss |
haproxy_servers_active Number of current active servers (backend). Validates against total active servers | Active Servers | active servers |
haproxy_servers_backup Number of current backup servers (backend). Validates against total backup servers | Backup Servers | backup servers |
haproxy_http_errors_1xx Number of http error responses with 1xx code | 1xx HTTP Errors | errors |
haproxy_http_errors_2xx Number of http error responses with 2xx code | 2xx HTTP Errors | errors |
haproxy_http_errors_3xx Number of http error responses with 3xx code | 3xx HTTP Errors | errors |
haproxy_http_errors_4xx Number of http error responses with 4xx code | 4xx HTTP Errors | errors |
haproxy_http_errors_5xx Number of http error responses with 5xx code | 5xx HTTP Errors | errors |