Created
October 24, 2015 12:47
-
-
Save MauricioRoman/d4f0ba7d424148246e61 to your computer and use it in GitHub Desktop.
Send Data to Skyline
This file contains hidden or 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
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