API call to get memory stats

Started by oupsman, December 24, 2022, 04:03:41 PM

Previous topic - Next topic
Hello,

I'm working on a widget for homepage (https://github.com/benphelps/homepage) to have informations on my OPNsenses firewall directly on my homepage. So far, I have the following infos (see attached picture) but getting memory usage and cpu usage is quite difficult, as I only found the /api/diagnostics/activity/getActivity to get it.

But memory information isn't accurate, and getting CPU usage info is tedious.

I would love to have a call similar to widgets/api/get.php?load=system%2Ctemperature%2Cinterfaces&_=xxxxxx

but this one does not seem to be allowed in API mode (aka with key:secret)

Is there any other API call that I missed ?

Thank you all.

Hi there,

If you're using the business version of OPNsense, you can call the /api/opncentral/sync/metrics endpoint. This will provide you with extensive information about memory, CPU usage, disk usage, and much more.

For documentation, visit: https://docs.opnsense.org/development/api/be/OPNBEcore.html

Best regards
- Vangsguard