HAProxy Enterprise Documentation 2.1r1

Monitor URI

You can use the monitor-uri and monitor fail directives in a frontend or listen section to present a webpage that monitoring software like Nagios, Incinga or others can check periodically to know the state of the load balancer.

Enable the monitoring page

In a frontend or listen section, add a monitor-uri directive. Its value is a URL path that does not map to any resource on your backend servers. HAProxy Enterprise will respond with an HTTP 200 OK whenever a client requests that path.

Then, use monitor fail to return an HTTP 503 Service Unavailable response if a given condition is true.

In this example, we present a page at /checkstatus that monitoring software can request periodically.

frontend www
   bind :80
   monitor-uri /checkstatus
   monitor fail if { nbsrv(webservers) eq 0 }
   default_backend webservers

The page returns an OK message until the if statement on the monitor fail line becomes true. In this case, the expression uses the nbsrv fetch method to check the number of servers that are up in the webservers backend. It returns true when there are zero servers up.


Next up

Integrations
HAProxyConf Registration