如何通过CLI获取Wildfly服务器状态?

时间:2018-01-16 05:09:28

标签: java wildfly wildfly-10 jboss-cli

我一直试图使用jboss-cli.bat验证我们的服务器是否已在Wildfly中启动

这是我使用的命令:

/host=slave-1/server-config=REST-server-one:read-resource(include-runtime=true)

这就是我从命令

获得的
{
    "outcome" => "success",
    "result" => {
        "auto-start" => true,
        "cpu-affinity" => undefined,
        "group" => "wildfly-server-group",
        "name" => "wildfly-server",
        "priority" => undefined,
        "socket-binding-default-interface" => undefined,
        "socket-binding-group" => undefined,
        "socket-binding-port-offset" => 0,
        "status" => "STARTED",
        "update-auto-start-with-server-status" => false,
        "interface" => undefined,
        "jvm" => undefined,
        "path" => undefined,
        "ssl" => undefined,
        "system-property" => undefined
}

是否有一个命令会返回该响应中的状态值?

2 个答案:

答案 0 :(得分:1)

您应该可以使用var product = { "presentation": 3, "imgmax": "http://test.com/img.jpg", "puissance": 5, "efficacite": 4, "description": "This product is awesome but i need to combine JSON results" } var array = [ { "caracname": "presentation", "name": "Présentation" }, { "caracname": "efficacite", "name": "Efficacité" }, { "caracname": "puissance", "name": "Puissance" } ] array.forEach(function(item) { if (product[item.caracname]) { item.score = product[item.caracname]; } }); console.log(array);操作。

read-attribute

答案 1 :(得分:0)

我最终使用了这个

BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));

            String line = reader.readLine();
            while (line != null) {
                String[] value  = line.split("=>");
                if(value.length > 1){
                    if(value[0].contains("\"status\"")){
                        System.out.println(value[1]);
                    }
                }
                line = reader.readLine();
            }

如果有人能提出更好的方法,我们将不胜感激。