OPNsense Forum

English Forums => Development and Code Review => Topic started by: mimo on December 05, 2016, 01:46:35 pm

Title: Detect gateway failure via API
Post by: mimo on December 05, 2016, 01:46:35 pm
Is there some way to trigger a custom action when opnsense detects a gateway failure?

Following use case:

My backup internet connection is via LTE. I have a small data package with just some 100 MB as default and need to switch to a better one before connecting the whole network via this gateway.
Title: Re: Detect gateway failure via API
Post by: franco on December 05, 2016, 05:19:28 pm
Hi mimo,

The apinger tool is capable running custom commands, but there is no proper GUI support for it. Some parts of the system use this in order to script the failover process.

However, zhe whole apinger/gateway monitoring should be reworked and pruned, something that is going to take a lot of time we do not have to dedicate resources to.

Any help here is appreciated. And pointers and question regarding code spots shall be happily answered in any case. :)


Cheers,
Franco
Title: Re: Detect gateway failure via API
Post by: mimo on December 06, 2016, 05:20:32 pm
Hi Franco,

Thanks for the hint to apinger. It is configured to execute a script called configd_ctl.py. Replacing the script with a custom one works fine.

I would prefer to place my custom script outside the opnsense internals, so I have to change the apinger config. Can you tell me where it is generated? Looks like it is overwritten automatically...

I'm afraid I currently don't have the time to rework the gateway monitoring, as that would require digging into the opnsense internals first...

Regards,
mimo