Skip to content

Instantly share code, notes, and snippets.

@kazu634
kazu634 / delete_graphs.rb
Last active August 29, 2015 14:15
`Serf`で管理していないノードのグラフを削除する
#!/opt/sensu/embedded/bin/ruby
require 'growthforecast'
# Create `Growthforecast` instance:
gf = GrowthForecast.new('localhost', 5125)
glist = gf.graphs()
glist.each do |graph|
@kazu634
kazu634 / serf_agent.json
Created January 18, 2015 05:30
Serf Configuration File
{
"retry_join": [ "sensu.kazu634.lan" ],
"retry_interval": "30s",
"retry_max_attempts": 10,
"snapshot_path": "/home/kazu634/src/serf_snapshot.dat",
"rejoin_after_leave": true,
"leave_on_terminate": true,
"skip_leave_on_interrupt": true,
@kazu634
kazu634 / delete_graph.rb
Created January 15, 2015 14:19
Growthforecastで引数で与えた文字列と合致するservice_nameのグラフを一括削除するスクリプト
#!/opt/sensu/embedded/bin/ruby
require 'growthforecast'
# abort unless one argument is given:
abort unless ARGV.length == 1
str = ARGV[0]
# Create `Growthforecast` instance:
@kazu634
kazu634 / gist:4616791afa459768ac1f
Created December 20, 2014 13:09
`peco` + `git ls-files`
# check whether `peco` exists
if which peco > /dev/null; then
function gim () {
# check whether the current directory is under `git` repository.
if git rev-parse 2> /dev/null; then
local selected_file=$(git ls-files . | peco)
if [ -n "${selected_file}" ]; then
vi ${selected_file}
fi
@kazu634
kazu634 / growthforecast-handler.rb
Last active August 29, 2015 14:11
sensu scripts
#!/opt/sensu/embedded/bin/ruby
require 'rubygems'
require 'json'
require 'growthforecast'
# constants
COLORS = {
"cpu" => {
"user" => "#FFBB7F",
@kazu634
kazu634 / dstat.conf
Created May 31, 2014 04:08
Fluentd x Growthforecast
<source>
type dstat
tag dstat
option -cmln
delay 3
</source>
# GrowthForecast用にメッセージを加工する
<match dstat>
type copy
@kazu634
kazu634 / gist:11399514
Created April 29, 2014 12:56
fluentd configuration file for LTSV format log file
####
## Output descriptions:
##
# Treasure Data (http://www.treasure-data.com/) provides cloud based data
# analytics platform, which easily stores and processes data from td-agent.
# FREE plan is also provided.
# @see http://docs.fluentd.org/articles/http-to-td
#
# This section matches events whose tag is td.DATABASE.TABLE
@kazu634
kazu634 / pre-push
Created January 5, 2014 11:48
Gitのpre-push hook用スクリプト。git-nowコマンドと一緒に使うことを想定しています。
#!/bin/sh
z40=0000000000000000000000000000000000000000
IFS=' '
while read local_ref local_sha remote_ref remote_sha
do
if [ "$local_sha" = $z40 ]
then
# Handle delete
# SERVERSPEC - Resource Types | http://serverspec.org/resource_types.html
#=============================
# command
#=============================
snippet desco
alias descom
abbr describe command('whoami') do ~ end
prev_word '^'
describe command('${1:whoami}') do
${0}
site :opscode
cookbook 'apt'
cookbook 'build-essential'
cookbook 'iptables'
cookbook 'motd-tail'
cookbook 'openvpn'
cookbook 'chef-solo-search', git:"[email protected]:edelight/chef-solo-search.git"