How to Set Up Your On-Call Duty when Your Steem Witness is Missi

  • 时间:2020-09-08 11:19:41
  • 分类:网络文摘
  • 阅读:113 次

What is On-Call? You know many Software Engineers at Big Companies need to do On-Call Duties to fix service related issues when they arise.

Here is a utility to switch your steem witness node in case of missing too many blocks. But wouldn’t it be a lot nicer if we can be notified (be paged) when this happens?

Open Source Utility: https://github.com/DoctorLai/SteemWitnessAutoSwitch

Please be warned that if you like less intrusive notification, you should go for SMS (which should be easy to set up using the method below) or even just email.

If this then that

You may have heard of IFTTT which stands for If This Then That. This is a powerful service that allows you to connect two or more services.

First, you would need to register a IFTTT account, then you would need to connect the “Webhooks” service which allows you to send a message to the hook. Then, the “That” part would be to connect the “Voip Call” part which will call you – alternatively, you could choose other notification methods such as SMS or Emails, or even make a tweet if you like!

This is how the final recipe looks like:

ifttt-webhooks-steem-witness-notification-scaled How to Set Up Your On-Call Duty when Your Steem Witness is Missing a Block? blockchain IFTTT javascript nodejs SteemIt

ifttt-webhooks-steem-witness-notification

Note that we can pass a *value1* parameter to report the current missing blocks.

Here is how you send a notification message to the webhook aka “This”

1
curl -X POST -H "Content-Type: application/json"  -d '{"value1":"123"}'  https://maker.ifttt.com/trigger/{steem-witness}/with/key/YourIFTTTKeyHere
curl -X POST -H "Content-Type: application/json"  -d '{"value1":"123"}'  https://maker.ifttt.com/trigger/{steem-witness}/with/key/YourIFTTTKeyHere

You will see this message on success.

Congratulations! You’ve fired the steem-witness event

Then, on the github code, you can modify a little bit:

1
2
3
4
5
6
7
8
const execSync = require('child_process').execSync;
 
function reportMissing(missed) {
    log("Report missing: " + missed);
    // TODO: You can send a email/SMS here
    execSync('curl -X POST -H "Content-Type: application/json" -d \'{"value1":"' + missed + '"}\' 
       https://maker.ifttt.com/trigger/{steem-witness}/with/key/YourIFTTTKeyHere');
}
const execSync = require('child_process').execSync;

function reportMissing(missed) {
    log("Report missing: " + missed);
    // TODO: You can send a email/SMS here
    execSync('curl -X POST -H "Content-Type: application/json" -d \'{"value1":"' + missed + '"}\' 
       https://maker.ifttt.com/trigger/{steem-witness}/with/key/YourIFTTTKeyHere');
}

That is it, everytime there is a missing block, you will get a call who will tell you total missed blocks aka the parameter *value1*

ifttt-calling How to Set Up Your On-Call Duty when Your Steem Witness is Missing a Block? blockchain IFTTT javascript nodejs SteemIt

ifttt-calling

–EOF (The Ultimate Computing & Technology Blog) —

推荐阅读:
摘桃子的数学题  如图平行四边形ABCD的周长为72厘米  每个人都和其他人握了一次手  客车和货车同时从甲、乙两地的中点反向行驶  数学题:把一个圆锥沿着高切开,得到了个如下图所示的物体  数学题:49个桶,32个扁担,问有几个人挑水,几个人抬水?  学校合唱队有205名学生如果女同学减少25人  两瓶香水甲瓶用去九分之五  把含糖5%和含糖8%的两种糖水混合成含糖6%的糖水  长方形折成梯形求梯形AFDC的面积 
评论列表
添加评论