Troubleshoot the "[Errno 111] Connection refused" error when installing the Elasticsearch plugins

Troubleshoot the "[Errno 111] Connection refused" error when installing the Elasticsearch plugins

When installing the Elasticsearch monitoring plugins, you may encounter the following error:
URL Error [Errno 111] Connection refused: This error usually indicates that the Elasticsearch client is unable to establish a connection to the Elasticsearch server.

Here are some steps to troubleshoot the issue.
  1. Validate if Elasticsearch is running: You can use the following command to check if Elasticsearch is running:
    curl -X GET "localhost:9200/"
    If Elasticsearch is running, you should see a JSON response with details about the cluster.

  2. Examine the bind address: Elasticsearch typically binds to localhost (127.0.0.1) by default. If you've changed the bind address, ensure you're using the correct address to connect. Also, check the elasticsearch.yml configuration file for the network.host setting.

  3. Check the port: Confirm that you are connecting to the correct port. Elasticsearch usually uses port 9200 by default, though this can be modified in the elasticsearch.yml configuration file.

  4. Check if Elasticsearch is bound to a specific IP: If Elasticsearch is bound to an IP address other than localhost, you'll need to include the server's IP address where you've installed the agent to connect with Elasticsearch and obtain metrics.

  5. Verify the Elasticsearch Cluster Health URL: Ensure the Elasticsearch Cluster Health URL is functioning as intended, as this is the URL utilized by our plugin to retrieve Elasticsearch metrics. Use the following command to check this:
    curl -X GET "localhost:9200/_cluster/health"
Once you've made changes based on the checks above, restart the Site24x7 server monitoring agent or re-register the plugin. Within five minutes, you should be able to view performance metrics in Site24x7.
If the issue persists, reach out to support@site24x7.com with the plugin details.