gpt4 book ai didi

docker - 领事观看重要的领事检查

转载 作者:行者123 更新时间:2023-12-02 19:40:20 25 4
gpt4 key购买 nike

所以我有一个 consul check 来监视一个容器,并设计为在容器停止时变得至关重要。我想创建一个领事 watch ,它将在检查变得关键或几个关键响应之后运行脚本(例如,如果我的检查发送 5 个关键响应,我希望它运行脚本)。

这是用于我的工作检查的 json,以及我对我的 watch 可能是什么样子的猜测:

{

// this check works
"checks": [
{
"id": "docker_stuff",
"name": "curl test",
"notes": "curls the docker container",
"script": "/scripts/docker.py",
"interval": "1s"
}
],

//this watch doesn't work
"watches": [
{
"Node": "client2",
"CheckID": "docker-stuff",
"Name": "docker-stuff-watch",
"Status": "critical",
"Status_amt": "5",
"handler": "/scripts/new-docker.sh",
"Output": "container relaunched",
}
]

}

我需要对 watch 进行哪些更改才能使其正常工作?

我是否还需要使用领事事件来监视我的健康检查,然后触发运行我的 /scripts/new-docker.sh 的领事监视(事件类型)?脚本?如果是这样,那么我将如何进行领事事件来监视我的健康检查?例如,如果这是我的领事检查、监视和事件,我需要更改什么才能使其正常工作?
{
"checks": [
{
"id": "docker_stuff",
"name": "curl test",
"notes": "curls the docker container",
"script": "/scripts/docker.py",
"interval": "1s"
}
],
"watches": [
{
"type": "event",
"name": "docker-stuff-watch",
"handler": "/scripts/new-docker.sh"
}
],
"events": [
{
"Node": "client2",
"CheckID": "docker-stuff",
"Name": "docker-stuff-event",
"Status": "critical",
"Status_amt": "5",
"Output": "container relaunched",
}
]
}

最佳答案

What do I need to change in my watch to get it working?



有没有错误?确保您的监视处理程序“/scripts/new-docker.sh”正在使用 Consul 将发送的 STDIN,即使它正在将其丢弃到/dev/null,否则该进程将永远等待它被使用

就像是
while read -r -t 0; do read -r; done

关于docker - 领事观看重要的领事检查,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38054773/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com