Skip to content

Commit

Permalink
actually using utf-8 makes rrd not accept the values, everything else…
Browse files Browse the repository at this point in the history
… works. Should probably solve this elsewhere.
  • Loading branch information
hfox committed Jan 3, 2018
1 parent 640a8ef commit e52d8f0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions icecast2_all
Expand Up @@ -48,6 +48,9 @@ from xml.dom import minidom
host = "http://" + host + "/admin/stats"


def munin_print(u):
sys.stdout.buffer.write((u+"\n").encode('ascii','replace'))

def ic2xml():
# Get the XML with all the stats,
req = requests.get(host, auth=(username, password))
Expand Down Expand Up @@ -81,7 +84,7 @@ def ic2xml():
sourcesort.sort()
for source in sourcesort:
listeners, name = sourcelist[source]
sys.stdout.buffer.write((source + ".value " + listeners + "\n").encode('utf-8'))
munin_print((source + ".value " + listeners))
elif sys.argv[1] == "config":
print ("graph_title Total number of listeners on " + host_desc)
print ("graph_vlabel listeners")
Expand All @@ -92,7 +95,7 @@ def ic2xml():
sourcesort.sort()
for source in sourcesort:
listeners, name = sourcelist[source]
sys.stdout.buffer.write((source + ".label " + source + "\n").encode('utf-8'))
munin_print((source + ".label " + source))
else:
print((sys.argv[1]))
else:
Expand All @@ -102,7 +105,7 @@ def ic2xml():
sourcesort.sort()
for source in sourcesort:
listeners, name = sourcelist[source]
sys.stdout.buffer.write((source + ".value " + listeners + "\n").encode('utf-8'))
munin_print((source + ".value " + listeners))

if __name__ == "__main__":
ic2xml()

0 comments on commit e52d8f0

Please sign in to comment.