Dynamic body condition under Watcher

I have a cluster with 3 nodes.
Ip 1.2.3.4 is master
IP 5.6.7.8 and IP 5.4.3.2 are data nodes.

when i gave a condition in 1.2.3.4 as follows

{
"trigger" : {
"schedule" : { "interval" : "10s" }
},
"input" : {
"http" : {
"request" : {
"host" : "localhost",
"port" : 9200,
"path" : "/_cluster/health",
"auth" : {
"basic" : {
"username" : "123",
"password" : "123"
}
}
}
}
},
"condition" : {
"compare" : {
"ctx.payload.status" : { "eq" : "yellow" }
}
},
"actions" : {
"send_email" : {
"email" : {
"to" : "abc@xxx.com",
"subject" : "ES Cluster Status Warning",
"body" : "The Cluster with ip 1.2.3.4 is down."
}
}
}
}

Same condition is replicated with other two nodes. So if 5.6.7.8 ip is failed then im getting an alert as The Cluster with ip 1.2.3.4 is down. How can i give a condition in condition under body so that if node 5.4.3.2 fails it should alert me as The Cluster with ip 1.2.3.4 is down and vice versa.

Note:- One condition under master node 1.2.3.4 is replicated to other two nodes with same condition.

Hey,

I do not really understand your requirement, but let me try to fill some of the empty voids here.

When you poll localhost, you are always polling the current master node where watcher is running currently. If you master node changes in your three node cluster, you cannot guarantee that the host with ip 1.2.3.4 is down. If you master node never changes, you will never get to know other node failures. Please take your time and read about topology of elasticsearch cluster in the the definitive guide in order to understand how all of this works. This should also make your requirement somewhat more clear and also give you the basics of Elasticsearch as a distributed system. You will also understand while having a single master node and two data nodes does not make a lot of sense.

--Alex

How can i give this condition dynamically. IP should be dynamic. If data node fails also its sending alert as master's IP is down. I need a dynamic condition in body.

And i changed it from localhost to the respective IP

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.