-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpopulate.rb
45 lines (39 loc) · 848 Bytes
/
populate.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
require "influxdb"
module InfluxDB
module Playground
class Populator
HOST = "192.168.99.100"
PORT = "8086"
DATABASE = "toptal"
USER = "root"
PASSWORD = "root"
def write_data_points
client.write_points(data_points)
end
private
def client
@client ||= InfluxDB::Client.new(
host: HOST,
port: PORT,
database: DATABASE,
user: USER,
password: PASSWORD
)
end
def data_points
[
{
series: "score",
values: { value: rand(200) }
},
{
series: "searches",
values: { value: rand(200) }
}
]
end
end
end
end
populator = InfluxDB::Playground::Populator.new
populator.write_data_points