IT Automation question

IT Automation question

Is it possible to have an IT automation to run if a set threshold on a specific application or service is met? Example, I have an application that has a memory bleed. After the application hits 1GB of ram, I want to close the app and reopen it. 

Thanks

Eric