Spying is not allowed in Islam, but if you have come to know that your husband is having a bad habit, you need to do your best to help him to get out this bad habit in every possible way. You should explain to him the damages of such sinful acts and harms on him in this life and hereafter.
Wassalam.