使用 curl/API 查看 Wildfly 中的个人部署状态
View individual deployment status in Wildfly with curl/API
我是 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}'
会 return:
{
"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.
您需要为 address
属性添加一个数组,并在数组中移动 "deployment":"bob"
。
curl --insecure --digest 'https://password@localhost:9993/management' --header "Content-Type: application/json" -d '{"operation":"read-attribute", "address":[{"deployment":"bob"}],"name":"status","json.pretty":1}'
该地址是一个 name/value 对对象,用于您要读取的属性的路径。例如,如果您想查看与根记录器关联的所有处理程序,您可以执行以下命令。
curl --insecure --digest 'https://password@localhost:9993/management' --header "Content-Type: application/json" -d '{"operation":"read-attribute","address":[{"subsystem":"logging"},{"root-logger":"ROOT"}],"name":"handlers","json.pretty":1}
我是 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}'
会 return:
{
"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.
您需要为 address
属性添加一个数组,并在数组中移动 "deployment":"bob"
。
curl --insecure --digest 'https://password@localhost:9993/management' --header "Content-Type: application/json" -d '{"operation":"read-attribute", "address":[{"deployment":"bob"}],"name":"status","json.pretty":1}'
该地址是一个 name/value 对对象,用于您要读取的属性的路径。例如,如果您想查看与根记录器关联的所有处理程序,您可以执行以下命令。
curl --insecure --digest 'https://password@localhost:9993/management' --header "Content-Type: application/json" -d '{"operation":"read-attribute","address":[{"subsystem":"logging"},{"root-logger":"ROOT"}],"name":"handlers","json.pretty":1}