Since $$ (z^2+8) = (z+\sqrt{8}i)(z-\sqrt{8}i) $$ For Cauchy's formula $ \frac{1}{2i\pi}\oint\frac{f(z)}{z-w} dz $ I can say that $$ f(z) = \frac{cos(z)}{z(z+\sqrt{8}i)} $$ and denominator is $$ (z-\sqrt{8}i)$$ with $w=\sqrt{8}i$
Hence: $$ f(w) = f(\sqrt{8}i) = \frac{cos(\sqrt{8}i)}{16} $$ Therefore the original integral would be equal to: $$ \oint \dfrac{cos(z)}{z(z^2+8)} = \frac{\pi i cos(\sqrt{8}i)}{8} $$ But this seems to be wrong...
Your function $f$ is not analytic in $|z| <2$ so Cauchy's Integral Formula is not applicable. Take $f(z)=\frac {\cos \, z} {z^{2}+8}$ instead. The integral is $2\pi i f(0)=2\pi i /8$.