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"
Note
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.
Metrics
OpsRamp Metric | Metric Display Name | Unit | Description |
---|---|---|---|
haproxy_status | Status | Status | Checks the status of the backend servers (UP/DOWN) |
haproxy_requests_queue | Queued Requests | requests | Number of requests in the server queue |
haproxy_session_current | Sessions Active | sessions | Current number of concurrent connections |
haproxy_session_rate | Sessions | sessions / second | Number of sessions per second |
haproxy_mbytes_rate_in | Data Received | MB / second | The rate at which the data is received per server in MB |
haproxy_mbytes_rate_out | Data Sent | MB / second | The rate at which the data is sent per server in MB |
haproxy_denied_rate_req | Denied Requests | denied req / second | The rate of denied requests |
haproxy_denied_rate_resp | Denied Responses | denied resp / second | The rate of denied responses |
haproxy_errors_rate_req | Request Errors | req errors / second | The rate of request errors |
haproxy_errors_rate_conn | Connection Errors | conn errors / second | The rate of connection errors |
haproxy_errors_rate_resp | Response Errors | resp errors / second | The rate of response errors |
haproxy_warning_rate_retr | Warn Retries | warning retries / second | The rate of retries (warning) |
haproxy_warning_rate_redis | Warn Redis patches | warning redispatches / second | The rate of dispatches (warning) |
haproxy_requests_rate | Requests | requests / second | Rate of received HTTP requests |
haproxy_lastchk_time | Last Health Check Time | millisecondss | Time taken to finish last health check |
haproxy_servers_active | Active Servers | active servers | Number of current active servers (backend). Validates against total active servers |
haproxy_servers_backup | Backup Servers | backup servers | Number of current backup servers (backend). Validates against total backup servers |
haproxy_http_errors_1xx | 1xx HTTP Errors | errors | Number of http error responses with 1xx code |
haproxy_http_errors_2xx | 2xx HTTP Errors | errors | Number of http error responses with 2xx code |
haproxy_http_errors_3xx | 3xx HTTP Errors | errors | Number of http error responses with 3xx code |
haproxy_http_errors_4xx | 4xx HTTP Errors | errors | Number of http error responses with 4xx code |
haproxy_http_errors_5xx | 5xx HTTP Errors | errors | Number of http error responses with 5xx code |