Skip to content

Instantly share code, notes, and snippets.

@blt blt/
Created Aug 18, 2017

What would you like to do?
#!/usr/bin/env python2.7
import time
import socket
import sys
def graphite_metric(sock, name, value):
timestamp = int(time.time())
sock.send("%s %f %d\n" % (name, value, timestamp))
def main():
graphite_srv = ('localhost', 2004)
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
while True:
graphite_metric(sock, "emit_packet", 1.0)
if __name__ == '__main__':
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.