Shitty handling of arguments, but needed for initial version of rc-scripts...

This commit is contained in:
2024-05-20 18:50:06 +02:00
parent fd23236d49
commit 5c4389c05e

View File

@ -189,8 +189,6 @@ class UpdateRRD:
logging.error('Not sure what to do here? ' + str(input_dict) + str(self.toupdate))
def main():
rrdfile = 'test.rrd'
rrdupdater = UpdateRRD(rrdfile)
try:
client_host = sys.argv[1]
except IndexError:
@ -199,9 +197,14 @@ def main():
try:
client_port = int(sys.argv[2])
except (ValueError, IndexError):
#We're fine on our own
client_port = 9999
logging.error('Need port as second argument')
sys.exit()
try:
rrdfile = sys.argv[3]
except IndexError:
logging.error('Need rrdfile as third argument')
rrdupdater = UpdateRRD(rrdfile)
client = routerstats_client(client_host, client_port)
while True:
try: