Abu Musa Ashari reported,

The sun was eclipsed, so the Prophet ﷺ rose in alarm, fearing it might be the Hour. He went to the mosque and stood in prayer, performing the longest standing, bowing, and prostration I had ever seen him do in any prayer. Then he said, "These signs which Allah sends do not occur for the death or birth of anyone. Rather, Allah sends them to instill fear in His servants. So whenever you witness any of them, hasten to His remembrance, supplication, and seeking His forgiveness."

Nasai 1504

Sahih

أخبرنا موسى بن عبد الرحمن المسروقي عن أبي أسامة عن بريد عن أبي بردة

عن أبي موسى قال

خسفت الشمس فقام النبي ﷺ فزعا يخشى أن تكون الساعة فقام حتى أتى المسجد فقام يصلي بأطول قيام وركوع وسجود ما رأيته يفعله في صلاته قط ثم قال إن هذه الآيات التي يرسل الله لا تكون لموت أحد ولا لحياته ولكن الله يرسلها يخوف بها عباده فإذا رأيتم منها شيئا فافزعوا إلى ذكره ودعائه واستغفاره

النسائي 1504صحيح
Contents
Reference
Commentary
Ayat
Collection
Sunan Nasai Sughra
Book
Eclipse
Chapter
Commanding seeking forgiveness during eclipses
Numbering
Darussalam 1504
Nasai 1504