It shall be the duty of the building inspector or city manager's designee to take cognizance of violations of this chapter. He shall investigate each violation which comes to his attention whether by observation or by communication. He shall order in writing the correction of such conditions as are found to be in violation of this chapter. Failure to secure permits when required, previous to erection, construction or alteration to a building, or change in use of land or building as provided in this chapter, shall be a violation of that chapter.