Skip to content

Instantly share code, notes, and snippets.

@szaydel
Forked from codification/graphite-client.py
Created July 6, 2012 06:10
Show Gist options
  • Save szaydel/3058354 to your computer and use it in GitHub Desktop.
Save szaydel/3058354 to your computer and use it in GitHub Desktop.
Graphite client in python
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():
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