Section 17. Each inspector shall be sworn to the faithful performance of his official duties, and shall receive from the town for which he is appointed reasonable compensation, if appointed by the town, or such compensation as shall be fixed by the director, but not in excess of five hundred dollars a year, if appointed by the director. Towns having a valuation of less than two and one half million dollars shall be reimbursed by the commonwealth, upon certificate of the selectmen, approved by the director, for one half of such compensation, not exceeding two hundred and fifty dollars for each inspector in any one year.