Created
October 9, 2015 14:33
-
-
Save eloraburns/5c9c9b3a24ee97840f68 to your computer and use it in GitHub Desktop.
Statsd listener for debugging stats locally
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# From https://wiki.python.org/moin/UdpCommunication modified for Statsd + debugging usage | |
import datetime | |
import socket | |
UDP_IP = "127.0.0.1" | |
UDP_PORT = 8125 | |
sock = socket.socket( | |
socket.AF_INET, # Internet | |
socket.SOCK_DGRAM) # UDP | |
sock.bind((UDP_IP, UDP_PORT)) | |
while True: | |
data, addr = sock.recvfrom(1024) # buffer size is 1024 bytes | |
print datetime.datetime.now(), data |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
👍 👍