[fix] clitools redis exporter should work

This commit is contained in:
alban 2020-09-27 18:50:50 +02:00
parent e3361e9482
commit 95ca0c2ec2

View File

@ -26,7 +26,7 @@ import time
argsparser = argparse.ArgumentParser(description="Redis exporter LJ")
argsparser.add_argument("-i","--ip",help="IP address of the Redis server ",default="127.0.0.1",type=str)
argsparser.add_argument("-p","--port",help="Port of the Redis server ",default="6379",type=str)
argsparser.add_argument("-k","--key",help="Redis key to update",default="0",type=int)
argsparser.add_argument("-k","--key",help="Redis key to update",default="0",type=str)
argsparser.add_argument("-v","--verbose",action="store_true",help="Verbose")
args = argsparser.parse_args()
@ -48,6 +48,10 @@ try:
if line == "":
time.sleep(0.01)
line = line.rstrip('\n')
line=line[1:-1]
line = line.replace("[",'(')
line = line.replace("]",')')
line = "[{}]".format(line)
if r.set(key,line)==True:
debug("exports::redis set("+str(key)+") to "+line)
except EOFError: