Clean Script, Stuck Processes and Resources

Hi,

is there some kind of clean script, or task in Rancher? We use Cattle, and we have a lot of Environments with lot of Stacks and Services currently running on ~60+ hosts. It is really dynamic environment with many changes, many appearing and disappearing hosts. We run Rancher for several months (4-5 I think). And after that we have tens of stuck Running processes and DB is getting bigger fast (now 12GB). We have several Stacks running in production environment, so we can not just throw away everything and start from scratch.

So:
How to remove stuck resources and processes?
How to clean DB from old, non existing resources?

Is there at least DB schema so we can create script which will remove stuck resources.

A lot of processes was created when we tryied to switch to HA, but reverted because of some problems. (this is probably for bug report)