Skip to content

Instantly share code, notes, and snippets.

View megastef's full-sized avatar
🏠
Working from home

Megastef megastef

🏠
Working from home
  • Twitter: @seti321
  • Germany
View GitHub Profile
#cloud-config
coreos:
etcd:
# generate a new token for each unique cluster from https://discovery.etcd.io/new?size=3
# specify the initial size of your cluster with ?size=X
discovery: https://discovery.etcd.io/token
# multi-region deployments, multi-cloud deployments, and droplets without
# private networking need to use $public_ipv4
addr: $private_ipv4:4001
@megastef
megastef / article.md
Created August 21, 2015 10:22
little markdown test with WP

Test in WP with embedded Markdown GIST

some text

@megastef
megastef / example.sh
Last active September 21, 2015 11:13
ES monitored with SPM
export SPM_TOKEN=YOUR_TOKEN_HERE
# Name two Elasticsearch nodes
export ES1="ES-1"
export ES2="ES-2"
# let's configure 2 nodes in this example
export SPM_CFG="${SPM_TOKEN} es javagent jvmname:${ES1};${SPM_TOKEN} es javagent jvmname:${ES2}"
docker run --name spm-client -e HOSTNAME=$HOSTNAME --restart=always -e SPM_CFG sematext/spm-client
# start the 2 Elasticsearch nodes, one exposes 9200 to the public
docker run --name $ES1 -h $ES1 p 9200:9200 -d --volumes-from spm-client -e ES_JAVA_OPTS="-Dcom.sun.management.jmxremote -javaagent:/opt/spm/spm-monitor/lib/spm-monitor-es.jar=${SPM_TOKEN}::${ES1} -es.node.name=${ES1}" elasticsearch
@megastef
megastef / run-sense.sh
Last active January 6, 2016 11:22
Install,configure, run sense
wget https://download.elastic.co/kibana/kibana/kibana-4.2.0-linux-x64.tar.gz
cd kibana-4.2.0-linux-x64
./bin/kibana plugin --install elastic/sense
echo -e "kibana.enabled: false # disable the standard kibana discovery, visualize & dashboard plugins\n
elasticsearch.enabled: false # do not require a running Elasticsearch 2.0 instance" >> config/kibana.yml
./bin/kibana
@megastef
megastef / sematext-marathon-task
Created December 22, 2015 12:48
Monitor Apache Mesos Docker Containers / deploy to each node / get all logs and metrics
curl -XPOST -H "Content-type: application/json" http://your_marathon_server:8080/v2/apps -d '
{
"container": {
"type": "DOCKER",
"docker": {
"image": "sematext/sematext-agent-docker"
},
"volumes": [
{
"containerPath": "/var/run/docker.sock",
@megastef
megastef / update-key.sh
Created January 26, 2016 16:02
Key change on uberspace.de - using a separate identity
export UUSER=seti123
export UHOST=aldebaran.uberspace.de
cd ~/.ssh
ssh-keygen -t rsa -b 4096 -f uberspace_rsa4096
cat ~/.ssh/uberspace_rsa4096.pub | ssh -p 4022 $UUSER@$UHOST 'cat >> .ssh/authorized_keys'
cat <<EOF >> ~/.ssh/config
Host $UHOST
Port 22
IdentityFile ~/.ssh/uberspace_rsa4096
@megastef
megastef / index-slack-mesages.sh
Created February 2, 2016 09:49
Index Slack Messages in Elasticsearch / Logsene
export SLACK_TOKEN=slack_token_here # https://api.slack.com/web
export LOGSENE_TOKEN=logsene_token_here # https://sematext.com/logsene
export LOGSENE_URL=https://logsene-receiver.sematext.com:443
node ./slack.js $SLACK_TOKEN | logagent -t $LOGSENE_TOKEN
@megastef
megastef / kubernetes-sematext-agent-daemonset.yml
Last active February 15, 2016 11:22
DaemonSet for Kubernetes to get all docker logs and metrics with Sematext Docker Agent
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: sematext-agent
spec:
template:
metadata:
labels:
app: sematext-agent
spec:
@megastef
megastef / deploy-sematext-with-docker-machine.sh
Last active April 14, 2016 18:27
Deploy Sematext Docker Agent each node in Docker-Swarm (TLS / docker-machine)
export SPM_TOKEN=TOUR_SPM_TOKEN
export LOGSENE_TOKEN=YOUR_LOGSENE_TOKEN
export NODES=$(docker-machine ls | grep Running | grep -v error | awk '{printf $1 "\t"}')
echo Swarm nodes: "$NODES"
for node in $NODES; do
echo "get docker-machine env $node"
eval "$(docker-machine env $node)"
echo "Using docker host: $DOCKER_HOST"
echo "deploy sematext-agent-docker to $node"
docker rm -f sematext-agent 2>1 /dev/null
@megastef
megastef / httpd.conf
Created June 8, 2016 08:47
default httpd.conf with stats enabled
ServerRoot "/usr/local/apache2"
Listen 80
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_core_module modules/mod_authn_core.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule access_compat_module modules/mod_access_compat.so
LoadModule auth_basic_module modules/mod_auth_basic.so