-
-
Save mgara/cb4c30ca658be833b28651ba1e50d5ac to your computer and use it in GitHub Desktop.
Graphite client in python
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
import time | |
import socket | |
def collect_metric(name, value, timestamp): | |
sock = socket.socket() | |
sock.connect( ("localhost", 2003) ) | |
sock.send("%s %f %f\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