与 CLI 上的 Consul UI 相同的视图:查看来自 Consul 集群的所有失败检查

the same view as Consul UI on CLI: see all failing checks from Consul cluster

我登录到主机并看到该主机检查失败

# curl -s http://localhost:8500/v1/agent/checks | python -m json.tool | grep -B5 critical
        "Node": "hostwrefr5.local",
        "Notes": "Disk usage checking Warning: 5% - Critical: 2%",
        "Output": "DISK CRITICAL - free space: / 3044 MB (67% inode=85%); /dev 910 MB (100% inode=99%); /run 831 MB (90% inode=99%); /sys/fs/cgroup 920 MB (100% inode=99%); /home 451 MB (99% inode=99%); /var/log 0 MB (0% inode=99%); /var/log/audit 426 MB (94% inode=99%); /opt 221 MB (99% inode=99%); /boot 362 MB (71% inode=99%); /tmp 1382 MB (99% inode=99%); /usr/local 221 MB (99% inode=99%); /var/lib/consul 865 MB (95% inode=99%);| /=1482MB;4553;4697;0;4793 /dev=0MB;864;891;0;910 /run=88MB;874;901;0;920 /sys/fs/cgroup=0MB;874;901;0;920 /home=0MB;462;477;0;487 /var/log=712MB;691;713;0;728 /var/log/audit=25MB;462;477;0;487 /opt=2MB;227;234;0;239 /boot=145MB;482;497;0;508 /tmp=4MB;1405;1449;0;1479 /usr/local=2MB;227;234;0;239 /var/lib/consul=43MB;926;955;0;975\n",
        "ServiceID": "rdgd/disk-usage",
        "ServiceName": "rdgd/disk-usage",
        "Status": "critical"

我正在搜索 CLI 命令以查找整个 consul 集群中所有失败的检查。

类似于您在 Consul 上看到的东西 UI(所有节点失败或所有服务失败)

我们的 Consul UI 受 HTTP Auth

保护

有一个检查可以在数据中心列出 services by status

/v1/health/state/<state>

This endpoint is hit with a GET and returns the checks in the state provided on the path.

您需要为您感兴趣的每个州和每个数据中心查询一次。