I’m trying to monitor multiple freezers reading their temperature. I’m grouping by multiple tags that uniquely identifies a freezer. The following is a sample of the script I’m trying.
var period = 15m
batch
|query(’’’
select “temperature” as value from device where “machineType” = ‘freezertype’
‘’’)
.period(period)
.every(1m)
.groupBy(‘mac’, ‘machineId’, ‘locationId’, ‘machineType’)
|alert()
.all()
.id(‘Freezer Temperature Alert’)
.message(‘Freezer Temperature is {{ .Level }} for the past ’ + string(period))
.crit(lambda: “value” > -14.5)
.stateChangesOnly()
.log(’/tmp/alerts.log’)
so if I have 2 freezers, A and B.
When freezer A go out of range, I get a critical alert properly, but after it if freezer B go out of range, I won’t get an alert.
I repeated the above scenario but this time, after freezer A go out of range, I have it go back to its normal values, and then when freezer B go out of range, an expected critical alert is triggered this time.
It seems stateChangesOnly applies for the whole rule status and not per pipeline of the groupby.
Is my interpretation correct? how to monitor multiple devices and get alerts for each one.