Class: GitLab::Monitor::CLI::Server
- Inherits:
-
Object
- Object
- GitLab::Monitor::CLI::Server
- Defined in:
- lib/gitlab_monitor/cli.rb
Overview
Run a web server that exposes the metrics specified in a config file
Constant Summary collapse
- COMMAND_NAME =
"web".freeze
Instance Method Summary collapse
- #help ⇒ Object
-
#initialize(args) ⇒ Server
constructor
A new instance of Server.
- #options(args) ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize(args) ⇒ Server
Returns a new instance of Server.
167 168 169 170 |
# File 'lib/gitlab_monitor/cli.rb', line 167 def initialize(args) @options = (args) @options.parse! end |
Instance Method Details
#help ⇒ Object
181 182 183 |
# File 'lib/gitlab_monitor/cli.rb', line 181 def help @options.help end |
#options(args) ⇒ Object
172 173 174 175 176 177 178 179 |
# File 'lib/gitlab_monitor/cli.rb', line 172 def (args) args. do |opts| opts. = "Usage: #{EXECUTABLE_NAME} #{COMMAND_NAME} [options]" opts.on("-c config.yml", "Monitoring config") do |val| @config_file = val end end end |
#run ⇒ Object
185 186 187 188 189 190 191 192 |
# File 'lib/gitlab_monitor/cli.rb', line 185 def run validate! config = Utils.deep_symbolize_hash_keys(YAML.load_file(@config_file)) WebExporter.setup(config) WebExporter.run! end |