[fix] clitools redis exporter should work
This commit is contained in:
parent
e3361e9482
commit
95ca0c2ec2
@ -26,7 +26,7 @@ import time
|
|||||||
argsparser = argparse.ArgumentParser(description="Redis exporter LJ")
|
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("-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("-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")
|
argsparser.add_argument("-v","--verbose",action="store_true",help="Verbose")
|
||||||
args = argsparser.parse_args()
|
args = argsparser.parse_args()
|
||||||
|
|
||||||
@ -48,6 +48,10 @@ try:
|
|||||||
if line == "":
|
if line == "":
|
||||||
time.sleep(0.01)
|
time.sleep(0.01)
|
||||||
line = line.rstrip('\n')
|
line = line.rstrip('\n')
|
||||||
|
line=line[1:-1]
|
||||||
|
line = line.replace("[",'(')
|
||||||
|
line = line.replace("]",')')
|
||||||
|
line = "[{}]".format(line)
|
||||||
if r.set(key,line)==True:
|
if r.set(key,line)==True:
|
||||||
debug("exports::redis set("+str(key)+") to "+line)
|
debug("exports::redis set("+str(key)+") to "+line)
|
||||||
except EOFError:
|
except EOFError:
|
||||||
|
Loading…
Reference in New Issue
Block a user