-
-
Save jcooklin/66817a4cafd46506f95f 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/bash -x | |
SESSION_NAME="snap-cpu" | |
tmux has-session -t ${SESSION_NAME} | |
if [ $? != 0 ] | |
then | |
# create the session | |
tmux new-session -s ${SESSION_NAME} -n snapd -d | |
# window 0 - snapd | |
tmux send-keys -t ${SESSION_NAME} 'snapd -t 0 -l 1' C-m | |
# window 1 - snapctl | |
tmux new-window -n bash -t ${SESSION_NAME} | |
# load plugins | |
tmux send-keys -t ${SESSION_NAME}:1 'snapctl plugin load /usr/local/lib/snap/plugins/snap-plugin-collector-cpu' C-m | |
tmux send-keys -t ${SESSION_NAME}:1 'snapctl plugin load /usr/local/lib/snap/plugins/snap-publisher-file' C-m | |
tmux send-keys -t ${SESSION_NAME}:1 'snapctl plugin load /usr/local/lib/snap/plugins/snap-plugin-collector-perfevents' C-m | |
tmux send-keys -t ${SESSION_NAME}:1 'snapctl task create --name cpu -t /usr/local/lib/snap/tasks/cpu-task.json' C-m | |
tmux send-keys -t ${SESSION_NAME}:1 "snapctl task watch \$(snapctl task list | grep cpu | awk '{print \$1}')" C-m | |
# window 2 memcached | |
tmux new-window -n memcached -t ${SESSION_NAME} | |
#tmux send-keys -t ${SESSION_NAME}:2 'docker run --name memcached -p 11211:11211 memcached:latest' | |
# window 3 - graphite | |
tmux new-window -n graphite -t ${SESSION_NAME} | |
#tmux send-keys -t ${SESSION_NAME}:3 'docker run --name graphite -p 80:80 -p 2003-2004:2003-2004 --restart=always hopsoft/graphite-statsd' | |
# window 4 - grafana | |
tmux new-window -n grafana -t ${SESSION_NAME} | |
#tmux send-keys -t ${SESSION_NAME}:4 'docker run -i -p 3000:3000 --link graphite --name grafana grafana/grafana' | |
# window 5 - mutilator | |
tmux new-window -n mutilator -t ${SESSION_NAME} | |
tmux send-keys -t ${SESSION_NAME}:5 'docker run -it --name mutilator --link memcached nqnielsen/mutilate-docker' | |
fi | |
tmux attach -t ${SESSION_NAME} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment