顯示具有 slack 標籤的文章。 顯示所有文章
顯示具有 slack 標籤的文章。 顯示所有文章

2018年3月30日 星期五

[Linux] Linux host 監控發至 Slack Chanel

誠如上一篇文章,當你產出slack key後就可以把key貼在script裡面:如下

這樣就可以發err 訊息至slack chanel,但是如果是內網的話要記得開port出去

或是開proxy


send-slack-err.sh

-------------------------

#!/bin/bash
HOSTSTATE=$1
HOSTADDRESS=$2
HOSTNAME=$3
HOSTOUTPUT=$4

stime=$(date "+%F %H:%M:%S")


msg="CLI-FAN Host: $HOSTSTATE alert for $HOSTNAME [$HOSTOUTPUT]!"

curl --proxy http://x.x.x.x:80 https://slack.com/api/chat.postMessage -X POST -d "channel=alert_chanel" -d "text=$msg" -d "token=xoxp-xxxxxxxxxxxxxxxxxxxxx"

2018年3月27日 星期二

[Slack] Legacy token產生

首先要先註冊一個account,然後進到網頁內去產生Legacy token,之後把token丟入script就可以發監控到slack chanel了,是不是很簡單呢,就是這麼簡單


網址如下:

https://api.slack.com/custom-integrations/legacy-tokens

Legacy token generator

Use this handy tool to quickly generate tokens for testing and development.
Legacy tokens are just for you. Never share legacy tokens with other users or applications. Do not publish Legacy tokens in public code repositories. Review token safety tips.
By creating a test API token, you agree to the Slack API Terms of Service.
WorkspaceUserToken