Cannot connect to socket at a check plugin (check_haproxy)

Hi,
i have try to get check_haproxy to run. Local on the endpoint it works fine with root access but not for my icinga2 agent.
I guess its a permission issue, but i dont find a solution online to give the “nagios” user access to the haproxy.sock file.

I’m using debian 12 without selinux. Maybe someone could help me with this? Its not the icinga2 agent that have the issue, its just for the check_haproxy plugin,
Thanks.

add a sudoes line using visudo:

nagios ALL = NOPASSWD: /usr/lib/nagios/plugins/check_haproxy

the path is just a guess, check that manually.

your should create a new command and inherit the old one:

object CheckCommand "sudo_haproxy" {
    import "haproxy" // old ha proxy command name
    command = [
        "/usr/bin/sudo",
        "/usr/lib/nagios/plugins/check_haproxy"
    ]
}

and adapt your service templates

Thanks. Seems to be a good solution. You may have a tipp how i can do this in director? Because the command field does not allow multiline. And it puts the “plugindir” variable in front.

  • use direct paths
  • use a single line

  • create a new command
  • inherit the old one (haproxy)
  • overwrite “/usr/bin/sudo /usr/lib/nagios/plugins/check_haproxy” as the command
  • adapt or create a new service template using the new command

Thanks. Sometimes the solution is easier than we think. :slight_smile: