Let us locate rod at the position when it an angle θ from the vertical. In this problem both, the gravity and spring forces are restoring conservative forces, thus from the conservation of mechanical energy of oscillation of the oscillating system:
12ml23(˙θ)2+mg12(1−cosθ)+12k(lθ)2=constant
Differentiating w.r.t. time , we get :
12ml232˙θ¨θ+mgl2sinθ˙θ+12kl22θ˙θ=0
Thus for very small θ
¨θ=2g2l(1+klmg)θ
Hence, ω=√3g2l(1+klmg)