Imam al-Shafi'i (may Allah have mercy on him) said: "Poetry is (also) speech: its good part is like good speech and its bad part is like bad speech, except that it is speech which endures and spreads (among people), and that is its distinction (and excellence) over ordinary speech. So whoever among the poets is not known for disparaging the Muslims, harming them and doing so excessively, nor (known) for lying a great deal when he praises someone, his testimony will not be rejected."
Abd al-Rahman bin al-Aswad bin Abd Yaghuth (may Allah have mercy on him) says that the Messenger of Allah (peace and blessings be upon him) said: "Some poetry is full of wisdom."
(b) Ubayy bin Ka'b (may Allah be pleased with him) narrates from the Prophet (peace and blessings be upon him) that he (peace and blessings be upon him) said: "Some poetry is wisdom."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الشهادات / 21098