puppetdashboardmonitor 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/puppetdashboardmonitor +31 -5
- metadata +1 -1
data/bin/puppetdashboardmonitor
CHANGED
@@ -1,10 +1,36 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
2
|
|
3
|
-
|
4
|
-
require '
|
5
|
-
require '
|
3
|
+
begin
|
4
|
+
require 'json'
|
5
|
+
require 'yaml'
|
6
|
+
require 'optparse'
|
7
|
+
require 'puppetdashboardmonitoring'
|
8
|
+
rescue LoadError
|
9
|
+
puts 'A required gem was not found'
|
10
|
+
exit
|
11
|
+
end
|
12
|
+
|
13
|
+
options = {}
|
14
|
+
OptionParser.new do |opts|
|
15
|
+
opts.banner = "Usage: puppetdashboardmonitor [options]"
|
16
|
+
|
17
|
+
opts.on("-v", "--verbose", "Be less quiet") do |v|
|
18
|
+
options[:verbose] = v
|
19
|
+
end
|
20
|
+
|
21
|
+
opts.on("-c", "--config FILE", "Specify the configuration file") do |conf|
|
22
|
+
options[:configfile] = conf
|
23
|
+
end
|
24
|
+
|
25
|
+
end.parse!
|
26
|
+
|
27
|
+
def run (options)
|
6
28
|
|
7
|
-
|
29
|
+
if options[:configfile].nil?
|
30
|
+
configfile = 'etc/dashboard.yaml'
|
31
|
+
else
|
32
|
+
configfile = options[:configfile]
|
33
|
+
end
|
8
34
|
|
9
35
|
config = YAML::load(File.read('etc/dashboard.yaml'))
|
10
36
|
|
@@ -14,6 +40,6 @@ def run
|
|
14
40
|
|
15
41
|
end
|
16
42
|
|
17
|
-
output = run()
|
43
|
+
output = run(options)
|
18
44
|
puts output.to_json
|
19
45
|
|