It's easier than it seems like it would be, but more cludgey than it needs to be.
Monitor the / drive on your EX and when it is down and no longer responding -- but the device is up -- you're on your backup image.
Why? Juniper mounts a different partition as the / drive on it's different images. Usually they are /dev/da0s1a and /dev/da0s2a, but it doesn't matter which is which. Just check whatever is listed as "mounted on: /" when on its primary image and alert when that volume is unavailable.