Query GCS-Messages

I am looking for a way to query the messages to the GCS in a script. More precisely, I want to be able to react to the message “EKF3 active”, for example, to indicate with an LED that you can now arm.