monitoring-nagios-haproxy icon indicating copy to clipboard operation
monitoring-nagios-haproxy copied to clipboard

Define multiple backends with "--override" doesn't work in Icinga2

Open xtavras opened this issue 5 years ago • 1 comments

Hello,

I have strange problems, I've defined multiple backends in "--override" option in Icinga2. but somehow, Icinga command run ignores it. Trying to run command copy-pasted from "Inspect" in terminal give the same result.

'/usr/local/hs/icinga-plugins/check_haproxy' '--overrides' 'backend-gscache:,1,0 be-rancher:,2,0 be-letsencrypt:x' '--socket' '/var/lib/haproxy/stats'
HAPROXY CRITICAL: BACKEND be-letsencrypt has fallen below 2 available server(s) (0 up, 0 down, 0 disabled) (check_haproxy 1.0.3)

but if I remove single quotes for --override, it's working

 '/usr/local/hs/icinga-plugins/check_haproxy' '--overrides' backend-gscache:,1,0 be-rancher:,2,0 be-letsencrypt:x '--socket' '/var/lib/haproxy/stats'
HAPROXY OK: HAProxy is functioning within established parameters. (3 frontends, 3 backends, 6 servers, 6 services) (check_haproxy 1.0.3)

Not sure there is the bug, I'm using latest Icinga 2.10 with Director.

object Service "Check HAProxy" {
    host_name = "ldb.example.com"
    import "check haproxy"

    vars.haproxy_overrides = "backend-gscache:,1,0 be-rancher:,2,0 be-letsencrypt:x"
}

xtavras avatar Mar 14 '19 15:03 xtavras

I used the code from @fdellinwing to make this work for overrides.

Critical to have this change for the haproxy plugin to be functional on icinga2. Does not appear to be reflected in the state on master branch.

        "--overrides" = {
            value = {{
                return macro("$haproxy_overrides$").split(" ")
            }}            
            description = "Override the defaults for a particular frontend or backend, in the form {name}:{override}, where {override} is the same format as --defaults above."
        }

bensig avatar Aug 15 '22 23:08 bensig