How can I find which server - 1 or 2 - is the current process server and which is standby?

How can I find which server - 1 or 2 - is the current process server and which is standby?

I want to show on the screen, the word "Primary" if current server is Primary server and the word "Secondary" if current server is Secondary server,
would you please help me how to do it.

This is a migrated post! Originally posted on 08.11.2021 by user Alimard. Please be aware that information can be outdated.