从命令行访问 Tomcat 状态
Accessing Tomcat Status from the Command-Line
我正在寻找一个简单的 REST API,它将提供部署在 Tomcat 容器中的各种 Web 应用程序的状态。
将您的浏览器指向:
即可轻松获得我要查找的信息
http://localhost:8080/manager/html
这显示加载的网络应用程序,以及每个网络应用程序是 运行 还是已停止。
我想在命令行中使用“curl”访问同样的信息。在 curl 命令行中硬编码 Tomcat username/password 凭据不是问题,因为这是一个安全服务器,没有人拥有活动帐户。有没有 REST API 可以让我轻松地做到这一点?
谢谢。
manager webapp 也有 /text
URL,它有很多选项。例如,应用程序的简单列表:
$ curl -u tomcat:tomcat http://localhost:8080/manager/text/list
OK - Listed applications for virtual host [localhost]
/:running:0:ROOT
/examples:running:0:examples
/host-manager:running:0:host-manager
/servlet_example_war:running:0:servlet_example_war
/manager:running:1:manager
/docs:running:0:docs
请注意,您需要向 Tomcat 添加其他角色(通常在 conf/tomcat-users.xml
中)才能使用“文本”命令。请参阅 Configuring Manager Application Access first for the roles you need to add and then Supported Manager Commands 了解您可以使用管理器网络应用程序的文本部分执行的所有操作。
我正在寻找一个简单的 REST API,它将提供部署在 Tomcat 容器中的各种 Web 应用程序的状态。
将您的浏览器指向:
即可轻松获得我要查找的信息http://localhost:8080/manager/html
这显示加载的网络应用程序,以及每个网络应用程序是 运行 还是已停止。
我想在命令行中使用“curl”访问同样的信息。在 curl 命令行中硬编码 Tomcat username/password 凭据不是问题,因为这是一个安全服务器,没有人拥有活动帐户。有没有 REST API 可以让我轻松地做到这一点?
谢谢。
manager webapp 也有 /text
URL,它有很多选项。例如,应用程序的简单列表:
$ curl -u tomcat:tomcat http://localhost:8080/manager/text/list
OK - Listed applications for virtual host [localhost]
/:running:0:ROOT
/examples:running:0:examples
/host-manager:running:0:host-manager
/servlet_example_war:running:0:servlet_example_war
/manager:running:1:manager
/docs:running:0:docs
请注意,您需要向 Tomcat 添加其他角色(通常在 conf/tomcat-users.xml
中)才能使用“文本”命令。请参阅 Configuring Manager Application Access first for the roles you need to add and then Supported Manager Commands 了解您可以使用管理器网络应用程序的文本部分执行的所有操作。