I am using ElasticCloud , version v7.12.1, I have sat up a watcher for health check of cluster that it looks like below:
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!"
}
}
}}
}
It fails with this error:
"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"
}
],
After doing some search, someone mentioned to add: network.host: 127.0.0.1 to elasticsearch.yml However when I add it and try to save it I get this error:
Elasticsearch - 'network.host': is not allowed
I could not find any documentation regarding this issue and a solution for it, I would appreciate if someone can help.
Got a solution from support, posting the answer in case someone is facing the same issue:
It needs to use elasticsearch public endpoint instead of localhost. So it would look like this: