It is narrated from Sayyiduna Abdullah bin Abbas (may Allah be pleased with them both) that the Messenger of Allah (peace and blessings be upon him) passed by the graves in Madinah and said: "Peace be upon you, O people of the graves, believers and Muslims! I ask Allah for forgiveness for us and for you. You have gone before us, and we are following in your footsteps."
Imam al-Tirmidhi (may Allah have mercy on him) narrated it through Abu Kurayb from Muhammad bin al-Salt, from Abu Kudaynah Yahya bin al-Muhallab, and said: "This hadith is hasan gharib."