Skip to content

Instantly share code, notes, and snippets.

@KekSfabrik
KekSfabrik / prometheus.yml
Created December 11, 2018 14:56
prometheus consul SD config
global:
scrape_timeout: 10s
scrape_interval: 15s
external_labels:
cluster: 'MY CLUSTER NAME'
# alternatively can be found via consul -- for details see
# https://prometheus.io/docs/prometheus/latest/migration/#alertmanager-service-discovery
alerting:
alertmanagers:

Keybase proof

I hereby claim:

  • I am keksfabrik on github.
  • I am keks (https://keybase.io/keks) on keybase.
  • I have a public key ASAaf3h0q5jax-crpdLN_mBwtJBv_FyLIC_bM4i9EHqDrgo

To claim this, I am signing this object:

def appendEnvironment(propFile) {
/*
Workaround for GIT plugin, if unset, set manually here:
*/
if (!env.GIT_BRANCH)
env.GIT_BRANCH = git('rev-parse --abbrev-ref HEAD').trim()
if (!env.GIT_COMMIT)
env.GIT_COMMIT = git('rev-parse HEAD').trim()
if (!env.GIT_URL)
env.GIT_URL = git('config --get remote.origin.url').trim()
var storageSize = 0
db._adminCommand("listDatabases").databases.forEach(function (d) {
mdb = db.getSiblingDB(d.name);
mdb.getCollectionNames().forEach(function(c) {
s = mdb[c].stats();
storageSize += s.storageSize
})
})
printjson((storageSize / 1024 / 1024 / 1024) + "GB")
@KekSfabrik
KekSfabrik / gist:784670ae34b4ae581de51c9ec73e6bc1
Created November 25, 2016 10:25
Some Docker cleanup scripts bash/powershell
# clean up exited & failed build (status "created") containers
docker rm -fv $(docker ps -q --filter status=exited --filter status=created)
# PowerShell:
ForEach($x in (docker ps -q --filter status=exited --filter status=created)) { docker rm -fv $x }
# clean up unused ("dangling") volumes
docker volume rm $(docker volume ls -q --filter dangling=true)
# PowerShell:
ForEach($x in (docker volume ls -q --filter dangling=true)) { docker volume rm $x }