1
Development and Code Review / API to renew DHCP when down
« on: February 17, 2021, 02:20:51 pm »
Hello,
I'm quite new to OPNsense. I'm a developer facing occasionally the same issue so I'm trying to find a way to program a solution.
Fom time to time my WAN interface has its DHCP status down (I see it under Interfaces->overview->expand WAN/igb0) and it stops my internet connectivity. I see there a renew button which from now on has always solved the issue.
What I'd like to do is write a simple script that would check the status (down) of that DHCP and click on the renew button for me so I could run it periodically and solve the issue without even having to log into OPNsense UI.
I hope that /api/diagnostics/interface/getInterfaceStatistics will allow me to detect somehow the DHCP down. (Problem haven't occurred yet since I discovered that API) but then, if it works is there a way to trigger the renew from any API ?
By the way I post this in development because I'm trying a developer approach but if you have any other solution whatever it uses the API or not I'm interested.
Thanks a lot
I'm quite new to OPNsense. I'm a developer facing occasionally the same issue so I'm trying to find a way to program a solution.
Fom time to time my WAN interface has its DHCP status down (I see it under Interfaces->overview->expand WAN/igb0) and it stops my internet connectivity. I see there a renew button which from now on has always solved the issue.
What I'd like to do is write a simple script that would check the status (down) of that DHCP and click on the renew button for me so I could run it periodically and solve the issue without even having to log into OPNsense UI.
I hope that /api/diagnostics/interface/getInterfaceStatistics will allow me to detect somehow the DHCP down. (Problem haven't occurred yet since I discovered that API) but then, if it works is there a way to trigger the renew from any API ?
By the way I post this in development because I'm trying a developer approach but if you have any other solution whatever it uses the API or not I'm interested.
Thanks a lot