Skip to content

Instantly share code, notes, and snippets.

@tailhook
Created February 10, 2016 22:05
Show Gist options
  • Select an option

  • Save tailhook/1741a60471474c56f9ba to your computer and use it in GitHub Desktop.

Select an option

Save tailhook/1741a60471474c56f9ba to your computer and use it in GitHub Desktop.
# This is an pure-python alternative to stator's carbon implementation
import os
import random
from time import sleep, time, clock
from graphiti.client import Client
def main():
carbon = Client(os.environ['CARBON_HOST'])
while True:
v1 = random.randrange(10, 100)
v2 = random.randrange(100, 1000)/10.0
carbon.send("py.graphiti.random.int", v1)
carbon.send("py.graphiti.random.float", v2)
sleep(1)
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment