Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
39 lines (33 sloc) 1011 Bytes
Simple influxdb client code that pushes random values into the DB at 1 minute intervals.
from influxdb import client as influxdb
import time
import random
port = 8086
user = "root"
password = "root"
db_name = "hello_world"
db = influxdb.InfluxDBClient(host, port, user, password, db_name)
while True:
json_body = [
"measurement": "bandwidth",
"tags": {
"host": "localhost",
"object": "services"
"fields": {
"speed_in": random.randrange(10000000,500000000,10000),
"speed_out": random.randrange(10000000,500000000,10000)
series = db.query("show series;")
print "series: {0}".format(series)
# To see pretty things log in to your influxdb UI (probably http://localhost:8083/) and run a query like `select * from foo`
You can’t perform that action at this time.