简体   繁体   English

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

[英]How to get Wildfly server status via CLI?

I've been trying to validate if our server has started in Wildfly using the jboss-cli.bat 我一直在尝试使用jboss-cli.bat验证我们的服务器是否已在Wildfly中启动

This is the command i'm using: 这是我正在使用的命令:

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

and this is what i'm getting from the command 这就是我从命令中得到的

{
    "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
}

Is there a command that will return the value of the status in that response? 是否有命令将返回该响应中的状态值?

您应该能够使用read-attribute操作。

/host=slave-1/server-config=REST-server-one:read-attribute(name=status)

I end up using this 我最终用这个

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();
            }

If anyone can suggest a better method would be greatly appreciated. 如果有人可以提出更好的方法,将不胜感激。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 Java 代码通过 jboss-cli 命令将 EAR 文件部署到 wildfly-17.0.1 服务器 - How to deploy an EAR file to wildfly-17.0.1 server with jboss-cli command using Java code 如何使用 CLI 向 Wildfly 添加模块 - How to add module to Wildfly using CLI 如何使用CLI在Wildfly中设置MariaDB数据源 - How to setup MariaDB datasource in Wildfly with CLI 如何在Wildfly服务器上运行的测试中获得声纳语言代码覆盖率 - How to get sonarqube code coverage on tests running on wildfly server Wildfly 数据源通过 VPN 到 MS SQL 服务器 - Wildfly Datasource via VPN to MS SQL Server 如何等待 WildFly 服务器重新加载? - How to wait for the WildFly server to reload? 网站关闭(超时)时如何获取服务器状态? - How to get the Status of a Server if the Website is Down (Timeout)? 如何通过wildfly-maven-plugin使用WildFly服务器运行服务? - how to run service with WildFly server by wildfly-maven-plugin? 如何在没有 openshift CLI 的情况下为 WildFly 可引导 JAR 定义数据源属性? - How to define datasource properties for WildFly bootable JAR without openshift CLI? 如何获取在CentOS Wildfly服务器上运行的Spring应用程序的完整基本路径? - How to get full base path of spring application running on CentOS Wildfly server?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM