项目作者: jmkhael

项目描述 :
OpenFaaS stack to ping my blog and report back on a slack channel if the ping fails
高级语言: JavaScript
项目地址: git://github.com/jmkhael/blog-pinger.git
创建时间: 2017-07-28T13:44:48Z
项目社区:https://github.com/jmkhael/blog-pinger

开源协议:

下载


blog-pinger

This repository is an OpenFaaS stack I use to ping my blog and report back on a slack channel if the ping fails.

This has an accompanying blog post you can find here: http://jmkhael.io/downnotifier-site-pinger/

This is a high level view of what is in this repository:
Stack Diagram

In the top section you can find logs of an OpenFaaS function, the brain of all this, in the bottom section I invoke this function on an inexistant site, and on the right you can see an incoming message to Slack with the site down information!

Stack Diagram

TLDR;

  1. Adapt the token in samples.yml as specified in slack_it
  2. build and deploy

    1. ./build.sh
    2. ./deploy.sh http://jmkhael.io
  3. Test the individual functions ./test.sh

If everything works fine, you should see something like the below.

  1. {"url":"http://jmkhael.io/","status":"ok","status_code":200}
  2. Initializing Botkit v0.5.6
  3. info: ** No persistent storage method specified! Data may be lost when process shuts down.
  4. info: ** Setting up custom handlers for processing Slack messages
  5. info: ** API CALL: https://slack.com/api/chat.postMessage
  6. {"slackit":"v1","request":{"message":"Anything really"}}
  7. {"DownNotifier":"v1","request":{"url":"http://jmkhael.io"},"response":"all ok - slack not informed"}
  1. Profit!