0

我正在使用 ElasticCloud 版本 v7.12.1,我已经设置了一个观察者来检查集群的健康状况,如下所示:

PUT _watcher/watch/cluster_health_watch
    {
      "trigger" : {
        "schedule" : { "cron" : "0 0/5 * * * ?" }
      },
      "input" : {
        "http" : {
          "request" : {
            "host" : "localhost",
            "port" : 9200,
            "path" : "/_cluster/health",
            "auth": {
              "basic": {
                "username": "Myuser",
                "password": "mypassword"
              }
            }
          }
        }
      },
      "condition" : {
        "compare" : {
          "ctx.payload.status" : { "not_eq" : "green" }
        }
      },
      "actions" : {
      "slackmonitoring" : {
        "throttle_period" : "5m",
        "slack" : {
          "message" : {
            "to" : [ "test-webhook" ], 
            "text" : "Cluster is Unhealthy!" 
          }
        }
      }}
    }

它失败并出现此错误:

"input": {
      "type": "http",
      "status": "failure",
      "error": {
        "root_cause": [
          {
            "type": "http_host_connect_exception",
            "reason": "Connect to localhost:9200 [localhost/127.0.0.1] failed: Connection refused"
          }
        ],

做了一些搜索后,有人提到要添加:network.host:127.0.0.1 到 elasticsearch.yml 但是当我添加它并尝试保存它时,我得到了这个错误:

Elasticsearch - 'network.host':不允许

我找不到有关此问题的任何文档及其解决方案,如果有人可以提供帮助,我将不胜感激。

4

1 回答 1

0

从支持获得解决方案,发布答案以防有人面临同样的问题:

它需要使用弹性搜索公共端点而不是本地主机。所以它看起来像这样:

"input" : {
        "http" : {
          "request" : {
            "url" : "https://REDACTED.cloud.es.io:9243/_cluster/health",
            "auth": {
              "basic": {
                "username": "Myuser",
                "password": "mypassword"
              }
            }
          }
        }
      }
于 2021-05-12T09:26:31.070 回答