mirror of
https://github.com/ThunixdotNet/thunix_api.git
synced 2026-01-24 05:10:17 +00:00
Finished memory endpoint
This commit is contained in:
15
README.md
15
README.md
@@ -57,7 +57,7 @@ This endpoint shall return a json struct containing interfaces, and IP addresses
|
|||||||
|
|
||||||
### uptime
|
### uptime
|
||||||
|
|
||||||
This will return a struct of system uptime:
|
This will return a JSON payload of system uptime:
|
||||||
|
|
||||||
```
|
```
|
||||||
{
|
{
|
||||||
@@ -68,6 +68,19 @@ This will return a struct of system uptime:
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### mem
|
||||||
|
|
||||||
|
This will return a JSON payload containing information about the system memory, in bytes:
|
||||||
|
|
||||||
|
```
|
||||||
|
{
|
||||||
|
"free" : 8668672000,
|
||||||
|
"total" : 33638055936,
|
||||||
|
"percent" : 74.2,
|
||||||
|
"used" : 22686449664
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
### teapot
|
### teapot
|
||||||
|
|
||||||
This shall return a struct, describing the current tea making capabilities of the system:
|
This shall return a struct, describing the current tea making capabilities of the system:
|
||||||
|
|||||||
@@ -5,4 +5,11 @@ class Memory(Resource):
|
|||||||
def get(self):
|
def get(self):
|
||||||
vmem_usage = psutil.virtual_memory()
|
vmem_usage = psutil.virtual_memory()
|
||||||
smem_usage = psutil.swap_memory()
|
smem_usage = psutil.swap_memory()
|
||||||
abort(501, message="Not currently implemented.")
|
json_payload={
|
||||||
|
"total":vmem_usage.total,
|
||||||
|
"free":vmem_usage.free,
|
||||||
|
"used":vmem_usage.used,
|
||||||
|
"percent":vmem_usage.percent
|
||||||
|
}
|
||||||
|
#abort(501, message="Not currently implemented.")
|
||||||
|
return json_payload
|
||||||
|
|||||||
Reference in New Issue
Block a user