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:
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!
- Adapt the token in samples.yml as specified in slack_it
- build and deploy
./build.sh
./deploy.sh http://jmkhael.io
- Test the individual functions
./test.sh
If everything works fine, you should see something like the below.
{"url":"http://jmkhael.io/","status":"ok","status_code":200}
Initializing Botkit v0.5.6
info: ** No persistent storage method specified! Data may be lost when process shuts down.
info: ** Setting up custom handlers for processing Slack messages
info: ** API CALL: https://slack.com/api/chat.postMessage
{"slackit":"v1","request":{"message":"Anything really"}}
{"DownNotifier":"v1","request":{"url":"http://jmkhael.io"},"response":"all ok - slack not informed"}
- Profit!