It can be tough knowing someone's snooping through your stuff, But it's for the greater good and they aren't going to use anything they find against you if what you have is perfectly fine. I don't think they should just do it whenever, Since everyone deserves their privacy, But if necessary, They should be allowed to do so.
There should be conditions to verify if it's really necessary, Obviously. Although there is no police authority/warrant necessary to do this, There should still be a balance between respecting the students right to privacy and making sure that there is nothing endangering other students education and safety. They shouldn't be able to search student lockers just because they feel like it. But they should still have the ability to do so, If they deem it necessary.
Searching a locker without a warrant granted by the judge or reasonable suspicion is a violation of the student's right to privacy. However, Police dogs that sniff for drugs or guns should be allowed since it is a much less of an invasion of privacy than an actual search of a locker.