Skip to content

Instantly share code, notes, and snippets.

View galexrt's full-sized avatar

Alexander Trost galexrt

View GitHub Profile
@galexrt
galexrt / node_exporter.sh
Last active February 26, 2024 20:33
Simple Prometheus node_exporter install script (Updated for 1.0.1)
#!/bin/bash
version="${VERSION:-1.0.1}"
arch="${ARCH:-linux-amd64}"
bin_dir="${BIN_DIR:-/usr/local/bin}"
wget "https://github.com/prometheus/node_exporter/releases/download/v$version/node_exporter-$version.$arch.tar.gz" \
-O /tmp/node_exporter.tar.gz
mkdir -p /tmp/node_exporter
@galexrt
galexrt / rook-ceph-mon50
Last active August 20, 2017 16:04
rook Ceph mon dying
2017-08-20 15:13:12.638284 I | cephmon: parsing mon endpoints: rook-ceph-mon48=10.3.44.89:6790,rook-ceph-mon49=10.3.150.63:6790,rook-ceph-mon51=10.3.157.215:6790,rook-ceph-mon50=10.3.162.13:6790
2017-08-20 15:13:12.638615 I | cephmon: writing config file /var/lib/rook/rook/rook.config
2017-08-20 15:13:12.638724 I | cephmon: generated admin config in /var/lib/rook/rook
2017-08-20 15:13:12.638823 I | cephmon: writing config file /var/lib/rook/rook-ceph-mon49/rook.config
2017-08-20 15:13:12.638905 I | cephmon: initializing mon
2017-08-20 15:13:12.638913 I | exec: Running command: monmaptool /var/lib/rook/rook-ceph-mon49/monmap --create --clobber --fsid 2c50d7fc-8533-45bd-bf42-970c435e4a3d --add rook-ceph-mon50 10.3.162.13:6790 --add rook-ceph-mon48 10.3.44.89:6790 --add rook-ceph-mon49 10.3.150.63:6790 --add rook-ceph-mon51 10.3.157.215:6790
2017-08-20 15:13:12.657429 I | monmaptool: monmap file /var/lib/rook/rook-ceph-mon49/monmap
2017-08-20 15:13:12.657448 I | monmaptool: set fsid to 2c50d7fc-8533-45bd-bf42-97
@galexrt
galexrt / clone-all-galexrt-github-repos-jq.sh
Last active February 26, 2018 10:56 — forked from caniszczyk/clone-all-twitter-github-repos.sh
Clone all non-fork repos of a user
GITHUB_USERNAME="galexrt"
for repo in $(curl -s https://api.github.com/users/${GITHUB_USERNAME}/repos\?per_page\=200 | jq --raw-output '.[] | select(.fork != true) | .ssh_url'); do
git clone "${repo}"
done

Keybase proof

I hereby claim:

  • I am galexrt on github.
  • I am galexrt (https://keybase.io/galexrt) on keybase.
  • I have a public key whose fingerprint is 0604 9CBE C64F 07E9 5098 7B6D 5CF1 D460 0D4C BFDF

To claim this, I am signing this object:

@galexrt
galexrt / rook-cluster.yaml
Last active July 16, 2018 11:45
CoreOS is used for the nodes. Every node has sda10 mounted to /var/lib/rook and sdb empty used as a whole. The nodes have been labelled according to the placements.
apiVersion: rook.io/v1alpha1
kind: Cluster
metadata:
name: rook
namespace: rook
spec:
versionTag: master
dataDirHostPath: /var/lib/rook-config
# toggle to use hostNetwork
hostNetwork: true
@galexrt
galexrt / with-fs-and-normal-pool
Last active December 28, 2017 20:53
Rook Ceph Mgr Metrics Output
# HELP ceph_mds_cache_recovery_completed File recoveries completed
# TYPE ceph_mds_cache_recovery_completed counter
ceph_mds_cache_recovery_completed{ceph_daemon="mds.mhgmp2"} 0.0
ceph_mds_cache_recovery_completed{ceph_daemon="mds.m7dwwf"} 0.0
# HELP ceph_osd_op_out_bytes Client operations total read size
# TYPE ceph_osd_op_out_bytes counter
ceph_osd_op_out_bytes{ceph_daemon="osd.0"} 5477.0
# HELP ceph_pg_incomplete PG incomplete
# TYPE ceph_pg_incomplete gauge
@galexrt
galexrt / ceph-mon-recovery.md
Last active April 5, 2018 20:20
A WIP doc page on Ceph Mon recovery when running Rook.

Rook <= 0.7.0 mon hostNetwork: true node IP issue

NOTE If you need assistance with steps 3 through 5, let us know on the Rook Slack and we are happy to help you.

WARNING You should not have to go through this section when having hostNetwork: false (or haven't even set it)! WARNING If you have/had multiple Filesystems created, this guide may not work for you because of a bug in Ceph that causes the mons to crash during the "FS Map" assertion.

  1. Scale rook-operator down (e.g. replicas: 0).
  2. Edit all rook-ceph-mon ReplicaSets to have command: ['sleep', '3600'] in the mon container, but copy the other args and command values somewhere safe for each mon.
  3. Exec into the first mon and run: monmap --print /var/lib/rook/rook-ceph-mon-$MON_ID/monmap.
  • Where MON_ID is the ID of the mon you execed into.
@galexrt
galexrt / k8s_backitup.sh
Created February 3, 2018 14:08
A bash script using jq to backup a Kubernetes cluster. I recommend using a tool like heptio/ark for K8s backups/disaster recovery.
#!/bin/bash
RESSOURCE_IGNORE="^(namespaces|pods|events|nodes|clusters|storageclasses|thirdpartyresources|clusterrolebindings|clusterroles|componentstatuses|persistentvolumes)$"
echo "-> Getting namespaces ..."
kubectl get --export -o=json ns | \
jq '.items[] |
select(.metadata.name!="kube-system") |
select(.metadata.name!="default") |
del(.status,
@galexrt
galexrt / hb_all_books_dl.js
Last active January 17, 2020 12:22 — forked from kfatehi/hb_all_books_dl.js
Humble bundle book bundles - download all books at once
/*
After purchasing a humble book bundle, go to your download page for that bundle.
Open a console window for the page and paste in the below javascript
this fork downloads all formats and does so without using jquery (since that didnt work for me)
note that if you are in chrome, chrome will not download the pdfs for you by default, to fix this
type “about:plugins” in the address bar and disable chrome's pdf viewer
*/
var pattern = /(ZIP|MOBI|EPUB.*|PDF|PDF( ?\(H.\))?|CBZ|PRC|Download|Supplement)$/i;
apiVersion: rook.io/v1alpha1
kind: Cluster
metadata:
name: rook
namespace: rook
spec:
versionTag: master
dataDirHostPath: /var/lib/rook/config
hostNetwork: true
monCount: 3