influxdb-client 1.12.0.pre.1894 → 1.13.0.pre.2006
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -1
- data/README.md +118 -1
- data/influxdb-client.gemspec +5 -3
- data/lib/influxdb2/client/models/delete_predicate_request.rb +51 -24
- data/lib/influxdb2/client/models/dialect.rb +61 -34
- data/lib/influxdb2/client/models/health_check.rb +56 -29
- data/lib/influxdb2/client/models/query.rb +55 -28
- data/lib/influxdb2/client/version.rb +1 -1
- metadata +6 -22
- data/.circleci/config.yml +0 -158
- data/.circleci/setup-rubygems.sh +0 -3
- data/.codecov.yml +0 -3
- data/.github/ISSUE_TEMPLATE/bug_report.md +0 -34
- data/.github/ISSUE_TEMPLATE/feature_request.md +0 -28
- data/.github/PULL_REQUEST_TEMPLATE +0 -16
- data/.github/semantic.yml +0 -3
- data/.gitignore +0 -16
- data/.rubocop.yml +0 -43
- data/Gemfile +0 -24
- data/bin/generate-sources.sh +0 -23
- data/bin/influxdb-onboarding.sh +0 -39
- data/bin/influxdb-restart.sh +0 -61
- data/bin/pom.xml +0 -34
- data/bin/swagger.yml +0 -10057
- data/examples/influxdb_18_example.rb +0 -35
@@ -1,35 +0,0 @@
|
|
1
|
-
$LOAD_PATH.unshift File.expand_path('../lib', __dir__)
|
2
|
-
require 'influxdb-client'
|
3
|
-
|
4
|
-
username = 'username'
|
5
|
-
password = 'password'
|
6
|
-
|
7
|
-
database = 'telegraf'
|
8
|
-
retention_policy = 'autogen'
|
9
|
-
|
10
|
-
bucket = "#{database}/#{retention_policy}"
|
11
|
-
|
12
|
-
client = InfluxDB2::Client.new('http://localhost:8086',
|
13
|
-
"#{username}:#{password}",
|
14
|
-
bucket: bucket,
|
15
|
-
org: '-',
|
16
|
-
use_ssl: false,
|
17
|
-
precision: InfluxDB2::WritePrecision::NANOSECOND)
|
18
|
-
|
19
|
-
puts '*** Write Points ***'
|
20
|
-
|
21
|
-
write_api = client.create_write_api
|
22
|
-
point = InfluxDB2::Point.new(name: 'mem')
|
23
|
-
.add_tag('host', 'host1')
|
24
|
-
.add_field('used_percent', 21.43234543)
|
25
|
-
puts point.to_line_protocol
|
26
|
-
write_api.write(data: point)
|
27
|
-
|
28
|
-
puts '*** Query Points ***'
|
29
|
-
|
30
|
-
query_api = client.create_query_api
|
31
|
-
query = "from(bucket: \"#{bucket}\") |> range(start: -1h)"
|
32
|
-
result = query_api.query(query: query)
|
33
|
-
result[0].records.each { |record| puts "#{record.time} #{record.measurement}: #{record.field} #{record.value}" }
|
34
|
-
|
35
|
-
client.close!
|