cloudstack-nagios 0.4.2 → 0.5.1

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.
Files changed (36) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +0 -1
  3. data/Gemfile +1 -1
  4. data/Gemfile.lock +4 -2
  5. data/bin/cs-nagios +1 -2
  6. data/cloudstack-nagios.gemspec +2 -1
  7. data/lib/cloudstack-nagios/base.rb +1 -0
  8. data/lib/cloudstack-nagios/version.rb +1 -1
  9. data/lib/cloudstack_nagios.rb +2 -1
  10. metadata +23 -49
  11. data/lib/cloudstack-client/client.rb +0 -136
  12. data/lib/cloudstack-client/commands/account.rb +0 -22
  13. data/lib/cloudstack-client/commands/capacity.rb +0 -19
  14. data/lib/cloudstack-client/commands/cluster.rb +0 -19
  15. data/lib/cloudstack-client/commands/disk_offering.rb +0 -49
  16. data/lib/cloudstack-client/commands/domain.rb +0 -22
  17. data/lib/cloudstack-client/commands/host.rb +0 -28
  18. data/lib/cloudstack-client/commands/ip_address.rb +0 -82
  19. data/lib/cloudstack-client/commands/iso.rb +0 -64
  20. data/lib/cloudstack-client/commands/job.rb +0 -29
  21. data/lib/cloudstack-client/commands/load_balancer_rule.rb +0 -61
  22. data/lib/cloudstack-client/commands/network.rb +0 -128
  23. data/lib/cloudstack-client/commands/pod.rb +0 -19
  24. data/lib/cloudstack-client/commands/port_forwarding_rule.rb +0 -49
  25. data/lib/cloudstack-client/commands/project.rb +0 -32
  26. data/lib/cloudstack-client/commands/router.rb +0 -89
  27. data/lib/cloudstack-client/commands/server.rb +0 -311
  28. data/lib/cloudstack-client/commands/service_offering.rb +0 -98
  29. data/lib/cloudstack-client/commands/snapshot.rb +0 -40
  30. data/lib/cloudstack-client/commands/ssh_key_pair.rb +0 -106
  31. data/lib/cloudstack-client/commands/template.rb +0 -60
  32. data/lib/cloudstack-client/commands/user.rb +0 -32
  33. data/lib/cloudstack-client/commands/volume.rb +0 -20
  34. data/lib/cloudstack-client/commands/zone.rb +0 -57
  35. data/lib/cloudstack-client/version.rb +0 -3
  36. data/lib/cloudstack_client.rb +0 -2
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4462047d3995a0bc4a2e347fd3638fff6bf43340
4
+ data.tar.gz: 6c6b7a70f376373605b2e981e178dc09ee1e9efd
5
+ SHA512:
6
+ metadata.gz: 7429635d543cdc83cf13eedda9ccf2e95ef0f3d1419e5e4594d293ac5ef109f249078f846d97fc90e611ca8e6d4cd0a42c36db7b3613933ac6209eb81c2ff0e6
7
+ data.tar.gz: 9847ab9a65ab09a93225a06c9b41a14cf27f49a2c14b5c6cfde69f1c77e22f56b6ccfca7e1ffce97fa781ff5cdc7f48b3c73a95afd4dc39096e583a7186de064
data/.gitignore CHANGED
@@ -1,6 +1,5 @@
1
1
  .DS_Store
2
2
  results.html
3
- config/cloudstack.yml
4
3
  pkg
5
4
  html
6
5
  *.gem
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in cloudstack-nagios.gemspec
4
- gemspec
4
+ gemspec
@@ -1,7 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cloudstack-nagios (0.4.1)
4
+ cloudstack-nagios (0.5.0)
5
+ cloudstack_client (~> 0.2.10)
5
6
  erubis (~> 2.7.0)
6
7
  highline (~> 1.6.20)
7
8
  sshkit (~> 1.1.0)
@@ -10,6 +11,7 @@ PATH
10
11
  GEM
11
12
  remote: https://rubygems.org/
12
13
  specs:
14
+ cloudstack_client (0.2.10)
13
15
  erubis (2.7.0)
14
16
  highline (1.6.20)
15
17
  json (1.8.1)
@@ -26,7 +28,7 @@ GEM
26
28
  term-ansicolor (1.2.2)
27
29
  tins (~> 0.8)
28
30
  thor (0.18.1)
29
- tins (0.12.0)
31
+ tins (0.13.0)
30
32
 
31
33
  PLATFORMS
32
34
  ruby
@@ -1,6 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'cloudstack_client'
4
3
  require 'cloudstack_nagios'
5
4
 
6
- CloudstackNagios::Cli.start(ARGV)
5
+ CloudstackNagios::Cli.start(ARGV)
@@ -8,7 +8,7 @@ Gem::Specification.new do |gem|
8
8
  gem.version = CloudstackNagios::VERSION
9
9
  gem.authors = ["Nik Wolfgramm"]
10
10
  gem.email = ["nik.wolfgramm@gmail.com"]
11
- gem.description = %q{cloudstack-nagios generates nagios configuration and checks for monitoring cloudstack with nagios.}
11
+ gem.description = %q{cloudstack-nagios generates nagios configuration and checks for monitoring CloudStack with nagios.}
12
12
  gem.summary = %q{cloudstack-nagios CloudStack monitoring tools for nagios}
13
13
  gem.homepage = "https://bitbucket.org/swisstxt/cloudstack-nagios"
14
14
  gem.license = 'MIT'
@@ -23,6 +23,7 @@ Gem::Specification.new do |gem|
23
23
  gem.add_development_dependency('rdoc')
24
24
  gem.add_development_dependency('rake', '~> 10.0.4')
25
25
 
26
+ gem.add_dependency('cloudstack_client', '~> 0.2.10')
26
27
  gem.add_dependency('thor', '~> 0.18.1')
27
28
  gem.add_dependency('erubis', '~> 2.7.0')
28
29
  gem.add_dependency('sshkit', '~> 1.1.0')
@@ -1,5 +1,6 @@
1
1
  require "thor"
2
2
  require "yaml"
3
+ require 'cloudstack_client'
3
4
 
4
5
  module CloudstackNagios
5
6
  class Base < Thor
@@ -1,3 +1,3 @@
1
1
  module CloudstackNagios
2
- VERSION = "0.4.2"
2
+ VERSION = "0.5.1"
3
3
  end
@@ -1,4 +1,5 @@
1
+
1
2
  require "cloudstack-nagios/version"
2
3
  require "cloudstack-nagios/helper"
3
4
  require "cloudstack-nagios/base"
4
- require "cloudstack-nagios/cli"
5
+ require "cloudstack-nagios/cli"
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudstack-nagios
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
5
- prerelease:
4
+ version: 0.5.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Nik Wolfgramm
@@ -14,23 +13,20 @@ dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rdoc
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rake
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ~>
36
32
  - !ruby/object:Gem::Version
@@ -38,15 +34,27 @@ dependencies:
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ~>
44
39
  - !ruby/object:Gem::Version
45
40
  version: 10.0.4
41
+ - !ruby/object:Gem::Dependency
42
+ name: cloudstack_client
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: 0.2.10
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 0.2.10
46
55
  - !ruby/object:Gem::Dependency
47
56
  name: thor
48
57
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
58
  requirements:
51
59
  - - ~>
52
60
  - !ruby/object:Gem::Version
@@ -54,7 +62,6 @@ dependencies:
54
62
  type: :runtime
55
63
  prerelease: false
56
64
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
65
  requirements:
59
66
  - - ~>
60
67
  - !ruby/object:Gem::Version
@@ -62,7 +69,6 @@ dependencies:
62
69
  - !ruby/object:Gem::Dependency
63
70
  name: erubis
64
71
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
72
  requirements:
67
73
  - - ~>
68
74
  - !ruby/object:Gem::Version
@@ -70,7 +76,6 @@ dependencies:
70
76
  type: :runtime
71
77
  prerelease: false
72
78
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
79
  requirements:
75
80
  - - ~>
76
81
  - !ruby/object:Gem::Version
@@ -78,7 +83,6 @@ dependencies:
78
83
  - !ruby/object:Gem::Dependency
79
84
  name: sshkit
80
85
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
86
  requirements:
83
87
  - - ~>
84
88
  - !ruby/object:Gem::Version
@@ -86,7 +90,6 @@ dependencies:
86
90
  type: :runtime
87
91
  prerelease: false
88
92
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
93
  requirements:
91
94
  - - ~>
92
95
  - !ruby/object:Gem::Version
@@ -94,7 +97,6 @@ dependencies:
94
97
  - !ruby/object:Gem::Dependency
95
98
  name: highline
96
99
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
100
  requirements:
99
101
  - - ~>
100
102
  - !ruby/object:Gem::Version
@@ -102,13 +104,12 @@ dependencies:
102
104
  type: :runtime
103
105
  prerelease: false
104
106
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
107
  requirements:
107
108
  - - ~>
108
109
  - !ruby/object:Gem::Version
109
110
  version: 1.6.20
110
111
  description: cloudstack-nagios generates nagios configuration and checks for monitoring
111
- cloudstack with nagios.
112
+ CloudStack with nagios.
112
113
  email:
113
114
  - nik.wolfgramm@gmail.com
114
115
  executables:
@@ -123,31 +124,6 @@ files:
123
124
  - README.md
124
125
  - bin/cs-nagios
125
126
  - cloudstack-nagios.gemspec
126
- - lib/cloudstack-client/client.rb
127
- - lib/cloudstack-client/commands/account.rb
128
- - lib/cloudstack-client/commands/capacity.rb
129
- - lib/cloudstack-client/commands/cluster.rb
130
- - lib/cloudstack-client/commands/disk_offering.rb
131
- - lib/cloudstack-client/commands/domain.rb
132
- - lib/cloudstack-client/commands/host.rb
133
- - lib/cloudstack-client/commands/ip_address.rb
134
- - lib/cloudstack-client/commands/iso.rb
135
- - lib/cloudstack-client/commands/job.rb
136
- - lib/cloudstack-client/commands/load_balancer_rule.rb
137
- - lib/cloudstack-client/commands/network.rb
138
- - lib/cloudstack-client/commands/pod.rb
139
- - lib/cloudstack-client/commands/port_forwarding_rule.rb
140
- - lib/cloudstack-client/commands/project.rb
141
- - lib/cloudstack-client/commands/router.rb
142
- - lib/cloudstack-client/commands/server.rb
143
- - lib/cloudstack-client/commands/service_offering.rb
144
- - lib/cloudstack-client/commands/snapshot.rb
145
- - lib/cloudstack-client/commands/ssh_key_pair.rb
146
- - lib/cloudstack-client/commands/template.rb
147
- - lib/cloudstack-client/commands/user.rb
148
- - lib/cloudstack-client/commands/volume.rb
149
- - lib/cloudstack-client/commands/zone.rb
150
- - lib/cloudstack-client/version.rb
151
127
  - lib/cloudstack-nagios/base.rb
152
128
  - lib/cloudstack-nagios/cli.rb
153
129
  - lib/cloudstack-nagios/commands/check.rb
@@ -158,11 +134,11 @@ files:
158
134
  - lib/cloudstack-nagios/templates/cloudstack_routers_hosts.cfg.erb
159
135
  - lib/cloudstack-nagios/templates/cloudstack_routers_services.cfg.erb
160
136
  - lib/cloudstack-nagios/version.rb
161
- - lib/cloudstack_client.rb
162
137
  - lib/cloudstack_nagios.rb
163
138
  homepage: https://bitbucket.org/swisstxt/cloudstack-nagios
164
139
  licenses:
165
140
  - MIT
141
+ metadata: {}
166
142
  post_install_message:
167
143
  rdoc_options:
168
144
  - --line-numbers
@@ -170,21 +146,19 @@ rdoc_options:
170
146
  require_paths:
171
147
  - lib
172
148
  required_ruby_version: !ruby/object:Gem::Requirement
173
- none: false
174
149
  requirements:
175
- - - ! '>='
150
+ - - '>='
176
151
  - !ruby/object:Gem::Version
177
152
  version: 1.9.3
178
153
  required_rubygems_version: !ruby/object:Gem::Requirement
179
- none: false
180
154
  requirements:
181
- - - ! '>='
155
+ - - '>='
182
156
  - !ruby/object:Gem::Version
183
157
  version: '0'
184
158
  requirements: []
185
159
  rubyforge_project:
186
- rubygems_version: 1.8.23
160
+ rubygems_version: 2.0.3
187
161
  signing_key:
188
- specification_version: 3
162
+ specification_version: 4
189
163
  summary: cloudstack-nagios CloudStack monitoring tools for nagios
190
164
  test_files: []
@@ -1,136 +0,0 @@
1
- require 'base64'
2
- require 'openssl'
3
- require 'uri'
4
- require 'cgi'
5
- require 'net/http'
6
- require 'net/https'
7
- require 'json'
8
- require 'yaml'
9
-
10
- module CloudstackClient
11
- class Connection
12
-
13
- @@async_poll_interval = 2.0
14
- @@async_timeout = 400
15
-
16
- # include all commands
17
- Dir.glob(File.dirname(__FILE__) + "/commands/*.rb").each do |file|
18
- require file
19
- module_name = File.basename(file, '.rb').split('_').map{|f| f.capitalize}.join
20
- include Object.const_get("CloudstackClient").const_get(module_name)
21
- end
22
-
23
- attr_accessor :verbose
24
-
25
- def initialize(api_url, api_key, secret_key, opts = {})
26
- @api_url = api_url
27
- @api_key = api_key
28
- @secret_key = secret_key
29
- @use_ssl = api_url.start_with? "https"
30
- @verbose = opts[:quiet] ? false : true
31
- @debug = opts[:debug] ? true : false
32
- end
33
-
34
- ##
35
- # Sends a synchronous request to the CloudStack API and returns the response as a Hash.
36
- #
37
- # The wrapper element of the response (e.g. mycommandresponse) is discarded and the
38
- # contents of that element are returned.
39
-
40
- def send_request(params)
41
- params['response'] = 'json'
42
- params['apiKey'] = @api_key
43
-
44
- params_arr = []
45
- params.sort.each { |elem|
46
- params_arr << elem[0].to_s + '=' + CGI.escape(elem[1].to_s).gsub('+', '%20').gsub(' ','%20')
47
- }
48
-
49
- debug_output JSON.pretty_generate(params) if @debug
50
-
51
- data = params_arr.join('&')
52
- signature = OpenSSL::HMAC.digest('sha1', @secret_key, data.downcase)
53
- signature = Base64.encode64(signature).chomp
54
- signature = CGI.escape(signature)
55
-
56
- url = "#{@api_url}?#{data}&signature=#{signature}"
57
-
58
- uri = URI.parse(url)
59
- http = Net::HTTP.new(uri.host, uri.port)
60
- http.use_ssl = @use_ssl
61
- http.verify_mode = OpenSSL::SSL::VERIFY_NONE
62
-
63
- begin
64
- response = http.request(Net::HTTP::Get.new(uri.request_uri))
65
- rescue
66
- puts "Error connecting to API:"
67
- puts "#{@api_url} is not reachable"
68
- exit 1
69
- end
70
-
71
- if !response.is_a?(Net::HTTPOK)
72
- puts "Error #{response.code}: #{response.message}"
73
- puts JSON.pretty_generate(JSON.parse(response.body))
74
- puts "URL: #{url}"
75
- exit 1
76
- end
77
-
78
- begin
79
- json = JSON.parse(response.body)
80
- rescue JSON::ParserError
81
- puts "Error parsing response from server."
82
- exit 1
83
- end
84
- json[params['command'].downcase + 'response']
85
- end
86
-
87
- ##
88
- # Sends an asynchronous request and waits for the response.
89
- #
90
- # The contents of the 'jobresult' element are returned upon completion of the command.
91
-
92
- def send_async_request(params)
93
-
94
- json = send_request(params)
95
-
96
- params = {
97
- 'command' => 'queryAsyncJobResult',
98
- 'jobId' => json['jobid']
99
- }
100
-
101
- max_tries = (@@async_timeout / @@async_poll_interval).round
102
- max_tries.times do
103
- json = send_request(params)
104
- status = json['jobstatus']
105
-
106
- print "." if @verbose
107
-
108
- if status == 1
109
- return json['jobresult']
110
- elsif status == 2
111
- puts
112
- puts "Request failed (#{json['jobresultcode']}): #{json['jobresult']}"
113
- exit 1
114
- end
115
-
116
- STDOUT.flush
117
- sleep @@async_poll_interval
118
- end
119
-
120
- print "\n"
121
- puts "Error: Asynchronous request timed out"
122
- exit 1
123
- end
124
-
125
- private
126
-
127
- def debug_output(output, seperator = '-' * 80)
128
- puts
129
- puts seperator
130
- puts output
131
- puts seperator
132
- puts
133
- end
134
-
135
- end # class
136
- end
@@ -1,22 +0,0 @@
1
- module CloudstackClient
2
-
3
- module Account
4
-
5
- ##
6
- # Lists accounts.
7
-
8
- def list_accounts(args = { :name => nil })
9
- params = {
10
- 'command' => 'listAccounts',
11
- 'listall' => 'true',
12
- 'isrecursive' => 'true'
13
- }
14
- params['name'] = args[:name] if args[:name]
15
-
16
- json = send_request(params)
17
- json['account'] || []
18
- end
19
-
20
- end
21
-
22
- end