Skip to content

Instantly share code, notes, and snippets.

@mendhak
Forked from codification/graphite-client.py
Created November 5, 2013 16:38
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 mendhak/7321881 to your computer and use it in GitHub Desktop.
Save mendhak/7321881 to your computer and use it in GitHub Desktop.
import time
import socket
def collect_metric(name, value, timestamp):
sock = socket.socket()
sock.connect( ("localhost", 2003) )
sock.send("%s %d %d\n" % (name, value, timestamp))
sock.close()
def now():
return int(time.time())
collect_metric("metric.name", 42, now())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment