Slack チーム †

https://sekiken.slack.com

参加 †

チャネル †

#general †

なんでも書いてみてー

#alert †

Zabbix からアラートが飛んでくるよー

#maintenance_info †

techsup とかのメンテナンス情報はここに書くよー



周知事項 †

デフォルトの設定で、22:00~8:00まで通知が来ても通知音がならないようになってる。
(Web、Windows クライアント、Android アプリ)

自動的に通知するよ! †

Slack にメールを飛ばす。 †

ライブラリなど追加手順(history 抜粋) †

 825  git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
 826  git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
 827  echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
 828   echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
 829   source ~/.bash_profile
 830  rbenv install --list
 831  rbenv install -v 2.0.0-p648
 832  rbenv global 2.0.0-p648
 833  ruby -v
 834  git clone https://github.com/torut/mail-to-slack.git
 
 846  gem install mail
 847  gem install slack-notifier --no-ri --no-rdoc
 

メール通知スクリプト †

[root@v157-7-130-26 ~]# cat /home/slack/mail-to-slack.rb

#!/root/.rbenv/shims/ruby

WEBHOCKURL = "https://hooks.slack.com/services/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"
CHANNEL = "#general"

require 'mail'
require 'slack-notifier'

mail = Mail.new(STDIN.read)

attachment = {
  color: "#36a64f",
  pretext: mail.subject,
  author_name: "適当なユーザ名",
  text: mail.body.decoded.encode('UTF-8', mail.charset)
}

attachment['color'] = "good" if mail.subject.index('OK') === 0

notifier = Slack::Notifier.new WEBHOCKURL
notifier.channel = CHANNEL
#notifier.username = mail.from.first
notifier.username = "適当なユーザ名"
notifier.ping '', attachments: [ attachment ]

/etc/alias に以下を追加 †

ユーザ slack を追加する。
/etc/alias に以下を追加する。

slack:          "| /home/slack/mail-to-slack.rb"



ログ(無視対応) †

http://aviewer.dip.jp 向けの処理が実行中に発行されるアラート。 †

特に制限なくSQL の処理をしているのでこんなことに・・

PROBLEM
Date / Time
----------------
2016.01.03 / 15:23:59

Status
----------------
PROBLEM

Host
----------------
ubDevsrv

Trigger
----------------
Disk I/O is overloaded on ubDevsrv: 66.7 %

トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS