我对 Wildfly 很陌生,但我需要通过 API 设置对单个部署状态的自动监控。
就像我可以用 curl 查看服务器状态一样,例如:
curl --insecure --digest 'https://admin:password@localhost:9993/management' --header "Content-Type: application/json" -d '{"operation":"read-attribute","name":"server-state","json.pretty":1}'
将返回:
{
"outcome" => "success",
"result" => "running"
}
以与 jboss-cli 相同的方式,我发出:
:read-attribute(name=server-state)
并得到相同的结果。
因此,如果我从 CLI 发出以下命令来获取特定部署的状态:
/deployment=bob :read-attribute(name=status)
我得到以下结果:
{
"outcome" => "success",
"result" => "OK"
}
但我不知道 curl 命令会给我什么结果。我已经阅读了大量的文档,要么它不存在,要么我找错了地方。我试过了:
curl --insecure --digest 'https://password@localhost:9993/management' --header "Content-Type: application/json" -d '{"deployment":"bob","operation":"read-attribute","name":"status","json.pretty":1}'
但这没有用。有任何想法吗?
谢谢,马克J。