DHCP Lease Widget



  • I made some changes to an existing DHCP Leases widget and thought I would share in case anyone else is looking for something like this.

    • Original widget by Bobby Earl (why reinvent the wheel?  Thanks Bobby)

    • Added: widgets/include/DHCP_leases.inc to provide a click-able link to DHCP Leases Page

    • Added: 2 columns – Lease Type, and Status (online/offline statuses (online always for active dynamic leases, and actual status for dynamic leases)

    • Added: footer with Lease Counts

    • Dynamic Leases: Active/total (including expired leases)

    • Static Leases

    https://github.com/fuzion9/pfSense_widgets



  • Hi there

    Just thought I would like to mention, this doesn't seem to work with version 2.3.4-RELEASE. I followed the instructions exactly and it doesn't display at all and alters the top side of the main page too. Is there an updated widget for this as I like want something similar to this as I think it's a cool widget to have!
    Attached are screen shots of what it is doing for me.

    As this is an outdated post, I don't expect much but just to inform others that it may be a waste of time trying this out.

    Cheers






  • https://github.com/fuzion9/pfSense_widgets/pull/2
    I made a meld of:

    • the things that widget code used to/tried to do.
    • stuff that status_dhcp_leases.php does in pfSense 2.3.4
    • the way that widget coee is laid out in general in 2.3.4

    I have tried it on my 2.3.4 home system with a LAN and OPT1-WiFi and it works for me. It also works on a 2.4 test VM that I have ("standard" widget code like this from 2.3.4 is upward compatible to 2.4)

    Give it a try.



  • Works great, thanks!



  • OMG, I only signed up to the forums the other day and this was my 1st post. I really wasn't expecting a response but this is cool! There's many others that have seemed to want the same thing as I've seen other threads from google searches but with no solution.
    I'll try this out now and thanks very much for a quick response with another solution to try!
    I'm loving the pfSense community so far!

    Cheers



  • Hi there,

    I have done the steps above, so I used the new PHP file along with the 2 other files.
    I have the widget working, however, there is still something making it play up with the top side of my webpage with the main system homepage where the widgets are shown.

    And a screen shot (pretty much alike the 1st one from my previous comment).

    Otherwise, the widget itself is working!

    Cheers.

    [Edit: After some playing around, I got that jumble to go away by excluding the script. Was that required at all, or was that just needed for the old widget that was made?]




  • I didn't look at the JavaScript file, and now I think of it, I did not put it on my system. I did leave the bit of JS in the widget code. Probably that should all just be removed unless there is someone who cares to enough to look at what it did and make it work.



  • Heya

    I know it's picky, but if you wanted to maybe do it as you managed to do this so quick (I am no programmer myself sadly but will eventually get round to learning). Would it be hard to get the status's to show red or green for online and offline like the original version was?
    I imagine that's what the script was doing partially?

    I dunno, just a suggestion. I am very thankful someone chimed in and updated this as I am sure many others will appreciate this widget ounce again!

    Cheers guys!


Log in to reply