Skip to content

Instantly share code, notes, and snippets.

View cjohnston1158's full-sized avatar

Chris Johnston cjohnston1158

View GitHub Profile
{
"dashboard": {
"annotations": {
"list": [
]
},
"description": "etcd dashboard Derived from https://raw.githubusercontent.com/etcd-io/etcd/master/Documentation/op-guide/grafana.json",
"editable": true,
"gnetId": null,
@cjohnston1158
cjohnston1158 / gist:46a2541fb464c52a0dea99d46e0f1125
Created February 9, 2021 14:36
prometheus scrape-job for etcd
juju config prometheus scrape-jobs="
- job_name: 'etcd_metrics'
metrics_path: /metrics
scheme: https
scrape_interval: 30s
static_configs:
- targets: ['10.5.0.42:2379']
- targets: ['10.5.1.137:2379']
- targets: ['10.5.1.249:2379']
tls_config:
@cjohnston1158
cjohnston1158 / ppa.py
Created May 6, 2020 20:13
Get version information for package(s) in a PPA
#!/usr/bin/python3
# Author: Chris Johnston <cjohnston@ubuntu.com>
# Initial inspiration from:
# https://gist.github.com/nathan-osman/b9158d058cc45916dcd20a591b66d0b4
from argparse import ArgumentParser
from sys import exit
try:
from launchpadlib.launchpad import Launchpad
from tabulate import tabulate
@cjohnston1158
cjohnston1158 / bionic.txt
Last active April 28, 2020 17:06 — forked from niedbalski/mongodb_collection_sizes.js
List mongodb collections in descending order of size. Helpful for finding largest collections. First number is "size," second is "storageSize."
# for juju on bionic
cat << EOF > /tmp/a.js
db = db.getSiblingDB('juju');
var collectionNames = db.getCollectionNames(), stats = [];
collectionNames.forEach(function (n) { stats.push(db[n].stats()); });
stats = stats.sort(function(a, b) { return b['size'] - a['size']; });
for (var c in stats) { print(stats[c]['ns'] + ": " + stats[c]['size'] + " (" + stats[c]['storageSize'] + ")"); }
EOF
/usr/bin/mongo --sslAllowInvalidCertificates --ssl -u admin -p $(grep oldpassword /var/lib/juju/agents/machine-0/agent.conf | awk -e '{print $2}') localhost:37017/admin /tmp/a.js
### Keybase proof
I hereby claim:
* I am cjohnston1158 on github.
* I am cjohnston (https://keybase.io/cjohnston) on keybase.
* I have a public key ASCH6ODfKLgSgmyhNetICTm2Ry9o8tLPRi25ll22wwrP5Qo
To claim this, I am signing this object: