Skip to content

Instantly share code, notes, and snippets.

@AlexisDucastel
AlexisDucastel / removeClusterConfig.sh
Last active July 9, 2016 02:20
Proxmox cluster delete
# First, make a backup of the cluster:
cp -a /etc/pve /root/pve_backup
# Stop cluster service:
/etc/init.d/pve-cluster stop
# Umount /etc/pve if it is mounted:
umount /etc/pve
# Stop corosync service:
#!/bin/bash
function die { echo "ERROR: $*"; exit 1; }
[ $# -lt 2 ] && die "Too few arguments"
KNOCKPORTS="$1"
shift
HOST="$1"
shift
http://jarrpa.net/2011/10/28/creating-custom-url-handlers-in-ubuntu-11-04-11-10-gnome-3-0/
@AlexisDucastel
AlexisDucastel / cdm-setup.sh
Last active April 27, 2018 07:22
Cloudera Manager setup
cd /etc/apt/sources.list.d/
wget https://archive.cloudera.com/cm5/ubuntu/xenial/amd64/cm/cloudera.list
apt update
apt-get install oracle-j2sdk1.7
cd
wget http://archive.cloudera.com/cm5/installer/5.14.3/cloudera-manager-installer.bin
chmod u+x cloudera-manager-installer.bin
sudo ./cloudera-manager-installer.bin
@AlexisDucastel
AlexisDucastel / bench.sh
Created November 28, 2018 17:03
Benchmark script for Kubernetes CNI
#!/bin/bash
BENCH_CYCLE="3"
IPERFTIME="120"
function log { echo $(date "+%Y-%m-%d %H:%M:%S") $@; }
function info { log INFO "$@"; }
function warning { log WARNING "$@"; }
function error { log ERROR "$@"; }
function fatal { log FATAL "$@"; exit 2; }
@AlexisDucastel
AlexisDucastel / servers.yml
Last active November 28, 2018 17:14
Benchmark CNI Kubernetes - servers kube manifests
# server-iperf3.yml
apiVersion: v1
kind: Pod
metadata:
labels:
run: iperf-srv
name: iperf-srv
spec:
containers:
- args:
@AlexisDucastel
AlexisDucastel / cni-cilium.yml
Created November 28, 2018 17:19
Kubernetes CNI benchmark - Cilium manifest
###############################################################################
#
# This is a standalone etcd deployment for PoC or testing purposes. It runs a
# single replica etcd using host networking. Data is stored in /var/etcd on the
# host's disk. A scheduling toleration allows it to be scheduled before the
# cluster is ready. A scheduling anti affinity ensures that never more than one
# instance is running per node. A NodePort service makes etcd avaiable on a
# stable address on all nodes without requiring DNS resolution to work
#
# etcd address:
@AlexisDucastel
AlexisDucastel / monit.sh
Created November 29, 2018 10:42
Second scale system metrics
#!/bin/bash
while true
do
echo "$(sleep 1;free -m|grep Mem:|awk '{print $3}') $(sar 1 1 | grep Average|awk '{print $3" "$4" "$5" "$6" "$7}')" >> /home/ubuntu/metrics.log
done
@AlexisDucastel
AlexisDucastel / stats.sh
Created November 29, 2018 10:47
Second scale metrics consumer
#!/bin/bash
COUNT=$1
tail -n$COUNT /home/ubuntu/metrics.log | \
awk '{M+=$1;U+=$2;N+=$3;S+=$4;I+=$5;T+=$6} END {printf "%d\t=%.2f+%.2f+%.2f+%.2f+%.2f\n",M/NR,U/NR,N/NR,S/NR,I/NR,T/NR}'
@AlexisDucastel
AlexisDucastel / gist:1df4efd6b4e8b0253edf0e67874a9283
Created March 19, 2019 14:38
List listening TCP ports on linux
cat /proc/net/tcp| cut -c -36|grep '0A$'| cut -c 16-19| while read line; do echo $((16#$line)); done