auxesis-flapjack 0.4.9 → 0.4.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Rakefile CHANGED
@@ -4,6 +4,15 @@ require 'rubygems'
4
4
  require 'fileutils'
5
5
  require 'spec/rake/spectask'
6
6
 
7
+ # integration tests for cli utils
8
+ begin
9
+ require 'cucumber/rake/task'
10
+
11
+ Cucumber::Rake::Task.new do |task|
12
+ task.cucumber_opts = "--require features/"
13
+ end
14
+ rescue LoadError
15
+ end
7
16
 
8
17
  Spec::Rake::SpecTask.new do |t|
9
18
  t.spec_opts = ["--options", "spec/spec.opts"]
data/TODO.md CHANGED
@@ -1,14 +1,10 @@
1
- * daemonise notifier - DONE
2
- * provide config file for notifier
3
- * specify which notifier plugins to load - DONE
4
- * specify configuration for plugins (from address/xmmp login) - DONE
5
- * write init scripts for notifier/worker-manager - DONE
6
1
  * hook notifier into web interface
7
2
  * update status of checks - DONE
8
3
  * relationships + cascading notifications - DONE
9
4
  * simple graphs
10
5
  * event/result history
11
6
  * build option to specify notifier(s) directory
7
+ * trigger populator from web interface
12
8
  * documentation!
13
9
  * user
14
10
  * developer
@@ -17,7 +13,6 @@
17
13
  * integrating with collectd guide
18
14
  * writing custom populators guide
19
15
  * write puppet manifests
20
- * write chef cookbooks
21
16
  * package with pallet
22
17
  * generate .deb/.rpms
23
18
  * build packages for gem dependencies
@@ -27,10 +27,17 @@ unless File.writable?(pid_dir)
27
27
  exit 2
28
28
  end
29
29
 
30
- daemon_args = (args + ['--', '--beanstalk', options.host,
31
- '--port', options.port.to_s,
32
- '--recipients', options.recipients])
30
+ # construct arguments
31
+ daemon_args = args
32
+ if args.first != "stop"
33
+ # if we're not stopping the daemon, pass options to it
34
+ daemon_args += ['--', '--beanstalk', options.host,
35
+ '--port', options.port.to_s,
36
+ '--recipients', options.recipients,
37
+ '--config', File.expand_path(options.config_filename)]
38
+ end
33
39
 
40
+ # boot
34
41
  Daemons.run(worker_path, :ARGV => daemon_args,
35
42
  :multiple => false,
36
43
  :dir_mode => :normal,
@@ -29,5 +29,7 @@ options.workers.times do |n|
29
29
  :dir_mode => :normal,
30
30
  :dir => pid_dir)
31
31
  end
32
+ # so we don't try and stop the daemon multiple times
33
+ break if ARGV[0] == "stop"
32
34
  end
33
35
 
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'flapjack'
3
- s.version = '0.4.9'
4
- s.date = '2009-07-14'
3
+ s.version = '0.4.10'
4
+ s.date = '2009-07-16'
5
5
 
6
6
  s.summary = "a scalable and distributed monitoring system"
7
7
  s.description = "Flapjack is highly scalable and distributed monitoring system. It understands the Nagios plugin format, and can easily be scaled from 1 server to 1000."
@@ -27,6 +27,9 @@ module Flapjack
27
27
  opts.on('-r', '--recipients FILE', 'recipients file') do |recipients|
28
28
  options.recipients = File.expand_path(recipients.to_s)
29
29
  end
30
+ opts.on('-c', '--config FILE', 'config file') do |config|
31
+ options.config_filename = config.to_s
32
+ end
30
33
  end
31
34
 
32
35
  begin
@@ -41,18 +44,35 @@ module Flapjack
41
44
  options.host ||= "localhost"
42
45
  options.port ||= 11300
43
46
 
47
+ @errors = []
48
+
44
49
  unless ARGV[0] == "stop"
45
- unless options.recipients =~ /.+/
46
- puts "You must specify a recipients file!\n\n"
47
- puts opts
48
- exit 2
50
+ if options.recipients
51
+ unless File.exists?(options.recipients)
52
+ @errors << "The specified recipients file doesn't exist!"
53
+ end
54
+ else
55
+ @errors << "You must specify a recipients file!"
49
56
  end
50
-
51
- unless File.exists?(options.recipients)
52
- puts "The specified recipients file doesn't exist!"
53
- exit 2
57
+
58
+ if options.config_filename
59
+ unless File.exists?(options.config_filename)
60
+ @errors << "The specified config file dosen't exist!"
61
+ end
62
+ else
63
+ @errors << "You must specify a config file!"
54
64
  end
55
65
  end
66
+
67
+ if @errors.size > 0
68
+ puts "Errors:"
69
+ @errors.each do |error|
70
+ puts " - #{error}"
71
+ end
72
+ puts
73
+ puts opts
74
+ exit 2
75
+ end
56
76
 
57
77
  unless %w(start stop restart).include?(args[0])
58
78
  puts opts
@@ -20,11 +20,14 @@ class WorkerManagerOptions
20
20
  opts.on('-w', '--workers N', 'number of workers to spin up') do |workers|
21
21
  options.workers = workers.to_i
22
22
  end
23
+ opts.on('-c', '--checks-directory DIR', 'sandboxed check directory') do |dir|
24
+ options.check_directory = dir
25
+ end
23
26
  end
24
27
 
25
28
  begin
26
29
  opts.parse!(args)
27
- rescue
30
+ rescue => e
28
31
  puts e.message.capitalize + "\n\n"
29
32
  puts opts
30
33
  exit 1
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: auxesis-flapjack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.9
4
+ version: 0.4.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lindsay Holmwood
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-07-14 00:00:00 -07:00
12
+ date: 2009-07-16 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency