small program to collect data on a docker container and make it available on a webserver
Spin up a docker container using the below command(s) in cmd/terminal:
docker pull progrium/stress
docker run --name testcontainer --rm -it progrium/stress --cpu 1 --io 1 --vm 2 --vm-bytes 128M
Alternatively, start your own Docker container + name and change the name value in the .env
file.
Clone the repository then execute go get .
and then go run .
from within the project directory.
GET
to http://localhost:8080/metrics/
GET
to http://localhost:8080/metrics/cpu?under=<cpu_percent>
GET
to http://localhost:8080/metrics/cpu?over=<cpu_percent>
GET
to http://localhost:8080/metrics/cpu?over=<cpu_percent>&under=<cpu_percent>
GET
to http://localhost:8080/metrics/?before=<unix_timestamp>
GET
to http://localhost:8080/metrics/?after=<unix_timestamp>
GET
to http://localhost:8080/metrics/?before=<unix_timestamp>&after=<unix_timestamp>
GET
to http://localhost:8080/metrics/live