Skip to content

Instantly share code, notes, and snippets.

@johnko
johnko / couch-clone.py
Created October 26, 2015 09:27 — forked from dustin/couch-clone.py
Make a couch have all the stuff another couch has.
#!/usr/bin/env python
import sys
import couchdb
if __name__ == '__main__':
srcurl, desturl = sys.argv[1:]
@johnko
johnko / gist:12f03237ab74d69e0148
Created June 26, 2015 13:30
on mfsbsd, before fzg
#!/bin/sh
# on mfsbsd, before fzg
touch /boot/../mfsroot
mkdir -p /var/db/pkg
mount -t tmpfs tmpfs /var/db/pkg
mkdir -p /var/cache/pkg
mount -t tmpfs tmpfs /var/cache/pkg
mkdir -p /etc/pf
@johnko
johnko / gist:e6b238ab4fe9b02d6876
Created May 30, 2015 20:03
monit couchdb by port and restart or timeout
# http://andywenk.tumblr.com/post/31872057319/couchdb-monitoring-with-monit-really-working
check process couchdb with pidfile /usr/local/var/run/couchdb/couchdb.pid
group database
start program = "/etc/init.d/couchdb start -u couchdb"
stop program = "/etc/init.d/couchdb stop -u couchdb"
if failed host 127.0.0.1 port 5984 then restart
if cpu is greater than 40% for 2 cycles then alert
if cpu > 60% for 5 cycles then restart
if 10 restarts within 10 cycles then timeout
@johnko
johnko / gist:7842883ec28dad5362b0
Created May 30, 2015 20:02
monit couchdb by port and restart
#################################################################
# couchdb
# http://nikosmarkopoulos.com/monitoring-couchdb-with-monit/
################################################################
check process couchdb
with pidfile /var/run/couchdb/couchdb.pid
start program = "/etc/init.d/couchdb start"
stop program = "/etc/init.d/couchdb stop"
if failed host localhost port 5984 proto http then restart
@johnko
johnko / gist:aeedfcbe813c81af0ddf
Created May 30, 2015 20:01
monit couchdb by port
#################################################################
# couchdb
################################################################
#check process couchdb by port number
check host couchdb with address localhost
if failed port 5984 then alert
if failed url https://localhost:5984/ and content == '"couchdb"' then alert
group couchdb
@johnko
johnko / couch-start.sh
Created May 30, 2015 19:57
couch-start.sh
#!/bin/bash
# from https://gist.github.com/cpetersen/581657
NAME=$1
HOME="/root"
PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
/usr/bin/sudo -u root /usr/local/bin/couchdb -b -a /mnt/sde/$NAME/couchdb.ini -p /var/run/couchdb-$NAME.pid -e /var/log/couchdb-$NAME.err -o /var/log/couchdb-$NAME.out
sleep 1
echo '' >> /var/run/couchdb-$NAME.pidroot
We couldn’t find that file to show.
We couldn’t find that file to show.
We couldn’t find that file to show.
# this config needs haproxy-1.1.28 or haproxy-1.2.1
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
#log loghost local0 info
maxconn 4096
#chroot /usr/share/haproxy
user haproxy
group haproxy