【问题标题】:View individual deployment status in Wildfly with curl/API使用 curl/API 在 Wildfly 中查看单个部署状态
【发布时间】:2016-08-14 05:20:10
【问题描述】:

我是 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。

【问题讨论】:

    标签: jboss wildfly wildfly-10


    【解决方案1】:

    您需要为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}'
    

    地址是您要读取的属性路径的名称/值对对象。例如,如果您想查看与根记录器关联的所有处理程序,您可以执行以下操作。

    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}
    

    【讨论】:

    • 谢谢詹姆斯。这是完美的。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-09-08
    • 2019-03-23
    • 1970-01-01
    • 1970-01-01
    • 2016-03-27
    相关资源
    最近更新 更多