Updated to try to exclude nomonitored environments from hostgroup queries.