1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-21 18:41:03 +00:00

Fix python style issues reported by flake8

Additionally some python2-only "print" statements are now compatible
with python3.
This commit is contained in:
Lars Kruse 2019-12-18 00:25:39 +01:00
parent 73f885e382
commit 7063330e03
17 changed files with 102 additions and 103 deletions

View file

@ -53,7 +53,7 @@ import urllib2
program = sys.argv[0]
graph_type = program[program.rfind("_")+1:]
graph_type = program[program.rfind("_") + 1:]
graph_types = {
"accesses": [
{
@ -91,21 +91,21 @@ graph_types = {
if len(sys.argv) == 2 and sys.argv[1] == "autoconf":
print "yes"
print("yes")
elif len(sys.argv) == 2 and sys.argv[1] == "config":
if graph_type not in graph_types.keys():
raise Exception("Unknown graph type '%s'" % graph_type)
params = graph_types[graph_type]
for item in params:
print "graph_title %s" % item["title"]
print "graph_category webserver"
print("graph_title %s" % item["title"])
print("graph_category webserver")
for field in item["fields"]:
print "%s.label %s" % (field, field)
print "%s.type %s" % (field, item["type"])
print "graph_args %s" % item["args"]
print("%s.label %s" % (field, field))
print("%s.type %s" % (field, item["type"]))
print("graph_args %s" % item["args"])
elif len(sys.argv) == 2 and sys.argv[1] == "suggest":
for item in graph_types.keys():
print item
print(item)
else:
status_url = os.environ.get('status_url', 'http://127.0.0.1/server-status')
@ -129,11 +129,11 @@ else:
pass
if graph_type == "accesses":
print "accesses.value %s" % data["Total Accesses"]
print("accesses.value %s" % data["Total Accesses"])
elif graph_type == "kbytes":
print "kbytes.value %s" % data["Total kBytes"]
print("kbytes.value %s" % data["Total kBytes"])
elif graph_type == "uptime":
print "uptime.value %s" % str(float(data["Uptime"])/86400)
print("uptime.value %s" % str(float(data["Uptime"]) / 86400))
elif graph_type == "status":
print "busy.value %s" % data["BusyServers"]
print "idle.value %s" % data["IdleServers"]
print("busy.value %s" % data["BusyServers"])
print("idle.value %s" % data["IdleServers"])