Skip to content

Instantly share code, notes, and snippets.

@matetsu
matetsu / config.ini
Last active December 10, 2015 16:59
Slack -> (API Gateway -> ) Lambda -> SES (Reply Email)
[slack]
hook_url = https://hooks.slack.com/services/xxxxxxxxxx/yyyyyyyyyy/zzzzzzzzzzzzzzzzzzzzzzz
username = alert_bot
channel = #alert
icon_emoji = :guardsman:
token = TOKEN
[s3]
region = ap-northeast-1
bucket_name = BUCKET_NAME
@matetsu
matetsu / config.ini
Created December 10, 2015 14:32
SES -> S3 -> Lambda -> Slack
[slack]
hook_url = https://hooks.slack.com/services/xxxxxxx/yyyyyyyy/zzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
username = alert_bot
channel = #alert
icon_emoji = :guardsman:
@matetsu
matetsu / README
Last active August 29, 2015 14:03
CloudTrail+fluentd+Elasticsearch+Kibanaでdate型がソートされない。
* cloudtrail_template_1.json
dateのformatを YYYY-MM-dd'T'HH:mm:ssZ としたもの。
* cloudtrail_template_2.json
dateのformatを date_time_no_millis としたもの。
* mapping_after_insert.json
cloudtrail_template_1.json でデータ投入後のmapping (dynamic_templateが効いていない?のは要調査)
* data.json
#!/bin/sh
# redis-notify.sh
MAIL_FROM="[email protected]"
MAIL_TO="[email protected]"
if [ "$#" = "2" ]; then
mail_subject="Redis Notification"
mail_body=`cat << EOB
============================================
@matetsu
matetsu / sentinel.conf.template
Created December 28, 2012 04:00
監視設定などを埋め込むためのsentinel設定ファイルテンプレート。
daemonize yes
pidfile /var/run/redis-sentinel.pid
loglevel notice
logfile /var/log/redis-sentinel.log
port 26379
sentinel monitor __MASTER_HOST__-cluster __MASTER_HOST__ 6379 1
sentinel auth-pass __MASTER_HOST__-cluster [masterauth]
sentinel down-after-milliseconds __MASTER_HOST__-cluster 30000
sentinel can-failover __MASTER_HOST__-cluster yes
@matetsu
matetsu / sentinel.conf.init
Created December 28, 2012 03:59
監視設定などを除いたSentinelを起動するためだけの設定。
daemonize yes
pidfile /var/run/redis-sentinel.pid
loglevel notice
logfile /var/log/redis-sentinel.log
port 26379
@matetsu
matetsu / redis.conf
Created December 28, 2012 03:58
redis.conf ほぼデフォルトで、masterauthとrequireauthの両方に同じパスワードを指定しておく必要あり。
daemonize yes
pidfile /var/run/redis.pid
port 6379
timeout 0
loglevel notice
logfile /var/log/redis.log
databases 16
################################ SNAPSHOTTING #################################
save 900 1
@matetsu
matetsu / redis-vpc-route-change.py
Created December 28, 2012 03:56
VPCのroute tableにVIPのルーティング先に自インスタンスIDを指定する。
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import boto.ec2
from boto.ec2.connection import EC2Connection
from boto.vpc import VPCConnection
import logging
LOGFILE="/var/log/redis-ha.log"
# AWS CONFIGURATION
@matetsu
matetsu / redis-to-slave.sh
Created December 28, 2012 03:54
RedisのMasterホストを指定して、Slaveになるためのスクリプト。 要 redis-slaveof.py
#!/bin/sh
# redis-to-slave.sh
PROG_NAME=$0
HOSTNAME=`hostname -s`
REDIS_PORT=6379
logger -t ${PROG_NAME} "Start changing ${HOSTNAME} to redis slave..."
if [ "$#" != "1" ]; then
@matetsu
matetsu / redis-to-master.sh
Created December 28, 2012 03:52
RedisのMasterになるためのスクリプト 要redis-slaveof.py 、 redis-vpc-route-change.py
#!/bin/sh
# redis-to-master.sh
PROG_NAME=$0
HOSTNAME=`hostname -s`
logger -t ${PROG_NAME} "Start changing ${HOSTNAME} to redis master..."
logger -t ${PROG_NAME} "Change this host to master."
# up to master