Skip to content

Instantly share code, notes, and snippets.

View tolleiv's full-sized avatar

Tolleiv Nietsch tolleiv

  • Bare.ID Gmbh - an AOE Group company
  • Wiesbaden, Deutschland
View GitHub Profile
@tolleiv
tolleiv / fdisk-shortened.sh
Created June 24, 2016 15:59
Small script which provides fdisk with the proper parameters without leaving the necessary documentation out
sed -e 's/\s*\([\+0-9a-zA-Z]*\).*/\1/' << EOF | fdisk ${1}
o # clear the in memory partition table
n # new partition
p # primary partition
1 # partition number 1
# default - start at beginning of disk
# default, extend partition to end of disk
t # change a partition's system id
83 # Linux partition
p # print the in-memory partition table
@tolleiv
tolleiv / gittosvn.sh
Created June 15, 2016 09:44
Some notes taken when we had to push a Git Repo to SVN
# http://caiustheory.com/adding-a-remote-to-existing-git-repo
git svn init -t tags -T trunk https://<svn-repo>/
git svn fetch
git remote add origin http://<git-repo>.git
git pull
svnCommit=`git show-ref trunk | awk '{print $1}'`
gitCommit=`git log --pretty=oneline master | tail -n1 | awk '{print $1}'`
echo "${gitCommit} ${svnCommit}" >> .git/info/grafts
git merge remotes/origin/master
git svn dcommit
@tolleiv
tolleiv / Rakefile
Created March 15, 2016 15:20
Tiny local server Rakefile
task default: :start
@pid_file='server.pid'
desc "Bring up a server"
task :start do
unless File.exist?(@pid_file)
@pid = Process.spawn(
'ruby -run -e httpd . -p 8000',
in: :close
#!/bin/sh
# Simple script to check a site for dead links etc.
# Usage:
# > spider.sh www.example.org 5
# to check example,org and follow links until you reacha depth of 5
wget --spider -r -nd -nv -H -l ${2:=4} -w 1 -D $1 -o site.log "http://${1}/"
@tolleiv
tolleiv / README.md
Created November 17, 2015 15:54
Logstash basic/sanity spec to make sure the testing system itself works.

Intend

This file shows a sample very basic test which mainly confirms that the rspec testframework works as expected.

Usage

Get Logstash and the developer plugins e.g. with:

wget https://download.elastic.co/logstash/logstash/logstash-2.0.0.tar.gz

tar -xzf logstash-2.0.0.tar.gz

@tolleiv
tolleiv / update-all-plugins.sh
Created October 19, 2015 10:40
Expect shell script to update all logstash plugins on Linux systems
#!/usr/bin/expect
set timeout -1
set count 200
spawn /opt/logstash/bin/plugin update
while {$count > 0} {
set count [expr $count-1];
expect {
@tolleiv
tolleiv / README.md
Created August 23, 2015 21:12
Mnfst Puppet Helper Scripts

Scripts which use the Puppet dashboard data and update the mnfst-neo graph information.

Prereqisites are curl, awk, jq and csvtool to be available in the system.

Usage:

  • Make sure to set the DASHBOARD_HOST and MNFST_HOST environment variables
  • Trigger ./run.sh NO once every 10-30 minutes (depending on the assumed change rate)
  • Trigger ./run.sh YES once or twice a day to import new server / file information for each system and remove relations which are not relevant anymore.
@tolleiv
tolleiv / README.md
Last active August 29, 2015 14:28
NoIPAM Sneak peak
@tolleiv
tolleiv / README.md
Last active February 7, 2017 21:08
Basic script to push Pingdom data into Zabbix - relies on using the same "item" keys in both systems

About

This script is used along with a basic autodiscovery (see the zbx_template.xml and the pingdom_ldd.json) to have Pingdom data available within Zabbix and to have Zabbix triggers based on that data.

How it works:

The zbx_pingdom_discovery.sh script:

  1. fetches the Pingdom data through the API, filtered by a tag which relates to the specific Zabbix Proxy
  2. transforms the Pingdom data with jq so that it fits the zabbix_sender data format
  3. pushes the information about available checks to the Zabbix proxy with zabbix_sender
@tolleiv
tolleiv / README.md
Last active August 29, 2015 14:25
Mnfst-Sneakpeak

.