core icon indicating copy to clipboard operation
core copied to clipboard

Add Uptime API Endpoint

Open Neozlag opened this issue 1 year ago • 3 comments

The purpose of this pull request is to add the uptime of OPNsense accessible with the API Endpoint /api/core/system/uptime

Neozlag avatar Jan 30 '24 14:01 Neozlag

We try to prevent endpoints not being used by the gui, maybe when we're working on refactoring the dashboard, we can offer an endpoint that also offers (parsed) uptime content.

You can always deploy an endpoint in your local setup to reach the same effect.

AdSchellevis avatar Jan 30 '24 14:01 AdSchellevis

Perhaps we can make an exception until the dashboard refactoring ? I've got a hundred or so boxes for which I'd like to have the uptime, and making the changes locally could take a long time ^^ Regards,

Neozlag avatar Jan 30 '24 15:01 Neozlag

I don't expect as removing it later will cost us even more time in discussions. Uptime only as a string is also not a very useful endpoint for other machines to process.

AdSchellevis avatar Jan 30 '24 16:01 AdSchellevis

Since the dashboard refactor is in progress on master, here is the commit: https://github.com/opnsense/core/commit/d267e33de4fb5629c476341d90050fcd5698075d. The output is a bit more detailed than the uptime command (seconds included), and adjusted for locale. Endpoint is /api/core/system/systemTime

swhite2 avatar Apr 05 '24 07:04 swhite2