Hello, I'm new to Elasticsearch and Kibana and I've been trying to create a watcher that alerts me when the free disk space ratio is lower than a defined value. I believe I've managed to build a working watcher however, I can't create a field with a division of two sum_bucket results needed for the total ratio. I'll post my watcher JSON below, only leaving the actions part out:
I want a field which is the division of sum_available by sum_total. This result would help me providing the ratio to the logs. I've tried several approaches with no success and I'd appreciate some help if it's possible. Thank you!
can you add some more context of what is missing in addition of pasting several hundred lines of a watch? Is the query working as expected, but the condition does not work? Or is the data provided not showing the data as needed? This would help to tackle the problem to figure out if this is a data problem or a watcher problem.
The query is working as expected and so do the aggregations and the condition so the watcher itself is working as intended, the only thing I'm missing is an extra calculated field for info logging. I get the total, available disk space and free disk space ratio for each node. I get the sum, from all the nodes, of the total and available disk space, through a sum_bucket of the results for each node. What I'm trying to accomplish is obtaining a new field which divides the results of the two already working sum_bucket results. Next is the relevant part of the response to the query, I've left only one of the resulting buckets for reference:
That's how I managed to have the watcher condition working, but I can't access the resulting ratio to use when sending an email when the condition is met. The value is not in the ctx.payload object. This is why I wanted the field. I tried using a bucket script aggregation with no success as when I put it next to the sum_bucket's it says that it needs to be inside another aggregation, so I'm lost on how to create the field with this value
Oh you're right, I'm sorry! I only saw it as a variable to use in the condition and not as one "created" in the ctx object. However, I tested it and it's not creating the field on ctx object. This is the condition as it shows when I simulate the watcher:
I will leave as a suggestion perhaps having a pre-configured alert for server/cluster/node free disk space ratio similar to what already exists for CPU usage and Memory as I think it would be very useful without creating a watcher similar to mine.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.