Apache "mod_status":
We know, by using "mod_status", we can check Apache's current status. It returns a lot of information, something like in this sample page (provided by Apache):
What i need to do:
I need to parse and then process this results, especially the detailed connections section given by ExtendedStatus
flag (inside httpd.conf). The section looks something like:
Srv PID Acc M CPU SS Req Conn Child Slot Client VHost Request
0-24 23433 0/94/338163 _ 208.04 2 0 0.0 1.85 22068.75 221.254.46.37
0-24 23433 0/99/337929 _ 208.93 1 1141 0.0 2.23 19373.00 197.89.161.5
0-24 23433 0/94/337834 _ 206.04 4 0 0.0 3.46 22065.36 114.31.251.82
0-24 23433 0/95/338139 _ 198.94 2 7 0.0 2.74 21101.66 122.252.253.242
0-24 23433 0/111/338215 _ 206.21 3 0 0.0 3.89 19496.71 186.5.109.211
My Question:
Is it possible to get this page (information) via a structured data format, like JSON? (Because i need to parse them via PHP. And then do some further stuffs later.)
I cannot just use some easy ways, like Javascript DOM Parsers (like: jQuery). Because i need the script to be running in the Server's Linux Commandline (locally) itself. Not via any fancy client Browsers from outside.
So, parsing this via Javascript (JQuery, etc) is almost not a choice. I better receive a structured data. So i can parse from PHP way easily. Trigger the PHP Script via Terminal, like:
# php /www/docroots/parse-server-status.php
Or, at least:
# curl -I http://localhost/parse-server-status.php
Question:
- Any idea how to get the JSON or XML out of Apache's Server Status (mod_status), please?
Thanks all.
?auto
URL arg returns a plaintext summary that is fairly easy to parse. Try it:curl localhost:80/server-status?auto
– MarkHu