�
�Udac @` s� d d l m Z m Z m Z e Z i d d 6d g d 6d d 6Z d Z d Z d
Z d d l
Z
d d l m Z d d
l
m Z d d l m Z d e f d � � YZ d � Z e d k r� e � n d S( i ( t absolute_importt divisiont print_functions 1.1t metadata_versiont previewt statust communityt supported_bys,
---
module: nginx_status_info
short_description: Retrieve information on nginx status.
description:
- Gathers information from nginx from an URL having C(stub_status) enabled.
version_added: "2.9"
author: "René Moser (@resmo)"
options:
url:
type: str
description:
- URL of the nginx status.
required: true
timeout:
type: int
description:
- HTTP connection timeout in seconds.
required: false
default: 10
notes:
- See U(http://nginx.org/en/docs/http/ngx_http_stub_status_module.html) for more information.
sl
# Gather status info from nginx on localhost
- name: get current http stats
nginx_status_info:
url: http://localhost/nginx_status
register: result
# Gather status info from nginx on localhost with a custom timeout of 20 seconds
- name: get current http stats
nginx_status_info:
url: http://localhost/nginx_status
timeout: 20
register: result
s�
---
active_connections:
description: Active connections.
returned: success
type: int
sample: 2340
accepts:
description: The total number of accepted client connections.
returned: success
type: int
sample: 81769947
handled:
description: The total number of handled connections. Generally, the parameter value is the same as accepts unless some resource limits have been reached.
returned: success
type: int
sample: 81769947
requests:
description: The total number of client requests.
returned: success
type: int
sample: 144332345
reading:
description: The current number of connections where nginx is reading the request header.
returned: success
type: int
sample: 0
writing:
description: The current number of connections where nginx is writing the response back to the client.
returned: success
type: int
sample: 241
waiting:
description: The current number of idle client connections waiting for a request.
returned: success
type: int
sample: 2092
data:
description: HTTP response as is.
returned: success
type: str
sample: "Active connections: 2340 \nserver accepts handled requests\n 81769947 81769947 144332345 \nReading: 0 Writing: 241 Waiting: 2092 \n"
N( t
AnsibleModule( t fetch_url( t to_textt NginxStatusInfoc B` s e Z d � Z d � Z RS( c C` s. t j j d � | _ t j j d � | _ d S( Nt urlt timeout( t modulet paramst getR R
( t self( ( sX /usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/nginx_status_info.pyt __init__l s c C` s� i d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6} t d t d
| j d t d | j � \ } } | s� t j d
d | j | j f � n t | j � d d �} | s� | S| | d <d } t j
| | t j � } | r�t | j
d � � | d <t | j
d � � | d <t | j
d � � | d <t | j
d � � | d <t | j
d � � | d <t | j
d � � | d <t | j
d � � | d <n | S( Nt active_connectionst acceptst handledt requestst readingt writingt waitingt dataR R t forceR
t msgs? No valid or no response from url %s within %s seconds (timeout)t errorst surrogate_or_stricts� Active connections: ([0-9]+) \nserver accepts handled requests\n ([0-9]+) ([0-9]+) ([0-9]+) \nReading: ([0-9]+) Writing: ([0-9]+) Waiting: ([0-9]+)i i i i i i i ( t NoneR R R t TrueR
t fail_jsonR
t readt ret matcht St intt group( R t resultt responset infoR t exprR$ ( ( sX /usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/nginx_status_info.pyt runp s6
-#
( t __name__t
__module__R R, ( ( ( sX /usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/nginx_status_info.pyR j s c C` sh t d t d t d d d t � d t d d d d � � d
t � a t � j � } t j d t | � d S( Nt
argument_specR t typet strt requiredR
R&