sdslabs/gasper

Add endpoints for probing container health, cpu/memory usage

supra08 opened this issue · 0 comments

Currently, there doesn't exist any endpoint for getting information on container health and CPU/Memory usages. It will useful for getting metrics in the applications dashboard.

A simple way to get the stats is by using the top bash command.
An equivalent Docker CLI command for it is:
docker exec -it <container_name> top -b -d 1
This must be executed using the Golang docker client and the output to be parsed using regex for occurrence of Cpu and Memory. This data is to be returned to the endpoint's request.

This request would be made to the Mizu microservice and it will then decide based on the app name where to execute the exec.

There can be other methods to get realtime CPU/Memory usages. It's upto to the issue solver to research and find the best solution.

A huge plus point if it is built on websockets. It can bring true realtime data to the client application.