panteras_api 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a8db33bb5a7340e8fcb86c7dcccfe931b3056f0c
4
- data.tar.gz: 065497857bd5683953b622dadf8058dc12440256
3
+ metadata.gz: 760d66fb4486f6945abc681a3e555fa912708f0e
4
+ data.tar.gz: 93c3800a560e6051ab773cef3d730e83a04bb9a4
5
5
  SHA512:
6
- metadata.gz: 54602e23a73d1badcc724249a01466bc08884e67ffd384305e3550bfd960d92e66ab6d7256791bf442e3525771770ab781a42f1e85bed8dffb52cd026c4f12d5
7
- data.tar.gz: d14d7e8327e2075e933af5880e33065979eb5a91d6ce60b8fa7ac6a5b38477b81f6cf1ca1e78b58a6b63ff3f286ba6b9db40fbf91db5491e64f2487fdc796290
6
+ metadata.gz: 34820fe9e2adb908ab53c4f4dfd041f6452bec397d493d7ca74f5beb09a4f409806e0a0a0b36a47cee13657938a1c00b239ba1587b8c738caca240122260e884
7
+ data.tar.gz: 910a7ae9b5037bca25cccc857731955f8deda0ad3aa27555aba918ea216fb302bedca0273dddb6807e388961745460bf90efe0f9a3788f7c0c1cc5c344f772f7
File without changes
@@ -6,7 +6,7 @@ require 'optparse'
6
6
 
7
7
  $VERSION = '1.0.0'
8
8
  $SEND_NSCA='/usr/sbin/send_nsca'
9
- $SCRIPT='/usr/local/bin/panteras_api'
9
+ $SCRIPT='/usr/local/bin/mesos_consul_consistency_check'
10
10
  my_datacenter=Socket.ip_address_list.find { |ai| ai.ipv4? && !ai.ipv4_loopback? }.ip_address.split('.')[1]
11
11
  $MESOS_MASTER="paasmaster#{my_datacenter.strip}-1.mobile.rz"
12
12
  $NAGIOS_SERVICE='paas_consistency_check'
@@ -14,23 +14,23 @@ $NAGIOS_SERVICE='paas_consistency_check'
14
14
  # default nagios host
15
15
  defaults = { :nsca_host => 'monitor.mobile.rz', :debug => false, :error_code => 1 }
16
16
  options = {}
17
-
17
+
18
18
  OptionParser.new("Options: #{$0} -n NAGIOS_HOST [options]") do |opts|
19
-
19
+
20
20
  opts.release = $VERSION
21
-
21
+
22
22
  opts.on("-n","--nsca-host NAGIOS_HOST","") do |n|
23
23
  options[:nsca_host] = n
24
24
  end
25
-
25
+
26
26
  opts.on("-d","--debug","") do |d|
27
27
  options[:debug] = true
28
28
  end
29
29
 
30
30
  opts.on("-c", "--critical", "Exit with CRITICAL when problems seen. Default is WARNING") do |c|
31
- options[:error_code] = 2
31
+ options[:error_code] = 2
32
32
  end
33
-
33
+
34
34
  end.parse!
35
35
 
36
36
  config = defaults.merge!(options)
@@ -51,36 +51,36 @@ def send_ncsa(nagios_host, host, result, code)
51
51
  command="#{$SEND_NSCA} -c /etc/send_nsca.cfg -H #{nagios_host}"
52
52
  puts "Running command: #{command}" if $DEBUG
53
53
  Open3.popen3(command) do |stdin, stdout, stderr, wait_thr|
54
-
54
+
55
55
  result_line = "#{host}\t#{$NAGIOS_SERVICE}\t#{code}\t#{result}"
56
56
  puts "Sending result to #{nagios_host}: #{result_line}" if $DEBUG
57
57
  stdin.puts result_line
58
58
  stdin.close
59
-
59
+
60
60
  exit_status = wait_thr.value
61
-
61
+
62
62
  unless exit_status.success?
63
63
  $stderr.puts stderr.readlines
64
- raise StandardError, "Command '#{command}' returned status #{exit_status.exitstatus}"
64
+ raise StandardError, "Command '#{command}' returned status #{exit_status.exitstatus}"
65
65
  end
66
-
66
+
67
67
  while line = stderr.gets
68
68
  if line.strip.length > 0
69
69
  puts "Error (send_ncsa): #{line}" if $DEBUG
70
70
  error << line.strip
71
71
  end
72
72
  end
73
-
73
+
74
74
  while line = stdout.gets
75
- if line.strip.length > 0
75
+ if line.strip.length > 0
76
76
  puts "Output (send ncsa): #{line}" if $DEBUG
77
77
  output << line.strip
78
78
  end
79
- end
79
+ end
80
80
 
81
81
  end
82
-
83
- puts output.join if ( ! output.empty? && $DEBUG )
82
+
83
+ puts output.join if ( ! output.empty? && $DEBUG )
84
84
  puts error.join if ( ! error.empty? && $DEBUG )
85
85
 
86
86
  end
@@ -91,33 +91,33 @@ puts "Running command: #{command}" if $DEBUG
91
91
 
92
92
  Open3.popen3(command) do |stdin, stdout, stderr, wait_thr|
93
93
 
94
- exit_status = wait_thr.value
95
- unless exit_status.success?
96
- send_ncsa(nsca_host, my_hostname, stderr.readlines, config[:error_code])
97
- raise StandardError, "Command '#{command}' returned status #{exit_status.exitstatus}"
94
+ exit_status = wait_thr.value
95
+ unless exit_status.success?
96
+ puts "#{command} returned exit code #{exit_status.exitstatus}" if $DEBUG
97
+ send_ncsa(nsca_host, my_hostname, stdout.readlines.join("|"), config[:error_code])
98
+ raise StandardError, "Command '#{command}' returned status #{exit_status.exitstatus}"
98
99
  end
99
-
100
- while line = stderr.gets
100
+
101
+ while line = stderr.gets
101
102
  if line.strip.length > 0
102
103
  puts "Error: #{line}" if $DEBUG
103
104
  error << line.strip
104
105
  end
105
106
  end
106
-
107
+
107
108
  while line = stdout.gets
108
- if line.strip.length > 0
109
- puts "Output: #{line}" if $DEBUG
109
+ if line.strip.length > 0
110
+ puts "Output: #{line}" if $DEBUG
110
111
  output << line.strip
111
112
  end
112
- end
113
-
113
+ end
114
+
114
115
  if ! error.empty?
115
116
  error_msg = error.join
116
- puts "#{my_hostname}: #{error_msg} exit_code #{config[:error_code]}"
117
+ puts "#{my_hostname}: #{error_msg} exit_code #{config[:error_code]}" if $DEBUG
117
118
  send_ncsa(nsca_host, my_hostname, error.join, config[:error_code])
118
119
  else
119
120
  output_msg = output.join
120
- puts "#{my_hostname}: #{output_msg} exit_code #{config[:error_code]}"
121
121
  send_ncsa(nsca_host, my_hostname, output.join, 0)
122
122
  end
123
123
 
@@ -1,3 +1,3 @@
1
1
  module PanterasApi
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
data/panteras_api.gemspec CHANGED
@@ -11,10 +11,10 @@ Gem::Specification.new do |spec|
11
11
 
12
12
  spec.summary = %q{Ruby API library for Panteras PaaS platform.}
13
13
  spec.description = %q{A convenient api for getting information from consul, mesos, marathon, and docker in the Panteras PaaS infrastructure.}
14
- spec.homepage = "https://github.com/joncolby/panteras_api"
14
+ spec.homepage = "https://github.com/eBayClassifiedsGroup/panteras_api"
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
- # spec.bindir = "bin"
17
+ spec.bindir = "extra"
18
18
  # spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
19
  spec.require_paths = ["lib"]
20
20
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: panteras_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Colby
8
8
  autorequire:
9
- bindir: bin
9
+ bindir: extra
10
10
  cert_chain: []
11
- date: 2015-10-29 00:00:00.000000000 Z
11
+ date: 2016-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -78,7 +78,7 @@ files:
78
78
  - lib/panteras_api/utils.rb
79
79
  - lib/panteras_api/version.rb
80
80
  - panteras_api.gemspec
81
- homepage: https://github.com/joncolby/panteras_api
81
+ homepage: https://github.com/eBayClassifiedsGroup/panteras_api
82
82
  licenses: []
83
83
  metadata: {}
84
84
  post_install_message:
@@ -97,9 +97,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
97
97
  version: '0'
98
98
  requirements: []
99
99
  rubyforge_project:
100
- rubygems_version: 2.4.6
100
+ rubygems_version: 2.4.5
101
101
  signing_key:
102
102
  specification_version: 4
103
103
  summary: Ruby API library for Panteras PaaS platform.
104
104
  test_files: []
105
- has_rdoc: