$ git clone https://github.com/rancher/os-vagrant.git
$ cd os-vagrant
// Vagrantfile 編集
$ vi Vagrantfile
$ vagrant up
- Vagrantfile
#!/bin/bash | |
# | |
# Action | |
# checks AWS events and show lists of events. | |
# | |
# Precondition | |
# - Install aws cli | |
# - aws configured and create .aws/config. | |
# - Install jq | |
# |
#!/bin/sh | |
#FOREVER=/usr/bin/forever | |
HUBOT_HOME=/home/hu/mybot | |
FOREVER=$HUBOT_HOME/node_modules/forever/bin/forever | |
who=$(whoami) | |
if [ "${who}" != "root" ]; then | |
echo "Usage: sudo bin/hubot (start|stop|restart|status). 'sudo' is requied ! Please again.\n" | |
exit 1; |
# Description: | |
# Example scripts for you to examine and try out. | |
# | |
# Notes: | |
# They are commented out by default, because most of them are pretty silly and | |
# wouldn't be useful and amusing enough for day to day huboting. | |
# Uncomment the ones you want to try and experiment with. | |
# | |
# These are from the scripting documentation: https://github.com/github/hubot/blob/master/docs/scripting.md |
$ git clone https://github.com/rancher/os-vagrant.git
$ cd os-vagrant
// Vagrantfile 編集
$ vi Vagrantfile
$ vagrant up
#!/bin/bash | |
set -eu | |
readonly HTTPD_PROM="/usr/local/node_exporter/text_collector/httpd.prom" | |
function get_httpd_count() { | |
local _cnt=$(/sbin/pidof httpd | wc -w) | |
echo "node_httpd_count ${_cnt}" >> ${HTTPD_PROM}.$$ | |
} |
#!/bin/bash | |
# /etc/init.d/node_exporter | |
# config: /etc/prometheus/node_exporter.conf | |
# pidfile: /var/run/prometheus/node_exporter.pid | |
# | |
# preparation: | |
# - mkdir -p /var/run/prometheus | |
# - mkdir -p /var/log/prometheus | |
# - git clone git clone http://github.com/bmc/daemonize.git | |
# |
ALERT instance_down | |
IF up == 0 | |
FOR 5m | |
LABELS { severity = "critical" } | |
ANNOTATIONS { | |
summary = "Instance {{ $labels.instance }} down", | |
description = "{{ $labels.instance }} of job {{ $labels.job }} has been down for more than 5 minutes.", | |
} | |
ALERT cpu_threshold_exceeded |
#!/bin/sh | |
find . -type f -name '*.mp3.mp3' | \ | |
while read f; do | |
mv "$f" "$(echo $f | sed 's/\.[^\.]*$//')" | |
done |
global: | |
# The smarthost and SMTP sender used for mail notifications. | |
# smtp_smarthost: 'localhost:25' | |
# smtp_from: 'Alertmanager <[email protected]>' | |
route: | |
# デフォルト通知先 | |
receiver: "teamX" | |
# 同一アラート、クラスター、サービス(group_by)のアラートが |
#!/bin/sh | |
# Slack Channel & Webhook URL | |
CHANNEL="#xxxxx" | |
WEBHOOKURL="https://hooks.slack.com/services/XXXXXX/XXXXXXXX/XXXXXXXXXXXXXXXXXX" | |
#Slackに通知 | |
function slack () { | |
MESSAGE="$1" | |
BOTNAME="KS STG Server" |