Sha256: d0f6a08e8c2c955aa8a13bd0edf34a2a5145b4303b14717b874a00e77382ff78

Contents?: true

Size: 1.09 KB

Versions: 9

Compression:

Stored size: 1.09 KB

Contents

#!/usr/bin/env ruby
require 'rubygems'
require 'optparse'
$LOAD_PATH << "#{File.dirname(__FILE__)}/../lib"
require 'deputy'

options = {}

OptionParser.new do |opts|
  opts.banner = <<BANNER
Report to the sheriff

Usage:
    deputy System.metric value
    deputy [OPTION]

Options:
BANNER

  opts.on("-h", "--help","Show this.") { puts opts; exit }
  opts.on('-v', '--version','Show Version'){ puts Deputy::VERSION; exit}
  opts.on('--install-cron','Install crontask'){ Deputy.install_cron; exit}
  opts.on('--no-wait','Do not wait before executing plugins'){ options[:no_wait] = true }
  opts.on('--run-plugins','Run all plugins for this minute (belongs into crontask)') do
    options[:run_plugins] = true
  end
  opts.on('--host x', 'Use this host, when reporting') do |host|
    options[:host] = host
  end
end.parse!

if options[:run_plugins]
  puts Time.now.strftime("%Y-%m-%d %H:%M:%S")
  Deputy.run_plugins options
else
  metric, value = ARGV[0..1]
  if metric.to_s.empty?
    puts "Usage instructions: deputy --help"
    exit
  end
  Deputy.send_report metric, (value || Deputy::DEFAULT_VALUE), options
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
deputy-0.1.56 bin/deputy
deputy-0.1.55 bin/deputy
deputy-0.1.54 bin/deputy
deputy-0.1.53 bin/deputy
deputy-0.1.52 bin/deputy
deputy-0.1.51 bin/deputy
deputy-0.1.50 bin/deputy
deputy-0.1.49 bin/deputy
deputy-0.1.48 bin/deputy