OPNsense
  • Home
  • Help
  • Search
  • Login
  • Register

  • OPNsense Forum »
  • English Forums »
  • Development and Code Review (Moderator: fabian) »
  • API to renew DHCP when down
« previous next »
  • Print
Pages: [1]

Author Topic: API to renew DHCP when down  (Read 2359 times)

ecor6633

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
    • View Profile
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
Logged

elcocoloco

  • Newbie
  • *
  • Posts: 24
  • Karma: 2
    • View Profile
Re: API to renew DHCP when down
« Reply #1 on: February 22, 2021, 04:03:25 pm »
Would start monitoring the gateway via API / CRON, which is more logical imho.

After that down and up interface

https://forum.opnsense.org/index.php?topic=10924.0
Logged

  • Print
Pages: [1]
« previous next »
  • OPNsense Forum »
  • English Forums »
  • Development and Code Review (Moderator: fabian) »
  • API to renew DHCP when down
 

OPNsense is an OSS project © Deciso B.V. 2015 - 2024 All rights reserved
  • SMF 2.0.19 | SMF © 2021, Simple Machines
    Privacy Policy
    | XHTML | RSS | WAP2