Sha256: 62d90464db827d50091a1d0a1116defbb9ac94bee660a15d7af98ffe4e9653f5

Contents?: true

Size: 1.5 KB

Versions: 3

Compression:

Stored size: 1.5 KB

Contents

#!/usr/bin/env ruby

require 'choice'
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
require 'nagios-herald'

program_name = File.basename($0)

Choice.options do
  header ""
  header "#{program_name} is used to generate images from given URIs."
  header ""
  header "It takes one or more URIs from which to generate images."
  header "The script outputs the full path for each of the images that have been written."
  header ""

  option :path do
    short "-p"
    long  "--path"
    desc  "An optional path in which to write the image files."
    desc  "DEFAULT: /tmp"
    default "/tmp"
  end

  option :uris, :required => true do
    short "-u"
    long  "--uri *URI"
    desc  "The URI from which to generate an image. Specify multiple URIs with multiple \'-u\' arguments."
  end

  footer ""
  footer "EXAMPLES"
  footer "--------"
  footer "1. Passing a single URI to #{program_name}:"
  footer ""
  footer "#{program_name} -u \"http://graphite.example.com/render/?target=mysql.connections.count\""
  footer ""
  footer "2. Passing multiple URIs to #{program_name}:"
  footer "(line breaks added for clarity)"
  footer ""
  footer "#{program_name} -u \"http://graphite.example.com/render/?target=mysql.connections.count\" \\"
  footer " -u \"http://graphite.example.com/render/?target=apache.requests_per_second\""
  footer ""
end

path = Choice[:path] if Choice[:path]
uris = Choice[:uris] if Choice[:uris]

image_paths = NagiosHerald::Helpers::UrlImage.download_images( uris, path )
puts image_paths.join( ", " )

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nagios-herald-0.0.4 bin/get_graph
nagios-herald-0.0.3 bin/get_graph
nagios-herald-0.0.2 bin/get_graph