Last active
December 14, 2015 05:08
-
-
Save jhaubrich/5032764 to your computer and use it in GitHub Desktop.
Example API call for graphite
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
# connecting and writting to round robin database today | |
from socket import socket | |
CARBON_SERVER = 'modok' | |
CARBON_PORT = 2003 | |
sock = socket() | |
try: | |
sock.connect( (CARBON_SERVER,CARBON_PORT) ) | |
except: | |
print "Couldn't connect to %(server)s on port %(port)d, is carbon-agent.py running?" % { 'server':CARBON_SERVER, 'port':CARBON_PORT } | |
sys.exit(1) | |
sock.sendall("chi2.1.148 0.9 1361820900") | |
# =================================================== | |
# waas abstracted api example | |
from waas import rrd | |
with rrd.connect(debug=True) as r: | |
r.write("chi2.1.148 0.9 1361820900") | |
# or # | |
r = rrd.connect(debug=False) | |
r.write("chi2.1.148 0.9 1361820900") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment