lex-influxdb 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.circleci/config.yml +61 -0
- data/.gitignore +11 -0
- data/.idea/lex-influxdb.iml +14 -0
- data/.rspec +3 -0
- data/.rubocop.yml +25 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +19 -0
- data/LICENSE.txt +21 -0
- data/README.md +39 -0
- data/Rakefile +9 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/legion-extensions-influxdb.gemspec +31 -0
- data/lib/legion/extensions/influxdb.rb +11 -0
- data/lib/legion/extensions/influxdb/helpers/client.rb +17 -0
- data/lib/legion/extensions/influxdb/runners/cluster.rb +11 -0
- data/lib/legion/extensions/influxdb/runners/continuous_query.rb +17 -0
- data/lib/legion/extensions/influxdb/runners/database.rb +31 -0
- data/lib/legion/extensions/influxdb/runners/measurement.rb +9 -0
- data/lib/legion/extensions/influxdb/runners/retention_policy.rb +20 -0
- data/lib/legion/extensions/influxdb/runners/series.rb +6 -0
- data/lib/legion/extensions/influxdb/runners/user.rb +17 -0
- data/lib/legion/extensions/influxdb/runners/writer.rb +17 -0
- data/lib/legion/extensions/influxdb/version.rb +7 -0
- metadata +84 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: eb708108c27813912bec30b3b123712f241223c54e99900f0ae8c791684d863c
|
4
|
+
data.tar.gz: 2abf3880ed1c8c7a7a991a2252503b29ce2be314498d6507af91d6cdfe3b9360
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b6d0a953d057a4ee8ebbbabe65e78a7ceb1e14f0b36b4df6d752290f6c975e0755a1672cdeb392a985537343df37be808cf1eaaefbbec48a7e8fc0868e388cb8
|
7
|
+
data.tar.gz: 7265308ed5f1e796b53efeebc7d65a9c08de2ff51e5fe8202eb985722b17134cdb832d6ed3ba074946b72bbf091bc0ac186c52fae8d9ad7781d035ff28c86373
|
@@ -0,0 +1,61 @@
|
|
1
|
+
version: 2.1
|
2
|
+
orbs:
|
3
|
+
ruby: circleci/ruby@0.2.1
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
"rubocop":
|
7
|
+
docker:
|
8
|
+
- image: circleci/ruby:2.5-node
|
9
|
+
steps:
|
10
|
+
- checkout
|
11
|
+
- ruby/load-cache
|
12
|
+
- ruby/install-deps
|
13
|
+
- run:
|
14
|
+
name: Run Rubocop
|
15
|
+
command: bundle exec rubocop
|
16
|
+
- ruby/save-cache
|
17
|
+
"ruby-two-five":
|
18
|
+
docker:
|
19
|
+
- image: circleci/ruby:2.5
|
20
|
+
- image: memcached:1.5-alpine
|
21
|
+
steps:
|
22
|
+
- checkout
|
23
|
+
- ruby/load-cache
|
24
|
+
- ruby/install-deps
|
25
|
+
- ruby/run-tests
|
26
|
+
- ruby/save-cache
|
27
|
+
"ruby-two-six":
|
28
|
+
docker:
|
29
|
+
- image: circleci/ruby:2.6
|
30
|
+
- image: memcached:1.5-alpine
|
31
|
+
steps:
|
32
|
+
- checkout
|
33
|
+
- ruby/load-cache
|
34
|
+
- ruby/install-deps
|
35
|
+
- ruby/run-tests
|
36
|
+
- ruby/save-cache
|
37
|
+
"ruby-two-seven":
|
38
|
+
docker:
|
39
|
+
- image: circleci/ruby:2.7
|
40
|
+
- image: memcached:1.5-alpine
|
41
|
+
steps:
|
42
|
+
- checkout
|
43
|
+
- ruby/load-cache
|
44
|
+
- ruby/install-deps
|
45
|
+
- ruby/run-tests
|
46
|
+
- ruby/save-cache
|
47
|
+
|
48
|
+
workflows:
|
49
|
+
version: 2
|
50
|
+
rubocop-rspec:
|
51
|
+
jobs:
|
52
|
+
- rubocop
|
53
|
+
- ruby-two-five:
|
54
|
+
requires:
|
55
|
+
- rubocop
|
56
|
+
- ruby-two-six:
|
57
|
+
requires:
|
58
|
+
- ruby-two-five
|
59
|
+
- ruby-two-seven:
|
60
|
+
requires:
|
61
|
+
- ruby-two-five
|
data/.gitignore
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
3
|
+
<component name="ModuleRunConfigurationManager">
|
4
|
+
<shared />
|
5
|
+
</component>
|
6
|
+
<component name="NewModuleRootManager">
|
7
|
+
<content url="file://$MODULE_DIR$" />
|
8
|
+
<orderEntry type="inheritedJdk" />
|
9
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
10
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.1.4, RVM: ruby-2.6.3) [gem]" level="application" />
|
11
|
+
<orderEntry type="library" scope="PROVIDED" name="chef (v15.8.23, RVM: ruby-2.6.3) [gem]" level="application" />
|
12
|
+
<orderEntry type="library" scope="PROVIDED" name="influxdb (v0.8.0, RVM: ruby-2.6.3) [gem]" level="application" />
|
13
|
+
</component>
|
14
|
+
</module>
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
Layout/LineLength:
|
2
|
+
Max: 120
|
3
|
+
Metrics/MethodLength:
|
4
|
+
Max: 30
|
5
|
+
Metrics/ClassLength:
|
6
|
+
Max: 1500
|
7
|
+
Metrics/BlockLength:
|
8
|
+
Max: 50
|
9
|
+
Layout/SpaceAroundEqualsInParameterDefault:
|
10
|
+
EnforcedStyle: space
|
11
|
+
Style/SymbolArray:
|
12
|
+
Enabled: true
|
13
|
+
Layout/HashAlignment:
|
14
|
+
EnforcedHashRocketStyle: table
|
15
|
+
EnforcedColonStyle: table
|
16
|
+
Style/Documentation:
|
17
|
+
Enabled: false
|
18
|
+
AllCops:
|
19
|
+
TargetRubyVersion: 2.5
|
20
|
+
Style/FrozenStringLiteralComment:
|
21
|
+
Enabled: false
|
22
|
+
Naming/FileName:
|
23
|
+
Enabled: false
|
24
|
+
Style/ClassAndModuleChildren:
|
25
|
+
Enabled: false
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 Esity
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# Legion::Extensions::Influxdb
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/legion/extensions/influxdb`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'legion-extensions-influxdb'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
$ bundle install
|
17
|
+
|
18
|
+
Or install it yourself as:
|
19
|
+
|
20
|
+
$ gem install legion-extensions-influxdb
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
TODO: Write usage instructions here
|
25
|
+
|
26
|
+
## Development
|
27
|
+
|
28
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
29
|
+
|
30
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
31
|
+
|
32
|
+
## Contributing
|
33
|
+
|
34
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/legion-extensions-influxdb.
|
35
|
+
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'legion/extensions/influxdb'
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require 'irb'
|
15
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'lib/legion/extensions/influxdb/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'lex-influxdb'
|
7
|
+
spec.version = Legion::Extensions::Influxdb::VERSION
|
8
|
+
spec.authors = ['Esity']
|
9
|
+
spec.email = ['matthewdiverson@gmail.com']
|
10
|
+
|
11
|
+
spec.summary = 'LEX::Influxdb'
|
12
|
+
spec.description = 'Used to connect Legion to influxdb'
|
13
|
+
spec.homepage = 'https://bitbucket.org/legion-io/lex-influxdb'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
|
16
|
+
|
17
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
18
|
+
spec.metadata['source_code_uri'] = 'https://bitbucket.org/legion-io/lex-influxdb/src'
|
19
|
+
spec.metadata['changelog_uri'] = 'https://bitbucket.org/legion-io/lex-influxdb/src/master/CHANGELOG.md'
|
20
|
+
|
21
|
+
# Specify which files should be added to the gem when it is released.
|
22
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
23
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
24
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
25
|
+
end
|
26
|
+
spec.bindir = 'exe'
|
27
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
+
spec.require_paths = ['lib']
|
29
|
+
|
30
|
+
spec.add_dependency 'influxdb'
|
31
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Legion::Extensions::Influxdb
|
2
|
+
module Runners
|
3
|
+
module ContinuousQuery
|
4
|
+
def self.list(host: 'localhost', port: 8086, **_payload)
|
5
|
+
client = InfluxDB::Client.new(host: host, port: port)
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.create(name:, host: 'localhost', port: 8086, **_payload)
|
9
|
+
client = InfluxDB::Client.new(host: host, port: port)
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.delete(name:, host: 'localhost', port: 8086, **_payload)
|
13
|
+
client = InfluxDB::Client.new(host: host, port: port)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Legion::Extensions::Influxdb
|
2
|
+
module Runners
|
3
|
+
module Database
|
4
|
+
def self.create(name:, host: 'localhost', port: 8086, **payload)
|
5
|
+
# client = InfluxDB::Client.new(host: host, port: port)
|
6
|
+
require 'influxdb'
|
7
|
+
client = InfluxDB::Client.new
|
8
|
+
Legion::Logging.unknown({ name: name, host: host, port: port, **payload })
|
9
|
+
Legion::Logging.fatal client.create_database(name)
|
10
|
+
{ name: name, host: host, port: port, **payload }
|
11
|
+
rescue StandardError => e
|
12
|
+
Legion::Logging.error e.message
|
13
|
+
Legion::Logging.error e.backtrace
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.delete(name:, host: 'localhost', port: 8086, **payload)
|
17
|
+
client = InfluxDB::Client.new(host: payload[:host])
|
18
|
+
client.delete_database(payload[:name])
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.list(host: 'localhost', port: 8086, **payload)
|
22
|
+
InfluxDB::Client.new(host: payload[:host]).list_databases
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.field_keys(database: 'telegraf', host: 'localhost', port: 8086, **payload)
|
26
|
+
client = InfluxDB::Client.new(host: payload[:host], port: port, database: database)
|
27
|
+
{ results: client.show_field_keys, count: client.show_field_keys.count }
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Legion::Extensions::Influxdb
|
2
|
+
module Runners
|
3
|
+
module RetentionPolicy
|
4
|
+
include Legion::Extensions::Helpers::Lex
|
5
|
+
extend Legion::Extensions::Influxdb::Helpers::Client
|
6
|
+
|
7
|
+
def create(database:, host: 'localhost', port: 8086, **payload)
|
8
|
+
InfluxDB::Client.new(host: payload[:host]).list_retention_policies(database)
|
9
|
+
end
|
10
|
+
|
11
|
+
def list(database:, host: 'localhost', port: 8086, **payload)
|
12
|
+
InfluxDB::Client.new(host: payload[:host]).list_retention_policies(database)
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.delete(payload); end
|
16
|
+
|
17
|
+
def self.alter(payload); end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Legion::Extensions::Influxdb
|
2
|
+
module Runners
|
3
|
+
module User
|
4
|
+
def self.create(payload); end
|
5
|
+
|
6
|
+
def self.update_password(payload); end
|
7
|
+
|
8
|
+
def self.grant_user_admin_privileges(payload); end
|
9
|
+
|
10
|
+
def self.grant_user_privileges(payload); end
|
11
|
+
|
12
|
+
def self.delete(payload); end
|
13
|
+
|
14
|
+
def self.list(payload); end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Legion::Extensions::Influxdb
|
2
|
+
module Runners
|
3
|
+
module Writer
|
4
|
+
def self.write(series:, tags:, values:, host: 'localhost', port: 8086, database:, **_opts)
|
5
|
+
client = InfluxDB::Client.new(database, host: host, port: port)
|
6
|
+
{}
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.write_points(metrics:, host: 'localhost', port: 8086, database: 'telegraf', **_opts)
|
10
|
+
client = InfluxDB::Client.new(database, host: host, port: port)
|
11
|
+
|
12
|
+
client.write_points(metrics)
|
13
|
+
{}
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
metadata
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: lex-influxdb
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Esity
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-03-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: influxdb
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description: Used to connect Legion to influxdb
|
28
|
+
email:
|
29
|
+
- matthewdiverson@gmail.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- ".circleci/config.yml"
|
35
|
+
- ".gitignore"
|
36
|
+
- ".idea/lex-influxdb.iml"
|
37
|
+
- ".rspec"
|
38
|
+
- ".rubocop.yml"
|
39
|
+
- Gemfile
|
40
|
+
- Gemfile.lock
|
41
|
+
- LICENSE.txt
|
42
|
+
- README.md
|
43
|
+
- Rakefile
|
44
|
+
- bin/console
|
45
|
+
- bin/setup
|
46
|
+
- legion-extensions-influxdb.gemspec
|
47
|
+
- lib/legion/extensions/influxdb.rb
|
48
|
+
- lib/legion/extensions/influxdb/helpers/client.rb
|
49
|
+
- lib/legion/extensions/influxdb/runners/cluster.rb
|
50
|
+
- lib/legion/extensions/influxdb/runners/continuous_query.rb
|
51
|
+
- lib/legion/extensions/influxdb/runners/database.rb
|
52
|
+
- lib/legion/extensions/influxdb/runners/measurement.rb
|
53
|
+
- lib/legion/extensions/influxdb/runners/retention_policy.rb
|
54
|
+
- lib/legion/extensions/influxdb/runners/series.rb
|
55
|
+
- lib/legion/extensions/influxdb/runners/user.rb
|
56
|
+
- lib/legion/extensions/influxdb/runners/writer.rb
|
57
|
+
- lib/legion/extensions/influxdb/version.rb
|
58
|
+
homepage: https://bitbucket.org/legion-io/lex-influxdb
|
59
|
+
licenses:
|
60
|
+
- MIT
|
61
|
+
metadata:
|
62
|
+
homepage_uri: https://bitbucket.org/legion-io/lex-influxdb
|
63
|
+
source_code_uri: https://bitbucket.org/legion-io/lex-influxdb/src
|
64
|
+
changelog_uri: https://bitbucket.org/legion-io/lex-influxdb/src/master/CHANGELOG.md
|
65
|
+
post_install_message:
|
66
|
+
rdoc_options: []
|
67
|
+
require_paths:
|
68
|
+
- lib
|
69
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: 2.3.0
|
74
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
requirements: []
|
80
|
+
rubygems_version: 3.0.8
|
81
|
+
signing_key:
|
82
|
+
specification_version: 4
|
83
|
+
summary: LEX::Influxdb
|
84
|
+
test_files: []
|