community.general.nginx_status_info 模块 – 获取 Nginx 状态信息
注意
此模块是 community.general 集合(版本 10.1.0)的一部分。
如果您正在使用 ansible 包,您可能已经安装了这个集合。 它不包含在 ansible-core 中。 要检查是否已安装,请运行 ansible-galaxy collection list。
要安装它,请使用: ansible-galaxy collection install community.general。
要在 playbook 中使用它,请指定: community.general.nginx_status_info。
概要
- 从启用了 - stub_status的 URL 中收集 Nginx 的信息。
参数
| 参数 | 注释 | 
|---|---|
| HTTP 连接超时(以秒为单位)。 默认值:  | |
| Nginx 状态的 URL。 | 
属性
| 属性 | 支持 | 描述 | 
|---|---|---|
| 支持: 完全 此操作不会修改状态。 | 可以在  | |
| 支持: N/A 此操作不会修改状态。 | 当处于 diff 模式时,将返回已更改的内容的详细信息(或可能需要在  | 
备注
示例
# Gather status info from nginx on localhost
- name: Get current http stats
  community.general.nginx_status_info:
    url: https:///nginx_status
  register: result
# Gather status info from nginx on localhost with a custom timeout of 20 seconds
- name: Get current http stats
  community.general.nginx_status_info:
    url: https:///nginx_status
    timeout: 20
  register: result
返回值
常见的返回值已在此处记录,以下是此模块特有的字段
| 键 | 描述 | 
|---|---|
| 接受的客户端连接总数。 返回: 成功 示例:  | |
| 活动连接数。 返回: 成功 示例:  | |
| 按原样返回的 HTTP 响应。 返回: 成功 示例:  | |
| 处理的连接总数。 通常,除非达到某些资源限制,否则此参数的值与 accepts 相同。 返回: 成功 示例:  | |
| Nginx 正在读取请求标头的当前连接数。 返回: 成功 示例:  | |
| 客户端请求总数。 返回: 成功 示例:  | |
| 当前等待请求的空闲客户端连接数。 返回: 成功 示例:  | |
| Nginx 正在将响应写回客户端的当前连接数。 返回: 成功 示例:  | 
