aboutsummaryrefslogtreecommitdiff
path: root/longboat
blob: cca885a91a00e1934d26171768cfce6120f741e7 (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
#!/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 arguments:"
  p ARGV
  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