Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Change script name for simplify of configuration management orchestration scripts. - Change 172.0.0.1 to localhost for better nginx handling.
- Loading branch information
Showing
2 changed files
with
34 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/env python | ||
import urllib2 | ||
import re | ||
|
||
data = urllib2.urlopen('http://localhost/nginx-status').read() | ||
|
||
params = {} | ||
|
||
for line in data.split("\n"): | ||
smallstat = re.match(r"\s?Reading:\s(.*)\sWriting:\s(.*)\sWaiting:\s(.*)$", line) | ||
req = re.match(r"\s+(\d+)\s+(\d+)\s+(\d+)", line) | ||
if smallstat: | ||
params["Reading"] = smallstat.group(1) | ||
params["Writing"] = smallstat.group(2) | ||
params["Waiting"] = smallstat.group(3) | ||
elif req: | ||
params["Requests"] = req.group(3) | ||
else: | ||
pass | ||
|
||
dataorder = [ | ||
"Active", | ||
"Reading", | ||
"Writing", | ||
"Waiting", | ||
"Requests" | ||
] | ||
|
||
for param in dataorder: | ||
if param == "Active": | ||
Active = int(params["Reading"]) + int(params["Writing"]) + int(params["Waiting"]) | ||
print Active | ||
else: | ||
print params[param] |
This file was deleted.
Oops, something went wrong.