All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
The ruling of poetry depends on its content; if the content is good it is good; otherwise it is bad. The Prophet said: “Poetry is like a talk; a good poetry is like a good talk and a bad one is like a bad talk.” [Musnad Abi Ya'la ] The same meaning is deduced from the verse: {As for the poets, the erring ones follow them, See you not that they speak about every subject (praising people right or wrong) in their poetry? And that they say what they do not do. Except those who believe (in the Oneness of Allah Islamic Monotheism) and do righteous deeds, and remember Allah much and vindicate themselves after they have been wronged [(by replying back in poetry) to the unjust poetry (which the pagan poets utter against the Muslims)].} [Quran 26:224-227]. The companions of the Prophet Muhammad used to compose good poetry and recite it in front of the Prophet Muhammad . Therefore, poetry that contains Tawheed, Praise of Allah, or His Prophet's admiration () some wisdoms, scientific or artistic themes that do not go beyond the boundaries of Shariah is praiseworthy. On the other hand, the poetry that contains polytheism, obscenity, no meaning, insult of any Muslim, etc. is Haram.
Allah knows best.