2 querys alert based on count between them


I have 2 mysql querys that i run one is the max amount of licenses a application can use, and the other one is the used amount.

The total count will not change that much, but want to make the monitoring system scale properly so no false positives are sent. therefore i am looking for a way to do this.

I can also make the input to the DB fix the counting for me, but are wondering if you can setup alerting some way to use 2 querys. hope someone can cast light upon this.