prometheus_exporter_hcloud_sd 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: db1c1508ac25d805fc4060ca4dd04d7ff563653ee328b8a5f0acde3d632f696d
4
+ data.tar.gz: ebd9865d862798a34f682489b64261fedb495747a6fd8167eea98beb52336a93
5
+ SHA512:
6
+ metadata.gz: 390fd691ed5e720da17e21f22eb74728b38cc126552c93ddf5e6ea3bddef322a60a0c6526b83afd518afc76ed35a7a2e837e11f06a8526a5dbd4671a68bc64cf
7
+ data.tar.gz: 11756361e87211d7aa6c8d19e1138e9fd23c0d056521782fa86824e7e39724f233bf3f5cb678ac3a55bc76cfccbe27ee206466135d514e5d9a794b172222942a
data/.rubocop.yml ADDED
@@ -0,0 +1,44 @@
1
+ require:
2
+ - rubocop-minitest
3
+ - rubocop-rake
4
+
5
+ AllCops:
6
+ NewCops: enable
7
+ TargetRubyVersion: 3.0
8
+
9
+ Gemspec/DevelopmentDependencies:
10
+ EnforcedStyle: gemspec
11
+
12
+ Metrics/MethodLength:
13
+ Exclude:
14
+ - "**/*/test_*.rb"
15
+
16
+ Metrics/AbcSize:
17
+ Exclude:
18
+ - "**/*/test_*.rb"
19
+
20
+ Metrics/BlockLength:
21
+ Exclude:
22
+ - "**/*/test_*.rb"
23
+ - "*.gemspec"
24
+
25
+ Metrics/ClassLength:
26
+ Exclude:
27
+ - "**/*/test_*.rb"
28
+
29
+ Style/Documentation:
30
+ Enabled: false
31
+
32
+ Style/FrozenStringLiteralComment:
33
+ Enabled: false
34
+
35
+ Style/StringLiterals:
36
+ Enabled: true
37
+ EnforcedStyle: double_quotes
38
+
39
+ Style/StringLiteralsInInterpolation:
40
+ Enabled: true
41
+ EnforcedStyle: double_quotes
42
+
43
+ Layout/LineLength:
44
+ Max: 120
data/.rubycritic.yml ADDED
@@ -0,0 +1,3 @@
1
+ no_browser: true
2
+ paths:
3
+ - "lib"
data/CHANGELOG.md ADDED
@@ -0,0 +1,10 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.1.0] - 2023-07-30
9
+
10
+ - Initial release
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at marcessindi@me.com. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in prometheus_exporter_hcloud_sd.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,132 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ prometheus_exporter_hcloud_sd (0.1.0)
5
+ thor (~> 1.2)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ addressable (2.8.4)
11
+ public_suffix (>= 2.0.2, < 6.0)
12
+ ast (2.4.2)
13
+ axiom-types (0.1.1)
14
+ descendants_tracker (~> 0.0.4)
15
+ ice_nine (~> 0.11.0)
16
+ thread_safe (~> 0.3, >= 0.3.1)
17
+ climate_control (1.2.0)
18
+ coercible (1.0.0)
19
+ descendants_tracker (~> 0.0.1)
20
+ crack (0.4.5)
21
+ rexml
22
+ descendants_tracker (0.0.4)
23
+ thread_safe (~> 0.3, >= 0.3.1)
24
+ docile (1.4.0)
25
+ erubi (1.12.0)
26
+ flay (2.13.1)
27
+ erubi (~> 1.10)
28
+ path_expander (~> 1.0)
29
+ ruby_parser (~> 3.0)
30
+ sexp_processor (~> 4.0)
31
+ flog (4.7.0)
32
+ path_expander (~> 1.0)
33
+ ruby_parser (~> 3.1, > 3.1.0)
34
+ sexp_processor (~> 4.8)
35
+ hashdiff (1.0.1)
36
+ ice_nine (0.11.2)
37
+ json (2.6.3)
38
+ kwalify (0.7.2)
39
+ language_server-protocol (3.17.0.3)
40
+ launchy (2.5.2)
41
+ addressable (~> 2.8)
42
+ minitest (5.19.0)
43
+ mocha (2.1.0)
44
+ ruby2_keywords (>= 0.0.5)
45
+ parallel (1.23.0)
46
+ parser (3.2.2.3)
47
+ ast (~> 2.4.1)
48
+ racc
49
+ path_expander (1.1.1)
50
+ public_suffix (5.0.3)
51
+ racc (1.7.1)
52
+ rainbow (3.1.1)
53
+ rake (13.0.6)
54
+ reek (6.1.4)
55
+ kwalify (~> 0.7.0)
56
+ parser (~> 3.2.0)
57
+ rainbow (>= 2.0, < 4.0)
58
+ regexp_parser (2.8.1)
59
+ rexml (3.2.5)
60
+ rubocop (1.54.1)
61
+ json (~> 2.3)
62
+ language_server-protocol (>= 3.17.0)
63
+ parallel (~> 1.10)
64
+ parser (>= 3.2.2.3)
65
+ rainbow (>= 2.2.2, < 4.0)
66
+ regexp_parser (>= 1.8, < 3.0)
67
+ rexml (>= 3.2.5, < 4.0)
68
+ rubocop-ast (>= 1.28.0, < 2.0)
69
+ ruby-progressbar (~> 1.7)
70
+ unicode-display_width (>= 2.4.0, < 3.0)
71
+ rubocop-ast (1.29.0)
72
+ parser (>= 3.2.1.0)
73
+ rubocop-minitest (0.31.0)
74
+ rubocop (>= 1.39, < 2.0)
75
+ rubocop-rake (0.6.0)
76
+ rubocop (~> 1.0)
77
+ ruby-progressbar (1.13.0)
78
+ ruby2_keywords (0.0.5)
79
+ ruby_parser (3.20.3)
80
+ sexp_processor (~> 4.16)
81
+ rubycritic (4.8.1)
82
+ flay (~> 2.13)
83
+ flog (~> 4.6)
84
+ launchy (>= 2.5.2)
85
+ parser (>= 3.2.2.1)
86
+ rainbow (~> 3.1.1)
87
+ reek (~> 6.0, < 7.0)
88
+ ruby_parser (~> 3.20)
89
+ simplecov (>= 0.22.0)
90
+ tty-which (~> 0.5.0)
91
+ virtus (~> 2.0)
92
+ sexp_processor (4.17.0)
93
+ simplecov (0.22.0)
94
+ docile (~> 1.1)
95
+ simplecov-html (~> 0.11)
96
+ simplecov_json_formatter (~> 0.1)
97
+ simplecov-html (0.12.3)
98
+ simplecov_json_formatter (0.1.4)
99
+ thor (1.2.2)
100
+ thread_safe (0.3.6)
101
+ tty-which (0.5.0)
102
+ unicode-display_width (2.4.2)
103
+ vcr (6.2.0)
104
+ virtus (2.0.0)
105
+ axiom-types (~> 0.1)
106
+ coercible (~> 1.0)
107
+ descendants_tracker (~> 0.0, >= 0.0.3)
108
+ webmock (3.18.1)
109
+ addressable (>= 2.8.0)
110
+ crack (>= 0.3.2)
111
+ hashdiff (>= 0.4.0, < 2.0.0)
112
+
113
+ PLATFORMS
114
+ arm64-darwin-22
115
+ x86_64-linux
116
+
117
+ DEPENDENCIES
118
+ climate_control (~> 1.2)
119
+ minitest (~> 5.0)
120
+ mocha (~> 2.1)
121
+ prometheus_exporter_hcloud_sd!
122
+ rake (~> 13.0)
123
+ rubocop (~> 1.21)
124
+ rubocop-minitest (~> 0.31)
125
+ rubocop-rake (~> 0.6)
126
+ rubycritic (~> 4.8)
127
+ simplecov (~> 0.22.0)
128
+ vcr (~> 6.2)
129
+ webmock (~> 3.18)
130
+
131
+ BUNDLED WITH
132
+ 2.4.10
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2023 Marcos Essindi
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,95 @@
1
+ # prometheus_exporter_hcloud_sd
2
+
3
+ prometheus_exporter_hcloud_sd is a CLI tool that discovers Prometheus exporters in your Hetzner Cloud project and generates a Prometeus file-based service discovery YAML configuration for them.
4
+
5
+ ## Description
6
+
7
+ This tool is particularly useful when running multiple Prometheus exporters in a Hetzner Cloud environment and you want to automate the discovery and configuration process.
8
+
9
+ `prometheus_exporter_hcloud_sd` utilizes the Hetzner Cloud API for exporter discovery. Therefore, it should be executed within the same network as the servers (it discovers exporters using the servers' private IP).
10
+
11
+ By default, the tool will discover the following exporters:
12
+
13
+ - MySQL at port 9104
14
+ - Redis at port 9121
15
+ - ElasticSearch at port 9114
16
+ - Postgres at port 9187
17
+ - PgBouncer at port 9127
18
+
19
+ You can specify additional exporters to discover with the `--exporter` flag, followed by the service name and port, formatted as: `<service_name>=<port>`.
20
+
21
+ ## Installation
22
+
23
+ Install the gem with:
24
+
25
+ ```bash
26
+ gem install prometheus_exporter_hcloud_sd
27
+ ```
28
+
29
+ If you use bundler to manage dependencies, install the gem by executing:
30
+
31
+ ```bash
32
+ bundle add prometheus_exporter_hcloud_sd
33
+ ```
34
+
35
+ ## Usage
36
+
37
+ Before using `prometheus_exporter_hcloud_sd`, ensure the `HCLOUD_READ_TOKEN` environment variable is set with a Hetzner Cloud API token that has read permissions.
38
+
39
+ ```bash
40
+ export HCLOUD_READ_TOKEN=your-read-token
41
+ ```
42
+
43
+ Run the following command to discover exporters:
44
+
45
+ ```bash
46
+ prometheus_exporter_hcloud_sd discover
47
+ ```
48
+
49
+ The following is an example of a generated YAML configuration:
50
+
51
+ ```yaml
52
+ - targets: ["10.15.1.1:9104"]
53
+ labels:
54
+ job: "mysql"
55
+
56
+ - targets: ["10.15.1.2:9121","10.15.1.3:9121"]
57
+ labels:
58
+ job: "redis"
59
+ ```
60
+
61
+ This YAML configuration can be used to set up the a file-based service discovery in Prometheus. For example, you can create a file called `hcloud_sd.yml` with the above content and then configure Prometheus to use it:
62
+
63
+ ```yaml
64
+ scrape_configs:
65
+ - job_name: 'node'
66
+ file_sd_configs:
67
+ - files:
68
+ - 'hcloud_sd.yml'
69
+ ```
70
+
71
+ To discover additional exporters, use the --exporter flag (can be used multiple times):
72
+
73
+ ```bash
74
+ prometheus_exporter_hcloud_sd discover --exporter traefik=80
75
+ ```
76
+
77
+ ## Development
78
+
79
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
80
+
81
+ 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 the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
82
+
83
+ ## Contributing
84
+
85
+ Bug reports and pull requests are welcome on GitHub at <https://github.com/dunkelbraun/prometheus_exporter_hcloud_sd>.
86
+
87
+ This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/dunkelbraun/prometheus_exporter_hcloud_sd/blob/main/CODE_OF_CONDUCT.md).
88
+
89
+ ## License
90
+
91
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
92
+
93
+ ## Code of Conduct
94
+
95
+ Everyone interacting in the PrometheusExporterHcloudSd project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/dunkelbraun/prometheus_exporter_hcloud_sd/blob/main/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rake/testtask"
5
+
6
+ Rake::TestTask.new(:test) do |t|
7
+ t.libs << "test"
8
+ t.libs << "lib"
9
+ t.test_files = FileList["test/**/test_*.rb"]
10
+ end
11
+
12
+ require "rubocop/rake_task"
13
+
14
+ RuboCop::RakeTask.new
15
+
16
+ task default: %i[test rubocop]
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "prometheus_exporter_hcloud_sd"
4
+
5
+ PrometheusExporterHcloudSd::CLI.start(ARGV)
@@ -0,0 +1,56 @@
1
+ require "json"
2
+ require "open3"
3
+ require_relative "hetzner_servers"
4
+
5
+ module PrometheusExporterHcloudSd
6
+ class DiscoveryConfig
7
+ PORTS = {
8
+ "9104" => :mysql,
9
+ "9121" => :redis,
10
+ "9114" => :elastic_search,
11
+ "9187" => :postgres,
12
+ "9127" => :pgbouncer
13
+ }.freeze
14
+
15
+ def self.generate(options)
16
+ new(options).generate
17
+ end
18
+
19
+ def initialize(options)
20
+ @additional_ports = options[:exporter].each_with_object({}) do |exporter, acc|
21
+ service, port = exporter.split("=")
22
+ acc[port] = service.to_sym
23
+ end
24
+ end
25
+
26
+ def generate
27
+ server_ips = PrometheusExporterHcloudSd::HetznerServers.private_ips
28
+ output = ""
29
+
30
+ PORTS.merge(@additional_ports).each do |port, service|
31
+ available_servers = discover_exporters(server_ips: server_ips, port: port)
32
+
33
+ next if available_servers.none?
34
+
35
+ output << target_configuration(service: service, available_servers: available_servers)
36
+ end
37
+ output
38
+ end
39
+
40
+ def discover_exporters(server_ips:, port:)
41
+ server_ips.collect do |ip|
42
+ command = "timeout 1 nc -zv #{ip} #{port}"
43
+ _, status = Open3.capture2e(command)
44
+ status.success? ? "#{ip}:#{port}" : nil
45
+ end.compact
46
+ end
47
+
48
+ def target_configuration(service:, available_servers:)
49
+ <<~LINE
50
+ - targets: #{available_servers.to_json}
51
+ labels:
52
+ job: "#{service}"
53
+ LINE
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,21 @@
1
+ require "json"
2
+ require "net/http"
3
+ require "uri"
4
+
5
+ module PrometheusExporterHcloudSd
6
+ module HetznerServers
7
+ SERVERS_URI = URI.parse("https://api.hetzner.cloud/v1/servers").freeze
8
+
9
+ def self.private_ips
10
+ token = ENV.fetch("HCLOUD_READ_TOKEN")
11
+ response = Net::HTTP.get(SERVERS_URI, { Authorization: "Bearer #{token}" })
12
+ json_response = JSON.parse(response, symbolize_names: true)
13
+
14
+ json_response.fetch(:servers, []).map do |server|
15
+ server.fetch(:private_net, [{}]).first.fetch(:ip, nil)
16
+ end.compact
17
+ rescue KeyError
18
+ raise Thor::Error, "Cannot continue.\nPlease set the HCLOUD_READ_TOKEN environment variable."
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PrometheusExporterHcloudSd
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "thor"
4
+ require_relative "prometheus_exporter_hcloud_sd/version"
5
+ require_relative "prometheus_exporter_hcloud_sd/discovery_config"
6
+
7
+ module PrometheusExporterHcloudSd
8
+ class Error < StandardError; end
9
+
10
+ class CLI < Thor
11
+ def self.exit_on_failure?
12
+ true
13
+ end
14
+
15
+ desc "discover", "Discover Prometheus exporters in your Hetzner Cloud project."
16
+ long_desc <<~LONGDESC
17
+ `prometheus_exporter_hcloud_sd discover` will print out a YAML configuration for discovered Prometheus exporters
18
+ in your Hetzner Cloud project using the Hetzner Cloud API.
19
+
20
+ To authenticate with the API, set the `HCLOUD_READ_TOKEN` environment variable with an API token that has read
21
+ permissions.
22
+
23
+ Needs to be run inside the same network as the servers (uses the private IP of the servers).
24
+
25
+ By default it will discover the following exporters
26
+
27
+ - mysql at port 9104
28
+
29
+ - redis at port 9121
30
+
31
+ - elastic_search at port 9114
32
+
33
+ - postgres at port 9187
34
+
35
+ - pgbounce at port 9127
36
+
37
+ Example:
38
+
39
+ > $ HCLOUD_READ_TOKEN=your-read-token prometheus_exporter_hcloud_sd discover
40
+
41
+ - targets: ["10.15.1.1:9104"]
42
+
43
+ labels:
44
+
45
+ job: "mysql"
46
+
47
+ - targets: ["10.15.1.2:9121","10.15.1.3:9121"]
48
+
49
+ labels:
50
+
51
+ job: "redis"
52
+ LONGDESC
53
+ option :exporter, type: :string, repeatable: true, default: [],
54
+ desc: "Additional exporters to discover. Format: <service_name>=<port>"
55
+ def discover
56
+ puts PrometheusExporterHcloudSd::DiscoveryConfig.generate(options)
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,4 @@
1
+ module PrometheusExporterHcloudSd
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,231 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: prometheus_exporter_hcloud_sd
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Marcos Essindi
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2023-07-30 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: climate_control
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.2'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: minitest
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '5.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '5.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: mocha
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.1'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.1'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '13.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '13.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.21'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.21'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop-minitest
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.31'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.31'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop-rake
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '0.6'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '0.6'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubycritic
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '4.8'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '4.8'
125
+ - !ruby/object:Gem::Dependency
126
+ name: simplecov
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: 0.22.0
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: 0.22.0
139
+ - !ruby/object:Gem::Dependency
140
+ name: vcr
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '6.2'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '6.2'
153
+ - !ruby/object:Gem::Dependency
154
+ name: webmock
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: '3.18'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: '3.18'
167
+ - !ruby/object:Gem::Dependency
168
+ name: thor
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: '1.2'
174
+ type: :runtime
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: '1.2'
181
+ description:
182
+ email:
183
+ - marcessindi@me.com
184
+ executables:
185
+ - prometheus_exporter_hcloud_sd
186
+ extensions: []
187
+ extra_rdoc_files: []
188
+ files:
189
+ - ".rubocop.yml"
190
+ - ".rubycritic.yml"
191
+ - CHANGELOG.md
192
+ - CODE_OF_CONDUCT.md
193
+ - Gemfile
194
+ - Gemfile.lock
195
+ - LICENSE.txt
196
+ - README.md
197
+ - Rakefile
198
+ - exe/prometheus_exporter_hcloud_sd
199
+ - lib/prometheus_exporter_hcloud_sd.rb
200
+ - lib/prometheus_exporter_hcloud_sd/discovery_config.rb
201
+ - lib/prometheus_exporter_hcloud_sd/hetzner_servers.rb
202
+ - lib/prometheus_exporter_hcloud_sd/version.rb
203
+ - sig/prometheus_exporter_hcloud_sd.rbs
204
+ homepage: https://github.com/dunkelbraun/prometheus_exporter_hcloud_sd
205
+ licenses:
206
+ - MIT
207
+ metadata:
208
+ rubygems_mfa_required: 'true'
209
+ homepage_uri: https://github.com/dunkelbraun/prometheus_exporter_hcloud_sd
210
+ source_code_uri: https://github.com/dunkelbraun/turbo_test_events/tree/main
211
+ changelog_uri: https://github.com/dunkelbraun/prometheus_exporter_hcloud_sd/blob/main/CHANGELOG.md
212
+ post_install_message:
213
+ rdoc_options: []
214
+ require_paths:
215
+ - lib
216
+ required_ruby_version: !ruby/object:Gem::Requirement
217
+ requirements:
218
+ - - ">="
219
+ - !ruby/object:Gem::Version
220
+ version: '3.0'
221
+ required_rubygems_version: !ruby/object:Gem::Requirement
222
+ requirements:
223
+ - - ">="
224
+ - !ruby/object:Gem::Version
225
+ version: '0'
226
+ requirements: []
227
+ rubygems_version: 3.4.10
228
+ signing_key:
229
+ specification_version: 4
230
+ summary: Discovers exporters running on instances in your Hetzner Cloud project.
231
+ test_files: []