It is narrated from Sayyiduna Abu Hurayrah (may Allah be pleased with him) that he said: "The Messenger of Allah (peace and blessings be upon him) and I walked together while his blessed hand was in my hand. He (peace and blessings be upon him) passed by a man in a shabby state and asked him: 'O father of so-and-so! How did you come to this state that I see?' He said: 'O Messenger of Allah (peace and blessings be upon him)! Because of illness and hardship.' He (peace and blessings be upon him) said: 'Shall I not teach you words through which Allah Almighty will remove illness and hardship from you?' He said: 'No! (That is, I hope for reward for this hardship.) It would not please me, in exchange for this (state), even to have taken part with you in Badr and Uhud.' At this the Messenger of Allah (peace and blessings be upon him) smiled and said: 'Can the people of Badr and the people of Uhud attain the rank that a patient, contented poor man attains?' Sayyiduna Abu Hurayrah (may Allah be pleased with him) said: 'O Messenger of Allah (peace and blessings be upon him)! Then teach those words to me.' He (peace and blessings be upon him) said: 'O Abu Hurayrah! Say: Tawakkaltu 'ala al-Hayy alladhi la yamut, al-hamdu lillahi alladhi lam yattakhidh waladan wa lam yakun lahu sharikun fi al-mulk wa lam yakun lahu waliyyun min al-dhull wa kabbirhu takbira (I have put my trust in the Ever-Living who will never die; "All praise is for Allah, who has not taken a son, and who has no partner in the dominion, nor is He weak so as to need a helper; and proclaim His greatness with all magnificence").'" Sayyiduna Abu Hurayrah (may Allah be pleased with him) narrates: "Then the Messenger of Allah (peace and blessings be upon him) came to me when my condition had become much better, and he (peace and blessings be upon him) asked: 'What is this?' I said: 'O Messenger of Allah (peace and blessings be upon him)! I kept constantly reciting the words that you taught me.'"
Imam Abu Ya'la al-Mawsili recorded it, and its chain is weak because Musa bin Ubaydah is da'if (weak).