Properly escaping check_command in nagios

haproxymonitoringnagios

When I execute

sudo -u nagios /usr/lib64/nagios/plugins/check_by_ssh.sh hostname "check_haproxy -u \"http://localhost:10000/haproxy?stats\;csv\""

it runs perfectly on the server.

For this, I have this in my HAProxy.cfg

define service {
        use     generic-service
        hostgroup_name  pwmail-ee-oxweb
        service_description     HAProxy-ee
        servicegroups   ssh-dep
        check_command   check_by_ssh!check_haproxy -u \"http://localhost:10000/haproxy?stats\;csv\"
        contacts        sysad,mail-hosting-rt
}

It doesn't work. Says that Return code of 127 is out of bounds - plugin may be missing.

What am I doing wrong?

Best Answer

check_command check_by_ssh!check_haproxy -u 'http://localhost:10000/haproxy?stats\;csv'

worked.

Related Topic