Discovery Error on HAProxy Discovery: Cannot locate config file: /elastic_cloud_apps/haproxy/ - Exit status: 1


When I running discovery for HAProxy, the following error comes up in the Discovery Log: Cannot locate config file: /elastic_cloud_apps/haproxy/ - Exit status: 1

Release or Environment

Any And all


The classification script for the HAProxy Process Classifier creates a variable called hp_cfg
The value of this variable it generally evaluates to:
" /opt/kibana/haproxy-2.1.2/etc/haproxy/haproxy.cfg"

In the process classifier it runs 2 triggered probes. One of them is HAProxy - Get Configuration:

This probe runs a shell script that is specified in the probe parameters called
When it runs this probe it adds the argument for hp_cfg, essentially running hp_cfg
which technically translates to: /opt/kibana/haproxy-2.1.2/etc/haproxy/haproxy.cfg

When we look at that script, the very beginning runs this code block:
# if no path for haproxy.cfg then exit
if [ ! -f $CFG_LOCATION ]; then
echo "Cannot locate config file: $CFG_LOCATION"
exit 1


Check the permissions of the credential being used and make sure it can access the file /opt/kibana/haproxy-2.1.2/etc/haproxy/haproxy.cfg on the target host