Accept timestamp within one second.. Probably our fault it's off anyway:)

Actually quit if we don't get the required arguments....
This commit is contained in:
2024-04-16 20:42:32 +02:00
parent ef0205f866
commit 8c78ca7ff7

View File

@ -179,8 +179,12 @@ class UpdateRRD:
self.toupdate['net_dnat'] += input_dict['net_dnat']
self.toupdate['loc-net'] += input_dict['loc-net']
elif input_dict['timestamp'] < self.toupdate['timestamp']:
logging.error('Newly fetched data is older than what we have in the queue already. Passing.')
logging.error('Difference is ' + str(input_dict['timestamp'] - self.toupdate['timestamp']) + ' seconds')
diff = self.toupdate['timestamp'] - input_dict['timestamp']
if diff == 1:
#Might be because something is a bit slow sometimes?
input_dict['timestamp'] = self.toupdate['timestamp']
else:
logging.error('Newly fetched data is older than what we have in the queue already. Passing.')
else:
logging.error('Not sure what to do here? ' + str(input_dict) + str(self.toupdate))
@ -191,6 +195,7 @@ def main():
client_host = sys.argv[1]
except IndexError:
logging.error('Need hostname/ip as first argument')
sys.exit()
try:
client_port = int(sys.argv[2])
except (ValueError, IndexError):