Skip to content

Instantly share code, notes, and snippets.

@zembutsu
zembutsu / munin_quickguide_centos.md
Last active December 21, 2015 12:29
Munin2 の CentOS 向けチュートリアル

Munin2 QuickTutorial

CentOS6 で、とにかく Munin を使い始めるための方法をまとめました。http://<ホスト名>/munin/ で対象サーバの上方を閲覧できるようにします。

事前準備

Munin を EPEL リポジトリで配付されているパッケージを用いてセットアップします。そのために、まずは EPEL リポジトリを有効化します。

# rpm -ivh http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/6/i386/epel-release-6-8.noarch.rpm
@zembutsu
zembutsu / raspi-notice.sh
Last active December 28, 2015 00:29
serf event handler
#!/bin/sh
while read line
do
echo ${line}
HOSTNAME=`echo ${line} | cut -d ' ' -f 1`
ADDRESS=`echo ${line} | cut -d ' ' -f 2`
case ${SERF_EVENT} in
"member-join")
@zembutsu
zembutsu / serf
Created November 25, 2013 11:43
Serf SysV Init script usage: # /sbin/chkconfig --add serf # /sbin/chkconfig serf on # /sbin/service serf start
#!/bin/sh
#
# chkconfig: - 89 11
# description: serf daemon
# processname: serf
# config: /etc/serf.conf
# Default-Start:
# Default-Stop: 0 1 2 3 4 5 6
# Description: serf agent daemon
@zembutsu
zembutsu / serf-sample.json
Created March 29, 2014 08:58
Serf sample configuration file.
{
"node_name": "miku3",
"rpc_addr": "192.168.39.11:7373",
"tags": {
"role": "develop",
"network": "local"
},
"interface": "eth1",
"discover": "mikusan",
@zembutsu
zembutsu / changetag.pl
Created March 29, 2014 09:01
To change serf agent's tag that not using serf RPC ( by perl script).
#!/usr/bin/perl
print "\n### DEBUG:: changetag";
my $payload = <STDIN>;
print "DEBUG: payload: $payload\n";
my ($target, $method, $key, $value) = split(/::/, $payload);
@zembutsu
zembutsu / serf-setup.sh
Last active August 29, 2015 13:59
setup script for SoftLayer's provisioning script
#!/bin/sh
cp -p /etc/sysconfig/clock /etc/sysconfig/clock.orig
cat <<EOF > /etc/sysconfig/clock
ZONE="Asia/Tokyo"
UTC=false
ARC=false
EOF
mv /etc/localtime /etc/localtime.orig
ln -s /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
@zembutsu
zembutsu / serf2excel.pl
Created April 18, 2014 05:08
serf2excel makes a list of hosts file of the Excel format from 'serf members'.
#!/usr/bin/perl
use Encode;
use Spreadsheet::WriteExcel;
$serf = '/usr/bin/serf';
my ($sec, $min, $hour, $day, $month, $year, $wday) = localtime;
$year += 1900;
@zembutsu
zembutsu / serf-etcdconf.pl
Created May 1, 2014 04:47
It is generated JSON file of serf dynamically by etcd. I made it experimentally, but do not maintain it recently.
#!/usr/bin/perl
# Serf configuration generator with Etcd
#
# MIT License
# 2014 Masahito Zembutsu
use JSON::XS;
use Net::HTTP;
use Data::Dumper;
@zembutsu
zembutsu / Makefile.config
Created June 7, 2014 08:39
Makefile.config for Munin 2.1.x; This is similer to setup like package's directory hierarcy.
# -*- makefile -*-
#
# This is the Makefile.config file to use for a "clean" distribution.
#
# This file specifies where Munin will look for things after you've
# run 'make' in the source directory. Modify it to suit your needs.
# DESTDIR is meant only for use when making Munin packages. Unless
# you're doing packaging do NOT set it.
# DESTDIR is empty during building, and optionally set to point to
@zembutsu
zembutsu / init_munin2
Created June 9, 2014 06:49
An init script for Munin 2.1.x that is installed to /opt/munin.
#! /bin/sh
#
# munin-node Control the Munin Node Server (formerly Linpro RRD client)
#
# chkconfig: 2345 90 10
# description: munin node agents
# processname: munin-node
# config: /etc/opt/munin/munin-node.conf
# pidfile: /var/run/munin/munin-node.pid