Created
April 19, 2012 21:16
-
-
Save mleinart/2424262 to your computer and use it in GitHub Desktop.
Example test usage of CarbonLinkPool
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
## Initialize a shell from the directory the graphite webapp's manage.py lives in. e.g.: | |
## /opt/graphite/webapp/graphite/ | |
## /usr/lib/python2.6/site-packages/graphite/ | |
## etc | |
# | |
# python manage.py shell | |
from graphite.render.datalib import CarbonLinkPool | |
# Connect to the carbon-cache instance 'a' on localhost: | |
carbon = CarbonLinkPool([ ('localhost', 7002, 'a') ], 1.0) | |
# Return the cached values for this particular metric: | |
pool.query("carbon.agents.graphite-a.avgUpdateTime") | |
# [(1334867644.321877, 912048128)] | |
# Query metadata for the aggregationMethod (only thing available at the moment) | |
pool.get_metadata("carbon.agents.graphite-a.memUsage","aggregationMethod") | |
# 'average' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment