# HAProxy Integration

Integrating HAProxy with Xitoring brings a powerful synergy to the realm of server and application monitoring. HAProxy, a renowned load balancing and proxy solution, meets its perfect companion in Xitoring, a comprehensive platform offering uptime and server monitoring with a built-in status page. Together, they create a robust ecosystem that ensures the seamless functioning of your applications. By combining the flexibility of HAProxy in managing traffic and ensuring high availability with Xitoring's advanced monitoring capabilities, users gain a holistic view of their system health. This integration not only enhances the performance and reliability of server environments but also provides actionable insights through Xitoring's intuitive interface, empowering users to proactively manage and optimize their infrastructure.

# Enable HAProxy Integration

## Supported platforms

The following guide is working on **Linux** and **Windows servers** but some details could be quite different based on the OS version.

The following lines will walk you through enabling HAProxy integration on Xitoring based on your OS.

## on Linux Server

As Xitogent is using the HAProxy built-in `status` module to get statistics about HAProxy server.

You need to apply the configuration on `/etc/haproxy/haproxy.cfg` and make it like the below:

```text
vim /etc/haproxy/haproxy.cfg
```

Add the configuration that begins with the “stats” keyword.

```text
listen stats
    bind localhost:8404
    stats enable
    stats uri /
```

HAProxy must be restarted to take effect after you save and exit the configuration file.

Now the statistics are available on `127.0.0.1:8404/?stats`

## On Windows Server

Enabling the HAProxy status page on Windows involves modifying your HAProxy configuration file to include the necessary settings for the built-in statistics page. Here's a step-by-step guide: Open your HAProxy Configuration File:

Use a text editor to open your HAProxy configuration file (e.g., haproxy.cfg). Add Configuration for the Stats Page:

Include the following lines in your configuration file:

```text
listen stats
    bind localhost:8404
    stats enable
    stats uri /
```

HAProxy must be restarted to take effect after you save and exit the configuration file.

Now the statistics are available on `127.0.0.1:8404/?stats`

## Enable HAProxy integration on Xitogent

The final step is to call the Xitogent CLI and enable the HAProxy Integration:

```text
xitogent integrate
```

Select HAProxy from the list of available integrations, and it will prompt you for the URL of the location where statistics is served which is `http://127.0.0.1:8404` in our example.

and that's it the HAProxy integration is now enabled and the configuration file is created in the `/etc/xitogent/integrations/haproxy_integration.conf`.

# Create Triggers for HAProxy integration

You can create Triggers for HAProxy integration and define incidents for the following parameters:

```text
Queued
Sessions
Request Byte
Response Byte
Request per second
2XX Requests
4XX Requests
5XX Requests
Last Sessions
Rate
Connection Rate
```
