The firewall must work at Layer 3 and have an address on the interface.
The first one uses ip-link
This method is that if the monitored interface fails, its priority is reduced by 2
FW3
ip-link check enable
ip-link 1 destination 1.1.1.1 interface g0/0/0 mode icmp
hrp track ip-link 1 active
FW4
ip-link check enable
ip-link 1 destination 1.1.1.1 interface g0/0/0 mode icmp
hrp track ip-link 1 standby
The second method is to use BFD mode
FW3
bfd 1 bind peer-ip 1.1.1.1 discriminator local 10 discriminator remote 20
hrp track bfd-session 10 active
FW4
bfd 1 bind peer-ip 2.2.2.1 discriminator local 10 discriminator remote 20
hrp track bfd-session 10 standby