cloudstack-nagios 0.4.2 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -1,98 +0,0 @@
1
- module CloudstackClient
2
-
3
- module ServiceOffering
4
-
5
- ##
6
- # Finds the service offering with the specified name.
7
-
8
- def get_service_offering(name)
9
-
10
- # TODO: use name parameter
11
- # listServiceOfferings in CloudStack 2.2 doesn't seem to work
12
- # when the name parameter is specified. When this is fixed,
13
- # the name parameter should be added to the request.
14
- params = {
15
- 'command' => 'listServiceOfferings'
16
- }
17
- json = send_request(params)
18
-
19
- services = json['serviceoffering']
20
- return nil unless services
21
-
22
- services.each { |s|
23
- if s['name'] == name then
24
- return s
25
- end
26
- }
27
- nil
28
- end
29
-
30
- ##
31
- # Lists all available service offerings.
32
-
33
- def list_service_offerings(domain = nil)
34
- params = {
35
- 'command' => 'listServiceOfferings'
36
- }
37
-
38
- if domain
39
- params['domainid'] = list_domains(domain).first["id"]
40
- end
41
-
42
- json = send_request(params)
43
- json['serviceoffering'] || []
44
- end
45
-
46
- ##
47
- # Create a service offering.
48
-
49
- def create_offering(args)
50
- params = {
51
- 'command' => 'createServiceOffering',
52
- 'name' => args[:name],
53
- 'cpunumber' => args[:cpunumber],
54
- 'cpuspeed' => args[:cpuspeed],
55
- 'displaytext' => args[:displaytext],
56
- 'memory' => args[:memory]
57
- }
58
-
59
- if args['domain']
60
- params['domainid'] = list_domains(args['domain']).first["id"]
61
- end
62
-
63
- params['tags'] = args[:tags] if args[:tags]
64
- params['offerha'] = 'true' if args[:ha]
65
-
66
- json = send_request(params)
67
- json['serviceoffering'].first
68
- end
69
-
70
- ##
71
- # Delete a service offering.
72
-
73
- def delete_offering(id)
74
- params = {
75
- 'command' => 'deleteServiceOffering',
76
- 'id' => id
77
- }
78
-
79
- json = send_request(params)
80
- json['success']
81
- end
82
-
83
- def update_offering(args)
84
- params = {
85
- 'command' => 'updateServiceOffering',
86
- 'id' => args['id']
87
- }
88
- params['name'] = args['name'] if args['name']
89
- params['displaytext'] = args['displaytext'] if args['displaytext']
90
- params['sortkey'] = args['sortkey'] if args['sortkey']
91
-
92
- json = send_request(params)
93
- json['serviceoffering']
94
- end
95
-
96
- end
97
-
98
- end
@@ -1,40 +0,0 @@
1
- module CloudstackClient
2
-
3
- module Snapshot
4
-
5
- ##
6
- # Lists snapshots.
7
-
8
- def list_snapshots(args = {})
9
- params = {
10
- 'command' => 'listSnapshots',
11
- 'isrecursive' => 'true'
12
- }
13
- params['name'] = args[:name] if args[:name]
14
-
15
- if args[:project]
16
- project = get_project(args[:project])
17
- unless project
18
- puts "Error: project #{args[:project]} not found."
19
- exit 1
20
- end
21
- params['projectid'] = project['id']
22
- end
23
- if args[:account]
24
- account = list_accounts({name: args[:account]}).first
25
- unless account
26
- puts "Error: Account #{args[:account]} not found."
27
- exit 1
28
- end
29
- params['domainid'] = account["domainid"]
30
- params['account'] = args[:account]
31
- end
32
- params['listall'] = args[:listall] if args[:listall]
33
-
34
- json = send_request(params)
35
- json['snapshot'] || []
36
- end
37
-
38
- end
39
-
40
- end
@@ -1,106 +0,0 @@
1
- module CloudstackClient
2
-
3
- module SshKeyPair
4
-
5
- ##
6
- # Lists ssh key pairs.
7
- #
8
-
9
- def list_ssh_key_pairs(args = {})
10
- params = {
11
- 'command' => 'listSSHKeyPairs',
12
- 'isrecursive' => true
13
- }
14
- params['listall'] = true if args[:listall]
15
- params['name'] = args[:name] if args[:name]
16
-
17
- if args[:project]
18
- project = get_project(args[:project])
19
- unless project
20
- puts "Error: project #{args[:project]} not found."
21
- exit 1
22
- end
23
- params['projectid'] = project['id']
24
- end
25
-
26
- if args[:account]
27
- account = list_accounts({name: args[:account]}).first
28
- unless account
29
- puts "Error: Account #{args[:account]} not found."
30
- exit 1
31
- end
32
- params['domainid'] = account["domainid"]
33
- params['account'] = args[:account]
34
- end
35
-
36
- json = send_request(params)
37
- json['sshkeypair'] || []
38
- end
39
-
40
- ##
41
- # Create ssh key pairs.
42
- #
43
-
44
- def create_ssh_key_pair(name, args = {})
45
- params = {
46
- 'command' => 'createSSHKeyPair',
47
- 'name' => name
48
- }
49
- if args[:project]
50
- project = get_project(args[:project])
51
- unless project
52
- puts "Error: project #{args[:project]} not found."
53
- exit 1
54
- end
55
- params['projectid'] = project['id']
56
- end
57
-
58
- if args[:account]
59
- account = list_accounts({name: args[:account]}).first
60
- unless account
61
- puts "Error: Account #{args[:account]} not found."
62
- exit 1
63
- end
64
- params['domainid'] = account["domainid"]
65
- params['account'] = args[:account]
66
- end
67
- params['publickey'] = args[:public_key] if args[:public_key]
68
-
69
- json = send_request(params)['keypair']
70
- end
71
-
72
- ##
73
- # Delete ssh key pairs.
74
- #
75
-
76
- def delete_ssh_key_pair(name, args = {})
77
- params = {
78
- 'command' => 'deleteSSHKeyPair',
79
- 'name' => name
80
- }
81
-
82
- if args[:project]
83
- project = get_project(args[:project])
84
- unless project
85
- puts "Error: project #{args[:project]} not found."
86
- exit 1
87
- end
88
- params['projectid'] = project['id']
89
- end
90
-
91
- if args[:account]
92
- account = list_accounts({name: args[:account]}).first
93
- unless account
94
- puts "Error: Account #{args[:account]} not found."
95
- exit 1
96
- end
97
- params['domainid'] = account["domainid"]
98
- params['account'] = args[:account]
99
- end
100
-
101
- json = send_request(params)
102
- end
103
-
104
- end
105
-
106
- end
@@ -1,60 +0,0 @@
1
- module CloudstackClient
2
-
3
- module Template
4
-
5
- ##
6
- # Finds the template with the specified name.
7
-
8
- def get_template(name)
9
-
10
- # TODO: use name parameter
11
- # listTemplates in CloudStack 2.2 doesn't seem to work
12
- # when the name parameter is specified. When this is fixed,
13
- # the name parameter should be added to the request.
14
- params = {
15
- 'command' => 'listTemplates',
16
- 'templateFilter' => 'executable'
17
- }
18
- json = send_request(params)
19
-
20
- templates = json['template']
21
- if !templates then
22
- return nil
23
- end
24
-
25
- templates.each { |t|
26
- if t['name'] == name then
27
- return t
28
- end
29
- }
30
-
31
- nil
32
- end
33
-
34
- ##
35
- # Lists all templates that match the specified filter.
36
- #
37
- # Allowable filter values are:
38
- #
39
- # * featured - templates that are featured and are public
40
- # * self - templates that have been registered/created by the owner
41
- # * self-executable - templates that have been registered/created by the owner that can be used to deploy a new VM
42
- # * executable - all templates that can be used to deploy a new VM
43
- # * community - templates that are public
44
-
45
- def list_templates(args = {})
46
- filter = args[:filter] || 'featured'
47
- params = {
48
- 'command' => 'listTemplates',
49
- 'templateFilter' => filter
50
- }
51
- params['projectid'] = args[:project_id] if args[:project_id]
52
- params['zoneid'] = args[:zone_id] if args[:zone_id]
53
-
54
- json = send_request(params)
55
- json['template'] || []
56
- end
57
-
58
- end
59
-
60
- end
@@ -1,32 +0,0 @@
1
- module CloudstackClient
2
-
3
- module User
4
-
5
- ##
6
- # Lists users.
7
- #
8
-
9
- def list_users(args = {})
10
- params = {
11
- 'command' => 'listUsers',
12
- 'isrecursive' => true
13
- }
14
- params['listall'] = true if args[:listall]
15
-
16
- if args[:account]
17
- account = list_accounts({name: args[:account]}).first
18
- unless account
19
- puts "Error: Account #{args[:account]} not found."
20
- exit 1
21
- end
22
- params['domainid'] = account["domainid"]
23
- params['account'] = args[:account]
24
- end
25
-
26
- json = send_request(params)
27
- json['user'] || []
28
- end
29
-
30
- end
31
-
32
- end
@@ -1,20 +0,0 @@
1
- module CloudstackClient
2
-
3
- module Volume
4
-
5
- ##
6
- # Lists all volumes.
7
-
8
- def list_volumes(project_id = nil)
9
- params = {
10
- 'command' => 'listVolumes',
11
- 'listall' => true,
12
- }
13
- params['projectid'] = project_id if project_id
14
- json = send_request(params)
15
- json['volume'] || []
16
- end
17
-
18
- end
19
-
20
- end
@@ -1,57 +0,0 @@
1
- module CloudstackClient
2
-
3
- module Zone
4
-
5
- ##
6
- # Finds the zone with the specified name.
7
-
8
- def get_zone(name)
9
- params = {
10
- 'command' => 'listZones',
11
- 'available' => 'true'
12
- }
13
- json = send_request(params)
14
-
15
- networks = json['zone']
16
- return nil unless networks
17
-
18
- networks.each { |z|
19
- if z['name'] == name then
20
- return z
21
- end
22
- }
23
-
24
- nil
25
- end
26
-
27
- ##
28
- # Finds the default zone for your account.
29
-
30
- def get_default_zone
31
- params = {
32
- 'command' => 'listZones',
33
- 'available' => 'true'
34
- }
35
- json = send_request(params)
36
-
37
- zones = json['zone']
38
- return nil unless zones
39
-
40
- zones.first
41
- end
42
-
43
- ##
44
- # Lists all available zones.
45
-
46
- def list_zones
47
- params = {
48
- 'command' => 'listZones',
49
- 'available' => 'true'
50
- }
51
- json = send_request(params)
52
- json['zone'] || []
53
- end
54
-
55
- end
56
-
57
- end
@@ -1,3 +0,0 @@
1
- module CloudstackClient
2
- VERSION = "0.2.9"
3
- end
@@ -1,2 +0,0 @@
1
- require "cloudstack-client/version"
2
- require "cloudstack-client/client"