Skip to content

Instantly share code, notes, and snippets.

@paulja
Last active August 24, 2017 10:46
Show Gist options
  • Save paulja/f05313e9a50b09dae064a42a07b196e0 to your computer and use it in GitHub Desktop.
Save paulja/f05313e9a50b09dae064a42a07b196e0 to your computer and use it in GitHub Desktop.
Cloud Foundry App Monitor
#!/bin/bash
#----------------------------------------------------------
# cf-mon monitors a CF app memory and CPU updating the
# screen as needed
#----------------------------------------------------------
# debugging
#set -ex
function help() {
echo "usage: $0 <app name> [wait]"
}
function monitor() {
local APP_NAME=$1
if [ -z ${APP_NAME} ]; then
echo " Missing app name argument"
return 1
fi
local WAIT=$2
if [ -z ${WAIT} ]; then
WAIT=5
fi
while :
do
clear
echo " Press CTRL+C to stop monitoring"
echo
cf app ${APP_NAME} | grep "#"
sleep ${WAIT}
done
}
#----------------------------------------------------------
# main
#----------------------------------------------------------
if [ -z $1 ]; then
help
exit 0
fi
monitor $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment