debug
This commit is contained in:
parent
268afe9fbd
commit
b65606c455
@ -21,6 +21,7 @@ def send_to_graphite(data, host='10.6.0.1', port=2003):
|
|||||||
with socket.create_connection((host, port), timeout=1) as sock:
|
with socket.create_connection((host, port), timeout=1) as sock:
|
||||||
while data:
|
while data:
|
||||||
message = data.popleft()
|
message = data.popleft()
|
||||||
|
print(f"Sending data to Graphite: {message}") # Debug message for sending data
|
||||||
sock.sendall(message.encode('utf-8'))
|
sock.sendall(message.encode('utf-8'))
|
||||||
except (socket.error, socket.timeout) as e:
|
except (socket.error, socket.timeout) as e:
|
||||||
print(f"Failed to send data, will drop if buffer is full. Error: {e}", file=sys.stderr)
|
print(f"Failed to send data, will drop if buffer is full. Error: {e}", file=sys.stderr)
|
||||||
@ -45,9 +46,11 @@ def main():
|
|||||||
for data in graphite_data:
|
for data in graphite_data:
|
||||||
if len(data_buffer) < data_buffer.maxlen:
|
if len(data_buffer) < data_buffer.maxlen:
|
||||||
data_buffer.append(data + '\n')
|
data_buffer.append(data + '\n')
|
||||||
|
print(f"Data queued for Graphite: {data}") # Debug message for queuing data
|
||||||
|
|
||||||
# Try to send data if the buffer is not empty
|
# Try to send data if the buffer is not empty
|
||||||
if data_buffer:
|
if data_buffer:
|
||||||
|
print("Attempting to send data...") # Debug message before sending data
|
||||||
send_to_graphite(data_buffer)
|
send_to_graphite(data_buffer)
|
||||||
|
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
|
Loading…
Reference in New Issue
Block a user