I am a bit of a novice with the monitoring world. Here is my question.
I want to fire an alert only for a set of assets based on asset-id.
My metrics looks like the below.
test_value{asset_id="123"} 0.215
My alert manager rules looks like the below.
name: iot_rules
rules:
- alert: threshhold_alert
expr: test_value >= 4
#for: 1m
labels:
severity: critical
probableCause: Communication failure
annotations:
summary: 'Error detected on {{$labels.assset_id}}'
I get the templating feature on the annotation. However, my promQL expression does not allow me to template. Basically, i am looking for writing a expression as below.
expr: test_value{asset_id=$1} >= 4.
The value for $1 will come from elsewhere (list of assets).
Is this a possibility? I don't want to hard code the asset-id in the expression and there by creating same rule for each asset. Basically the assets-id are unknown at the development time and I don't want my customer to create the rules.