I am new in Prometheus and alerting, and I couldn't fine my answer by looking at the documentation.
I have some data that's coming to an elasticsearch cluster. Every day, the process creates a new index on elasticsearch and writes the data of that day to this index (e.g., my_index-2019-10-06
, my_index-2019-10-05
, ...). I want to monitor the size of the index of today and see that it's growing, and if it's not growing in a defined interval (15 min for example), I want to fire an alert in Prometheus. To do so, I was thinking about such an expr
in alert rule:
expr: delta(elasticsearch_index_primary_store_size{index_name="my_index-TODAY-DATE"}[15m] <= 0)
The TODAY-DATE
should be dynamic, and generated every day. But as far as I understand you cannot have a dynamic value in the label values, and neither a function to get the date.
Then I was thinking about to compare the delta of sum of the size of all the indices start with my_index
, but the problem with this approach is the retention time, and if an index is deleted, the delta of the sum may be negative, while new data is coming to the today index.
Do you have any solution for this problem?
Thanks in advance.