Jami` at-Tirmidhi, Volume 4, Book 35, Hadith 2512 (DarusSalam) ⓘ
'Amr bin Shu'aib narrated from his grandfather 'Abdullah bin 'Amr, that the Messenger of Allah (s.a.w) said: "There are two traits, whoever has them in him, Allah writes him down as grateful and patient. And whoever does not have them, Allah does not write him down as grateful, nor patient. Whoever looks to one above him for his religion, and follows him in it, and whoever looks to one who is below him in worldly matters, and praises Allah for the blessings He has favored the one who is above him with, then Allah writes him down as grateful and patient. And whoever looks to one who is below him for his religion, and looks to one who is above him for worldly matters, and grieves over what missed him of it, Allah does not write him down as grateful nor as patient."(Another chain reaching to) 'Amr bin Shu'aib, from his father, from his grandfather from the Prophet (s.a.w) with similar narration.
حَدَّثَنَا سُوَيْدُ بْنُ نَصْرٍ، أَخْبَرَنَا ابْنُ الْمُبَارَكِ، عَنِ الْمُثَنَّى بْنِ الصَّبَّاحِ، عَنْ عَمْرِو بْنِ شُعَيْبٍ، عَنْ جَدِّهِ عَبْدِ اللَّهِ بْنِ عَمْرٍو، قَالَ سَمِعْتُ رَسُولَ اللَّهِ صلى الله عليه وسلم يَقُولُ " خَصْلَتَانِ مَنْ كَانَتَا فِيهِ كَتَبَهُ اللَّهُ شَاكِرًا صَابِرًا وَمَنْ لَمْ تَكُونَا فِيهِ لَمْ يَكْتُبْهُ اللَّهُ شَاكِرًا وَلاَ صَابِرًا مَنْ نَظَرَ فِي دِينِهِ إِلَى مَنْ هُوَ فَوْقَهُ فَاقْتَدَى بِهِ وَنَظَرَ فِي دُنْيَاهُ إِلَى مَنْ هُوَ دُونَهُ فَحَمِدَ اللَّهَ عَلَى مَا فَضَّلَهُ بِهِ عَلَيْهِ كَتَبَهُ اللَّهُ شَاكِرًا صَابِرًا وَمَنْ نَظَرَ فِي دِينِهِ إِلَى مَنْ هُوَ دُونَهُ وَنَظَرَ فِي دُنْيَاهُ إِلَى مَنْ هُوَ فَوْقَهُ فَأَسِفَ عَلَى مَا فَاتَهُ مِنْهُ لَمْ يَكْتُبْهُ اللَّهُ شَاكِرًا وَلاَ صَابِرًا " .
also referenced under: Hadith 2512 (Reference) & Book 37, Hadith 2701 (In-Book)