Trying to get check_haproxy working

Hi. I’ve installed:

on the LibreNMS server (within the nagios plugins directory) and it comes up in the list of services:

I then add it to the device:


Save Service.

When it runs I get this:


The socket file is present on the endpoint:

# ll /var/run/haproxy.sock
srwxrwxrwx 1 root root 0 Feb 22 01:53 /var/run/haproxy.sock

but my guess is, in the " check_haproxy --help " it says:

-S, --socket /path/to/socket
Path to the socket check_haproxy should connect to (requires
read/write permissions and must be at least user level; no operator
or admin privileges needed).

I assumed that the root:root of the /var/run/haproxy.sock socket was the problem, but it’s rwx for world.

Anyone have any experience with this?


Correct me if I’m wrong, but unix sockets are only accessible on localhost eq. on the same machine.
Data sent through these sockets are handled entirely inside the kernel and not accessible via network.

Unless your LibreNMS runs on the same host it is expected behaviour.

Hi Etz. Hmm… that makes sense. How can I get this working then?

The LibreNMS server runs on its own host.

The haproxy servers are on their own hosts, and queried via SNMP to the LibreNMS server.

I put the check_haproxy script onto the LibreNMS server as:


and then in LibreNMS, went to the endpoint, added the haproxy check, which produces that socket error.

This part of LibreNMS I don’t have much experience in (yet).

Am I supposed to put the check_haproxy script somewhere on the haproxy server endpoint, and then somehow call the execution of that script?

Note the haproxy server endpoint does have check_mk running on it also, not sure if that helps in this case though.

It should also be noted that LibreNMS does seem to have some native support for this script:

# cat /opt/librenms/includes/services/
$check_cmd = $config['nagios_plugins'] . "/check_haproxy ".$service['service_param'];

Yes, because your LibreNMS host does not have haproxy, hence no socket to connect to.

Maybe @laf can chime in, and explain better how to get this work.
I think you would need somekind of script (not sure if LibreNMS has one already) on a remote host, which makes poller aware of such remote service.

If the nagios script is expected to run on the remote host then we don’t support that, the scripts are all run from the local LibreNMS box.

You might have look using nrpe but I don’t know that part.

1 Like

Hi Laf. Thanks for your response.

I’m close to being a Nagios expert, been working on the platform for some time now. I use NCPA for Nagios though, I don’t necessarily like NRPE.

The issue is not that I can’t monitor using check_haproxy, as I can using Nagios and NCPA and have been.

The thing I want to get going is having that run through LibreNMS.

I realise there’s limitations, but when I read a git change and then saw this:

cat /opt/librenms/includes/services/

I thought someone must have this working, so I’ll give it ago.