ant-media / Ant-Media-Server

Ant Media Server is a live streaming engine software that provides adaptive, ultra low latency streaming by using WebRTC technology with ~0.5 seconds latency. Ant Media Server is auto-scalable and it can run on-premise or on-cloud.

Home Page:https://antmedia.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rest API method to get stats all in one

burak-58 opened this issue · comments

For monitoring purposes we want gathering resource usage stat from AMS instances.
Now we have work around by using several undocumented REST API methods:

/rest/getCPUInfo
/rest/getLiveClientsSize
/rest/getSystemMemoryInfo
/rest/getJVMMemoryInfo
/rest/getFileSystemInfo```
So it would be nice to have one method (preferable without auth, or basic HTTP auth) with several stats combined.

For example:
```curl -X GET http://ant1.mlan:5080/rest/server/getResourcesStat```
With response:
```{
    # Standart system stat
    "cpu_user": 1.0,
    "cpu_system": 1.0,
    "cpu_idle": 1.0,

    # Active streams for this particular server
    "active_streams_inbound": 100,
    "active_streams_outbound": 500,


    # GPU stas, output of 
    # nvidia-smi --query-gpu=index,name,utilization.gpu,utilization.memory,memory.total,memory.free,memory.used --format=csv
    "gpu_usage": [
        {
            "index": 0,
            "name": "GeForce GTX 1080",
            "utilization_gpu": "0 %",
            "utilization_memory": "0 %",
            "memory_total": "8119 MiB",
            "memory_free": "8109 MiB",
            "memory_used": "10 MiB",
        },
        {
            "index": 1,
            "name": "GeForce GTX 1080",
            "utilization_gpu": "0 %",
            "utilization_memory": "0 %",
            "memory_total": "8119 MiB",
            "memory_free": "8109 MiB",
            "memory_used": "10 MiB",
        }
        ...
    ],

    # As in /rest/getSystemMemoryInfo
    "system_virtual_memory" => 100,
    "system_total_memory" => 100,
    "system_free_memory" => 100,
    "system_in_use_memory" => 100,
    "system_total_swap_space" => 100,
    "system_free_swap_space" => 100,
    "system_in_use_swap_space" => 100,

    # As in /rest/getJVMMemoryInfo
    "jvm_max_memory" => 100,
    "jvm_total_memory" => 100,
    "jvm_free_memory" => 100,
    "jvm_in_use_memory" => 100,

    # As in /rest/getFileSystemInfo
    "usable_space" => 500,
    "total_space" => 500,
    "free_space" => 500,
    "in_use_space" => 500,
}```