上QQ阅读APP看书,第一时间看更新
3.7.2 安装Docker镜像
Docker Hub[1](这是Docker官方提供的存放所有Docker镜像软件的地方,类似Maven的中央仓库)中的镜像如图3-33所示。
图3-33 在DockerHub中查找prometheus-webhook-dingtalk
在这里会看到一系列插件,我们在Mac的Console中执行docker search XXX镜像。
~ docker search prometheus-webhook-dingtalk NAME DESCRIPTION STARS OFFICIAL AUTOMATED timonwong/prometheus-webhook-dingtalk 4 rainbond/prometheus-webhook-dingtalk 0 slpcat/prometheus-webhook-dingtalk 0 zhaojiedi1992/prometheus-webhook-dingtalk 0 marvinpan/prometheus-webhook-dingtalk 0 sanger/prometheus-webhook-dingtalk 0 tuananhpham/prometheus-webhook-dingtalk 0 xpmotors/prometheus-webhook-dingtalk 0 baixiaochao/prometheus-webhook-dingtalk Prometheus钉钉告警组件 0 doublemine/prometheus-webhook-dingtalk 0 xuejipeng/prometheus-webhook-dingtalk 0 myftcode/prometheus-webhook-dingtalk 0 antonyxin/prometheus-webhook-dingtalk 0
选择第一个插件,执行docker pull命令即可。
docker pull timonwong/prometheus-webhook-dingtalk Using default tag: latest latest: Pulling from timonwong/prometheus-webhook-dingtalk [DEPRECATION NOTICE] registry v2 schema1 support will be removed in an upcoming release. Please contact admins of the docker.io registry NOW to avoid future disruption. aab39f0bc16d: Pull complete a3ed95caeb02: Pull complete 2cd9e239cea6: Pull complete 2e9091ef5cc7: Pull complete 7e999a8b25ab: Pull complete Digest: sha256:705b8a2764b33540774d1f08111597d49680bf15152f5e0101011d29d2c262d2 Status: Downloaded newer image for timonwong/prometheus-webhook-dingtalk: latest
使用docker images命令即可列出已下载的镜像。
~ docker images REPOSITORY TAG IMAGE ID CREATED SIZE timonwong/prometheus-webhook-dingtalk latest 5e05f165bf60 21 months ago 10MB
通过如下命令启动钉钉镜像。
docker run -d --restart always -p 8060:8060 timonwong/prometheus-webhook-dingtalk: v0.3.0 --ding.profile="webhook1=https:// oapi.dingtalk.com/robot/send?access_ token=XXX"
在上述access_token中填写你的钉钉机器人的hook。
注意
使用docker rmi命令可删除指定镜像,如:
docker rmi d23bdf5b1b1b
钉钉的Webhook设置方式就是在钉钉群点击群机器人,然后依次点击“机器人管理”→“自定义(通过Webhook接入自定义服务)”→“添加”→“复制Webhook”命令,如图3-34所示。
图3-34 钉钉群群机器人
点击“自定义”按钮,通过Webhook接入自定义服务,然后按照流程走下去,记录下最后获得的https://oapi.dingtalk.com/robot/send?access_token=XXX的地址即可。
[1] https://hub.docker.com/。