MovingBlocks / FacadeServer

A headless facade that acts as a game host and provides web-based administration. Automation category: Terasology Facade. See https://forum.terasology.org/threads/facadeserver-headless-server-with-web-interface.1906
Apache License 2.0
4 stars 11 forks source link

Add system status information to REST API #13

Closed Inei1 closed 6 years ago

Inei1 commented 6 years ago

This PR adds relevant information on the system (CPU usage percentage, memory available/total/used/used percentage, system uptime) to the REST API. To view it, make a GET request to api/resources/system with the web browser or another tool, and notice how the data you get in JSON format describes system information, which you can confirm with task manager or another resource manager.

Oshi, the library used here, uses JNA. Luckily, the main Terasology engine already uses JNA in a few places, so we don't need to add any natives or anything like that. The Terasology engine uses a slightly outdated version of JNA, so we have two options:

  1. Use an older version of Oshi (3.4.0 instead of 3.5.0) I don't think this will do any harm. This PR was made with this method, and it already works.
  2. Update the version of JNA in the engine. I think this will be more work than it is worth for now.

frontend PR: https://github.com/MovingBlocks/FacadeServer-frontend/pull/3

mkienenb commented 6 years ago

Just skimming the PR and the slack channel, but I will note that https://github.com/patric-r/jvmtop provides some pretty interesting stats and I think it's all native java code.