pyserverstatus - Interface to Apache’s mod_status

pyserverstatus - An interface to remote Apache mod_status data.

pyserverstatus.server_status(url)

Fetch the mod_status output from url and parse it into something beautiful (or at least useful.) The server status URL should be using the auto option.

>>> status = server_status('http://server.tld/server-status?auto')
>>> print status
{'idle_cleanup_of_worker': 0, 'uptime': 234140, 'logging': 0, 'total_accesses': 34326, 'open_slots': 247, 'idle_workers': 8, 'reading_request': 0, 'requests_per_second': 0.14660500000000001, 'starting_up': 0, 'bytes_per_second': 425.03800000000001, 'cpuload': 0.11558, 'closing_connection': 0, 'waiting_for_connection': 8, 'sending_reply': 1, 'dns_lookup': 0, 'total_kbytes': 97186, 'gracefully_finishing': 0, 'keepalive': 0, 'bytes_per_request': 2899.2199999999998, 'busy_workers': 1}
Parameters:url (string) – URL to fetch from.
Returns:Dictionary containing parsed data.
Return type:dict
Raises ValueError:
 If unable to fetch any data.
pyserverstatus.recreate(parsed)

Recreate the statistics portion of the mod_status output.

>>> status = server_status('http://server.tld/server-status?auto')
>>> print recreate(status)
Total Accesses: 34326
Total kBytes: 97186
CPULoad: 0.11558
Uptime: 234140
ReqPerSec: 0.146605
BytesPerSec: 425.038
BytesPerReq: 2899.22
BusyWorkers: 1
IdleWorkers: 8
Scoreboard: ________W.......................................................................................................................................................................................................................................................
Parameters:parsed (dict) – Parsed mod_status data.
Returns:A string formatted the same as generated by /server-status?auto.
Return type:string

Installation

sudo easy_install pyserverstatus

or

pip install pyserverstatus

Information

Author:Mark Caudill
Version:0.1
License:General Public License v3
Source:http://github.com/markcaudill/pyserverstatus
Python Versions:
 2.6+

Table Of Contents

This Page