新写的一个脚本,换了个思路来检测见证人节点存活。之前的检测方法,都是检测区块链上的丢块数据,我的这个脚本则是通过检测见证人程序的输出来判断节点是否存活。
目前脚本还在测试中!!
#!/bin/bash
if [ -z $CONTAINER_NAME ];
then
containerName="seed"
else
containerName=$CONTAINER_NAME
fi
if [ -z $NOTIFY_URL ];
then
notifyURL=""
else
notifyURL=$NOTIFY_URL
fi
logs=`docker logs --tail=1 $containerName`
regx='[ [:alnum:] ]+ms.+th_a.+application.cpp:514.+handle_block.+].+Got [ [:digit:] ]+ transactions on block [ [:digit:] ]+ by [ [:alnum:] ]+ -- latency: [ [:digit:] ]+ms'
if [[ $logs =~ $regx ]];
then
echo 'ok'
# curl -d "content=[ok]:smiley: $logs" "$notifyURL"
else
curl -d "content=[err]:skull: $logs" "$notifyURL"
fi
https://github.com/ety001/coin-tools/blob/master/detect-steem-witness/run.sh
使用时,替换 containerName
为你的见证人节点的 docker 容器名,替换 notifyURL
为你的 discord 频道的 webhook 地址。把这个脚本加入到 crontab 下即可,目前我是配置的每分钟执行。
结果拭目以待。
欢迎使用 SteemMention 获取最新的 Steem 回复提醒。
欢迎使用 SteemEditor 来编写文章,最好用的 Steem 编辑器,没有之一!!!
感谢你的阅读,我是中文区见证人之一,欢迎通过 SteemConnect 来给我投票,或者打开 https://steemit.com/~witnesses/ 页面,输入 ety001 进行投票。
中文区的见证人目前有:
支持一下他们(按字母顺序),一人可以有30票:
Thank you for reading. I'm a witness. I would really appreciate your witness vote! You can vote by SteemConnect. Or open https://steemit.com/~witnesses page, input ety001 to vote.