switching carp interface based on multiple upstream availabiity

Started by opnsenuser, December 31, 2023, 09:27:36 PM

Previous topic - Next topic
Hi everyone,
There is a HA setup with two identical machines.
The upstream interfaces are monitored by the builtin monit service on both machines in addition to the gateways.

This way I hope to switch the internal carp interfaces to the machine with more uplinks, but can't find a solution.
Has anyone done a smilar thing or know how to change the carp interface over to an other machine via monit?

If you have other ideas for this please mention them.
Thanks
BR

Hi,
some progress:
the following lines up or down the carp demotion:
if[$(sysctl -n net.inet.carp.demotion)<190]; then sysctl -w net.inet.carp.demotion=$(($(sysctl -n net.inet.carp.demotion)+50))
The max value shouldn't surpass the opnsense maximum value of 240 (CARP Persistent Maintenance Mode).
if[$(sysctl -n net.inet.carp.demotion)>50]; then sysctl -w net.inet.carp.demotion=$(($(sysctl -n net.inet.carp.demotion)-50))
The demotion value shouln't get below 0.

Sadly the monit start and stop filelds don't take these lines.

Is there the posibility to add these two lines as scripts in a place that the opnsense backup process includes?
also see:    Topic: System backups - development questions https://forum.opnsense.org/index.php?topic=15224.msg69434
Or can the monit dialogs get extended to accept sh commands that run once?

BR