-
-
Save gladiopeace/5312cb3172c83de590bfe64922502a76 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# TODO: Add cmd to add to cron schedule (every 5 min? 15? 60? or 1?) | |
# TODO: Add a netcat cmd to push the results into a syslog or other compatible endpoint | |
# TODO: Fields with a " / " need additional parsing and normalization (MB vs. kB) | |
docker stats --no-stream --format 'Name="{{.Name}}"\tCPUPerc="{{.CPUPerc}}"\tMemPerc="{{.MemPerc}}"\tMemUsage="{{.MemUsage}}"\tBlockIO="{{.BlockIO}}"\tNetIO="{{.NetIO}}"' | |
exit | |
# Results Resemble this currently: | |
Name="xray_app_1" CPUPerc="0.20%" MemPerc="11.51%" MemUsage="345.8 MiB / 2.933 GiB" BlockIO="31.6 MB / 168 kB" NetIO="14.5 MB / 9.89 MB" | |
Name="xray_mongodb_1" CPUPerc="0.86%" MemPerc="1.31%" MemUsage="39.24 MiB / 2.933 GiB" BlockIO="0 B / 0 B" NetIO="8.29 MB / 10.9 MB" | |
Name="xray_redis_1" CPUPerc="0.18%" MemPerc="0.04%" MemUsage="1.105 MiB / 2.933 GiB" BlockIO="0 B / 65.5 kB" NetIO="205 kB / 113 kB" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment