Révision 7063330e
Fix python style issues reported by flake8
Additionally some python2-only "print" statements are now compatible
with python3.
| plugins/lighttpd/lighttpd_ | ||
|---|---|---|
| 53 | 53 |
|
| 54 | 54 |
|
| 55 | 55 |
program = sys.argv[0] |
| 56 |
graph_type = program[program.rfind("_")+1:]
|
|
| 56 |
graph_type = program[program.rfind("_") + 1:]
|
|
| 57 | 57 |
graph_types = {
|
| 58 | 58 |
"accesses": [ |
| 59 | 59 |
{
|
| ... | ... | |
| 91 | 91 |
|
| 92 | 92 |
|
| 93 | 93 |
if len(sys.argv) == 2 and sys.argv[1] == "autoconf": |
| 94 |
print "yes"
|
|
| 94 |
print("yes")
|
|
| 95 | 95 |
elif len(sys.argv) == 2 and sys.argv[1] == "config": |
| 96 | 96 |
if graph_type not in graph_types.keys(): |
| 97 | 97 |
raise Exception("Unknown graph type '%s'" % graph_type)
|
| 98 | 98 |
params = graph_types[graph_type] |
| 99 | 99 |
for item in params: |
| 100 |
print "graph_title %s" % item["title"]
|
|
| 101 |
print "graph_category webserver"
|
|
| 100 |
print("graph_title %s" % item["title"])
|
|
| 101 |
print("graph_category webserver")
|
|
| 102 | 102 |
for field in item["fields"]: |
| 103 |
print "%s.label %s" % (field, field)
|
|
| 104 |
print "%s.type %s" % (field, item["type"])
|
|
| 105 |
print "graph_args %s" % item["args"]
|
|
| 103 |
print("%s.label %s" % (field, field))
|
|
| 104 |
print("%s.type %s" % (field, item["type"]))
|
|
| 105 |
print("graph_args %s" % item["args"])
|
|
| 106 | 106 |
elif len(sys.argv) == 2 and sys.argv[1] == "suggest": |
| 107 | 107 |
for item in graph_types.keys(): |
| 108 |
print item
|
|
| 108 |
print(item)
|
|
| 109 | 109 |
else: |
| 110 | 110 |
status_url = os.environ.get('status_url', 'http://127.0.0.1/server-status')
|
| 111 | 111 |
|
| ... | ... | |
| 129 | 129 |
pass |
| 130 | 130 |
|
| 131 | 131 |
if graph_type == "accesses": |
| 132 |
print "accesses.value %s" % data["Total Accesses"]
|
|
| 132 |
print("accesses.value %s" % data["Total Accesses"])
|
|
| 133 | 133 |
elif graph_type == "kbytes": |
| 134 |
print "kbytes.value %s" % data["Total kBytes"]
|
|
| 134 |
print("kbytes.value %s" % data["Total kBytes"])
|
|
| 135 | 135 |
elif graph_type == "uptime": |
| 136 |
print "uptime.value %s" % str(float(data["Uptime"])/86400)
|
|
| 136 |
print("uptime.value %s" % str(float(data["Uptime"]) / 86400))
|
|
| 137 | 137 |
elif graph_type == "status": |
| 138 |
print "busy.value %s" % data["BusyServers"] |
|
| 139 |
print "idle.value %s" % data["IdleServers"] |
|
| 138 |
print("busy.value %s" % data["BusyServers"])
|
|
| 139 |
print("idle.value %s" % data["IdleServers"])
|
|
Formats disponibles : Unified diff