aboutsummaryrefslogtreecommitdiff
path: root/longboat
blob: 52754311dbe8554c3f5de6c92bd43e31e2fd9ad5 (plain)
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
#!/usr/bin/env ruby
$LOAD_PATH << './lib'

require 'longboat'

# Handle command line options
config = Longboat::Config.parse!

# Start collection
collector = Longboat::Collector.new(config)
raiders = Longboat::Raiders.new(collector, config)

unless ARGV.empty?
  puts "Extraneous or unrecognised arguments:"
  puts "    " + ARGV.join(" ")
  puts
  puts "Try --help, or refer to raider documentation."
  exit 1
end

if config.test
  # We're in test mode, output metrics to stdout once and quit
  raiders.raid!
  puts collector.prometheus_metrics
else
  # Serve metrics on HTTP forever
  raiders.raid_every
  Longboat::Server.serve!(collector, config)
end