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 | |
dbpass=$(grep statepassword /var/lib/juju/agents/machine-*/agent.conf | cut -d' ' -f2) | |
while true; do mongo 127.0.0.1:37017/juju -u "machine-0" -p "$dbpass" --sslAllowInvalidCertificates --ssl --authenticationDatabase admin --eval "printjson(db.stats())" | grep -Ei '(datasize|storage|objects)' && sleep 1;done |
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 | |
# gather metrics about sockstat and buffer size. | |
currdate=$(date +"%m-%d-%Y") | |
timeout=${1:-600} | |
every=${2:-1} | |
basepath=${3:-./sockstat-report-${currdate}/} | |
function watch_it() { | |
timeout $1 watch -t -n $2 "cat $3 | tee -a ${basepath}$(basename ${3})_${currdate}.log" &>/dev/null & |
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 | |
# | |
# gather metrics about sockstat and buffer size. | |
# | |
timeout=${1:-600} | |
every=${2:-1} | |
function watch_it() { | |
timeout $1 watch -t -n $2 "cat $3 | tee -a $(basename ${3})_$(date +"%m-%d-%Y").log" &>/dev/null & |
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
for f in $(ldd /usr/sbin/named|cut -d" " -f1 | cut -d "." -f1); do sudo apt-cache search $f | grep dbgsym | grep $f | cut -d " " -f1| xargs apt -yyq install;done |
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
#!/usr/bin/env python | |
import subprocess | |
import yaml | |
import sys | |
def juju_status(juju_env=None): | |
cmd = ['juju', 'status', '--format=yaml'] | |
status_raw = subprocess.check_output(cmd) | |
return yaml.safe_load(status_raw) |
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
function charmhead() { | |
if [ ! ${#@} -ge 2 ]; then | |
echo "usage ./$0 charm revision" && return; | |
fi | |
q=$(curl -s https://api.jujucharms.com/charmstore/v5/$1-$2/archive/repo-info | python -c "import sys, re; q=map(lambda x: re.search('.*commit-short\: (.*)', x), sys.stdin.readlines()); print(q[1].group(1))") | |
if [ -n "$q" ]; then | |
echo "$q"; | |
else | |
echo "Not found revision for charm: $1" | |
fi |
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 | |
# ./{0} nova-cloud-controller | |
units=$(juju status $1 | grep -E '[a-z\-]+\/[0-9]+' | awk '{print $1}' | sed s'/.$//') | |
for unit in ${units}; do | |
relations=$(juju run --unit ${unit} 'relation-ids memcache') | |
for relation in ${relations}; do | |
unit_list=$(juju run --unit ${unit} "relation-list -r ${relation}") | |
for related in ${unit_list}; do | |
addr=$(juju run --unit ${unit} "relation-get -r ${relation} private-address ${related}") |
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
package main | |
import ( | |
"fmt" | |
"os" | |
"github.com/juju/utils" | |
) | |
const MIN_LEN = 30 |
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
from jinja2 import Environment | |
import yaml | |
import sys | |
RULE_TPL = """ | |
ALERT {{ alert }} | |
IF {{ expr }} | |
FOR {{ for }} | |
LABELS { | |
severity="page" |
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
#!/usr/bin/python | |
import os | |
import subprocess | |
import time | |
import yaml | |
import re | |
user_name = os.environ.get("DOCKERHUB_USER") |