Combine queries in alert

I´m using Garfana / Victoriametrics and I try to create an altert rule for free disk space depending on the disk size … 5% free on disks with less than 5GB free
and 2% free on disks with more than 5GB free

as a base I have the two queries
A: win_logicaldisk_Percent_Free_Space{instance!=“C:”}
B: win_logicaldisk_Free_Megabytes{instance!=“C:”}

and I´m searching for something like
if A<5 and B<5000

Any help is welcome

Welcome @carstenp to the forum.

The AND && operator can be used to specify that two conditions must be met: the value of C (the reduced value from query A ) must be less than 5 while the value of D (the reduced value from query B ) must be less than 5000. We write this as $C < 5 && $D < 5000

See example #2 here.

1 Like

Hi Grant2,
thanks for your answer, unfortunately it results in health=nodata
but it leaded me to another approach:
A: win_logicaldisk_Free_Megabytes{instance!=“C:”} > bool 5000
B: win_logicaldisk_Percent_Free_Space{instance!=“C:”} < 6
C: reduce A to last
D: reduce B to last
E: math: $C * $D
F: threshold E < 6 (as alert condition)
that is working

Should you instead use the “or” operator?

Hi Grant,
I´m working on these two conditions as seperate alarms, my problem is in both cases combining
% free and MB free