title: “UTF-8 Terminal charset”
date: 2017-01-25T19:47:41
slug: utf-8-terminal-charset
dpkg-reconfigure locales
vi ~/.bashrc
export LC\_ALL=en\_US.UTF-8
export LANG=en\_US.UTF-8
export LANGUAGE=en\_US.UTF-8
Sofort übernehmen
source ~/.bashrc
title: “UTF-8 Terminal charset”
date: 2017-01-25T19:47:41
slug: utf-8-terminal-charset
dpkg-reconfigure locales
vi ~/.bashrc
export LC\_ALL=en\_US.UTF-8
export LANG=en\_US.UTF-8
export LANGUAGE=en\_US.UTF-8
Sofort übernehmen
source ~/.bashrc
title: “ffmpeg – increase volume”
date: 2017-01-07T16:22:42
slug: ffmpeg-increase-volume
Extract Audio
docker run -v `pwd`:/tmp/t nachochip/ffmpeg -i /tmp/t/t.mp4 -vn -acodec copy /tmp/t/audio.aac
Increase Volume
docker run -v `pwd`:/tmp/t nachochip/ffmpeg -i /tmp/t/audio.aac -af "volume=5" /tmp/t/output.wav -y
Extract Video
docker run -v `pwd`:/tmp/t nachochip/ffmpeg -i /tmp/t/t.mp4 -an -vcodec copy /tmp/t/v.mp4
Merge together
docker run -v `pwd`:/tmp/t nachochip/ffmpeg -i /tmp/t/v.mp4 -i /tmp/t/output.wav -vcodec copy -acodec aac -b:a 254k -strict -2 /tmp/t/tina.mp4 -y
Delogo
ffmpeg -i tk.mkv -vf delogo=x=1077:y=58:w=124:h=66 -c:a copy /var/www/html/t.mkv -y
title: “Securing Postfix & Dovecot”
date: 2016-12-09T10:28:25
slug: securing-postfix-dovecot
Create a cert Chain if needed:
cat private/server.crt startssl/sub.class2.server.ca.pem private/server\_with\_chain.pem
Test Certificates
openssl s\_client -connect localhost:imaps
openssl s\_client -connect localhost:143 -starttls imap
openssl s\_client -connect localhost:25 -starttls smtp
Result should include:
Verify return code: 0 (ok)
Check Certificate Details
echo | openssl s\_client -showcerts -servername gnupg.org -connect asanger.biz:443 2>/dev/null | openssl x509 -inform pem -noout -text
title: “Install Kubernetes on Ubuntu 16”
date: 2016-12-06T11:27:28
slug: install-kubernetes-on-ubuntu-16
Install Kubernetes I
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
cat <<EOF > /etc/apt/sources.list.d/kubernetes.list
deb http://apt.kubernetes.io/ kubernetes-xenial main
EOF
apt-get update
# Install docker if you don't have it already.
apt-get install -y docker.io
apt-get install -y kubelet kubeadm kubectl kubernetes-cni
Enable docker
systemctl enable docker
docker ps
Install Kubernetes & Network Overlay II
kubeadm init
kubectl apply -f https://git.io/weave-kube
ifconfig -a #Should show a wave interafce with address 10.32.0.2
title: “Show Top 50 open files”
date: 2016-11-18T10:36:11
slug: show-top-50-open-files
lsof -s | awk '$5 == "REG"' | sort -n -r -k 7,7 | head -n 50
title: “Create a client Certificate”
date: 2016-10-11T19:37:42
slug: create-a-client-certificate
Extract the Certs from the kube config (base64 -d)
openssl pkcs12 -export -clcerts -inkey client.key -in client.crt -out kubecfg.p12 -name "kubernetes-client"
title: “post-663”
date: 2016-10-10T10:26:11
slug: 663
vi /etc/udev/rules.d/70-persistent-net.rules
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?\*", ATTR{address}=="02:01:02:03:04:05", ATTR{dev\_id}=="0x0", ATTR{type}=="1", NAME="eth0"
Edit /etc/network/interfaces and change the interface name to eth0
title: “2. Install Alert Manager”
date: 2016-10-07T13:30:07
slug: 2-install-alert-manager
wget https://github.com/prometheus/alertmanager/releases/download/v0.4.2/alertmanager-0.4.2.linux-amd64.tar.gz
tar -xzf alertmanager-0.4.2.linux-amd64.tar.gz
cd alertmanager-0.4.2.linux-amd64
vi simple.yml
global:
# The smarthost and SMTP sender used for mail notifications.
smtp\_smarthost: 'www.hostingvalley.de:25'
smtp\_from: 'asanger@it-asanger.de'
smtp\_auth\_username: 'asanger@it-asanger.de'
smtp\_auth\_password: 'xxxxx'
# The auth token for Hipchat.
hipchat\_auth\_token: '1234556789'
# Alternative host for Hipchat.
hipchat\_url: 'https://hipchat.foobar.org/'
Start AlertManager:
./alertmanager -config.file=simple.yml
title: “2. Prometheus installieren”
date: 2016-10-07T13:00:36
slug: 2-prometheus-installieren
wget https://github.com/prometheus/prometheus/releases/download/v1.1.3/prometheus-1.1.3.linux-amd64.tar.gz
tar -xzf prometheus-1.1.3.linux-amd64.tar.gz
cd prometheus-1.1.3.linux-amd64
vi prometheus.yml
global:
scrape\_interval: 15s # By default, scrape targets every 15 seconds.
evaluation\_interval: 15s # Evaluate rules every 15 seconds.
# Attach these extra labels to all timeseries collected by this Prometheus instance.
external\_labels:
monitor: 'codelab-monitor'
rule\_files:
- 'prometheus.rules'
scrape\_configs:
- job\_name: 'prometheus'
# Override the global default and scrape targets from this job every 5 seconds.
scrape\_interval: 5s
static\_configs:
- targets: ['localhost:9090']
- job\_name: 'node'
# Override the global default and scrape targets from this job every 5 seconds.
scrape\_interval: 1s
static\_configs:
- targets: ['127.0.0.1:9100']
labels:
group: 'localhost'
Diese Konfiguration pollt jede Sekunde die Metrics vom localhost port 9100
Einen Job anlegen (rules Datei):
vi prometheus.rules
job\_service:bandwidth1 = rate(node\_network\_receive\_bytes{device="eth0"}[2s])
Einen Alert anlegen (rules Datei):
# Bandwidth Alert > 1s.
ALERT BandwidthHighAlert
IF rate(node\_network\_receive\_bytes{device="eth0"}[2s])/1024/1024 > 1
FOR 10s
ANNOTATIONS {
summary = "high Network Traffic on {{ $labels.instance }}",
description = "{{ $labels.instance }} has high Network Traffic (current value: {{ $value }}s)",
}
Start Prometheus with AlertManager at localhost Port 9093
./prometheus -config.file=prometheus.yml -alertmanager.url=http://localhost:9093
title: “1. Node Exporter für Metrics installieren”
date: 2016-10-07T12:51:51
slug: node-exporter-fur-metrics-installieren
wget https://github.com/prometheus/node\_exporter/releases/download/0.12.0/node\_exporter-0.12.0.linux-amd64.tar.gz
https://github.com/prometheus/node\_exporter/releases/download/0.12.0/node\_exporter-0.12.0.linux-amd64.tar.gz
cd node\_exporter-0.12.0.linux-amd64
./node\_exporter
Die letzte Zeile der Ausgabe sollte: “INFO[0000] Listening on :9100 source=node_exporter.go:176” sein.
Die Metrics sollten hier ausgegeben werden:
http://127.0.0.1:9100/metrics