diff docker/libervia_cont.sh @ 104:b59491821a8a

docker (libervia_cont): added a "stats" command for containers resources usage statistics
author Goffi <goffi@goffi.org>
date Sat, 27 Feb 2016 00:45:58 +0100
parents e69883c1ec30
children a7b8bb39736b
line wrap: on
line diff
--- a/docker/libervia_cont.sh	Sat Feb 27 00:45:40 2016 +0100
+++ b/docker/libervia_cont.sh	Sat Feb 27 00:45:58 2016 +0100
@@ -56,7 +56,7 @@
 
 DOCKER_EXE="docker"
 
-USAGE="Usage: $0 [start|stop|restart|status|update|backup|restore|ports|config] [ARGS...]"
+USAGE="Usage: $0 [start|stop|restart|status|update|backup|restore|ports|config|stats] [ARGS...]"
 
 HELP_SITE="https://wiki.goffi.org/wiki/Docker/en"
 HELP_MUC="sat@chat.jabberfr.org"
@@ -206,6 +206,7 @@
         restore) CMD=RESTORE;;
         ports) CMD=PORTS;;
         config) CMD=CONFIG;;
+        stats) CMD=STATS;;
         -v|--version) printf "$VERSION\n"; exit 0;;
         -h|--help) printf "$USAGE\n\nYou can check $HELP_SITE for instructions, or go to $HELP_MUC XMPP MUC room for help\n"; exit 0;;
         *) echo $USAGE
@@ -413,7 +414,13 @@
         fi
         rm -rf "$TMP_DIR"
         ;;
-
+    STATS)
+        if [ -n "$1" -a "$1" != "--no-stream" ]; then
+            printf "usage: $0 stats [--no-stream]\n"
+            exit 1
+        fi
+        docker stats $1 $CONTAINERS
+        ;;
     *) printf "Error: unknown command !"
        exit 2
 esac