The sun was eclipsed during the time of the Messenger of Allah ﷺ, and he came out alarmed, dragging his garment. I was with him in Medina that day. He prayed two units, prolonging the standing in both, then finished as the eclipse cleared. He said, "These signs are how Allah instills fear in His servants. When you see them, pray as you would the most recent obligatory prayer you have performed."
حدثنا موسى بن إسمعيل حدثنا وهيب حدثنا أيوب عن أبي قلابة
كسفت الشمس على عهد رسول الله ﷺ فخرج فزعا يجر ثوبه وأنا معه يومئذ بالمدينة فصلى ركعتين فأطال فيهما القيام ثم انصرف وانجلت فقال إنما هذه الآيات يخوف الله بها فإذا رأيتموها فصلوا كأحدث صلاة صليتموها من المكتوبة
Its isnad is daif. It was collected by Nasai, in the chapter on the eclipse, another type, hadith no. 1487, from the hadith of Ayub Sakhtiyani, with this wording. Hakim graded it sahih according to the criteria of the two Shaykhs, 1/333, and Dhahabi agreed with him. Bayhaqi said, 3/334, "This too was not heard by Abu Qilaba from Qabisa, rather he related it from a man, from Qabisa."