Last active
August 29, 2015 14:13
-
-
Save benhardy/63a5c23615f8a562a68f to your computer and use it in GitHub Desktop.
This file contains hidden or 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/sh | |
# | |
# Show resource usage as reported by Singularity | |
# | |
# author: github.com/benhardy | |
set -o errexit -o nounset | |
if [ $# -ne 1 ]; then | |
echo "Usage: $0 singularity-resource-usage.sh SINGULARITY_SERVER" | |
exit 1 | |
fi | |
SINGULARITY_SERVER=$1 | |
REQS=$(curl -s http://$SINGULARITY_SERVER/api/requests | jq '.[].request.id'|tr -d '"') | |
(for REQ in $REQS; do | |
echo $REQ $( curl -s http://$SINGULARITY_SERVER/api/requests/request/$REQ | jq '.activeDeploy.resources'|jq '.cpus, .memoryMb, .numPorts') | |
done) | sort | perl -ne 'chop; ($name,$cpu,$ram,$ports)=split; printf("%-40s %5.2f cpu %5dmb ram %2d ports\n",$name,$cpu,$ram,$ports);' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment