Skip to content

Instantly share code, notes, and snippets.

@MauricioRoman
Created October 24, 2015 12:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MauricioRoman/d4f0ba7d424148246e61 to your computer and use it in GitHub Desktop.
Save MauricioRoman/d4f0ba7d424148246e61 to your computer and use it in GitHub Desktop.
Send Data to Skyline
def send_to_skyline(series, metric_set):
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
# Datapoints are {metric:[ [timestamp,value],[timestamp,value]...]}
for record in series:
metric = "%s.%s" % (metric_set, record['metric'])
datapoint = [record['timestamp'],record['value']]
packet = msgpack.packb((metric, datapoint))
sock.sendto(packet, (socket.gethostname(), SKYLINE_UDP_PORT))
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment