cloudstack-nagios 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. data/.gitignore +6 -0
  2. data/Gemfile +4 -0
  3. data/Gemfile.lock +24 -0
  4. data/LICENSE.txt +21 -0
  5. data/README.md +57 -0
  6. data/bin/cs-nagios +6 -0
  7. data/cloudstack-nagios.gemspec +28 -0
  8. data/lib/cloudstack-client/client.rb +136 -0
  9. data/lib/cloudstack-client/commands/account.rb +22 -0
  10. data/lib/cloudstack-client/commands/capacity.rb +19 -0
  11. data/lib/cloudstack-client/commands/cluster.rb +19 -0
  12. data/lib/cloudstack-client/commands/disk_offering.rb +49 -0
  13. data/lib/cloudstack-client/commands/domain.rb +22 -0
  14. data/lib/cloudstack-client/commands/host.rb +28 -0
  15. data/lib/cloudstack-client/commands/ip_address.rb +82 -0
  16. data/lib/cloudstack-client/commands/iso.rb +64 -0
  17. data/lib/cloudstack-client/commands/job.rb +29 -0
  18. data/lib/cloudstack-client/commands/load_balancer_rule.rb +61 -0
  19. data/lib/cloudstack-client/commands/network.rb +128 -0
  20. data/lib/cloudstack-client/commands/pod.rb +19 -0
  21. data/lib/cloudstack-client/commands/port_forwarding_rule.rb +49 -0
  22. data/lib/cloudstack-client/commands/project.rb +32 -0
  23. data/lib/cloudstack-client/commands/router.rb +89 -0
  24. data/lib/cloudstack-client/commands/server.rb +311 -0
  25. data/lib/cloudstack-client/commands/service_offering.rb +98 -0
  26. data/lib/cloudstack-client/commands/snapshot.rb +40 -0
  27. data/lib/cloudstack-client/commands/ssh_key_pair.rb +106 -0
  28. data/lib/cloudstack-client/commands/template.rb +60 -0
  29. data/lib/cloudstack-client/commands/user.rb +32 -0
  30. data/lib/cloudstack-client/commands/volume.rb +20 -0
  31. data/lib/cloudstack-client/commands/zone.rb +57 -0
  32. data/lib/cloudstack-client/version.rb +3 -0
  33. data/lib/cloudstack-nagios/base.rb +69 -0
  34. data/lib/cloudstack-nagios/cli.rb +100 -0
  35. data/lib/cloudstack-nagios/commands/nagios_config.rb +13 -0
  36. data/lib/cloudstack-nagios/helper.rb +17 -0
  37. data/lib/cloudstack-nagios/templates/cloudstack_routers_hosts.cfg.erb +36 -0
  38. data/lib/cloudstack-nagios/templates/cloudstack_routers_services.cfg.erb +35 -0
  39. data/lib/cloudstack-nagios/version.rb +3 -0
  40. data/lib/cloudstack_client.rb +2 -0
  41. data/lib/cloudstack_nagios.rb +4 -0
  42. metadata +155 -0
@@ -0,0 +1,13 @@
1
+ class NagiosConfig < CloudstackNagios::Base
2
+
3
+ desc "hosts", "generate nagios hosts configuration for virtual routers"
4
+ def hosts
5
+ puts load_template("cloudstack_routers_hosts.cfg.erb").result(routers: routers)
6
+ end
7
+
8
+ desc "services", "generate nagios services configuration for virtual routers"
9
+ def services
10
+ puts load_template("cloudstack_routers_services.cfg.erb").result(routers: routers)
11
+ end
12
+
13
+ end
@@ -0,0 +1,17 @@
1
+ module CloudstackNagios
2
+ module Helper
3
+ def load_template(name)
4
+ templ = File.read(File.join(File.dirname(__FILE__), "templates", name))
5
+ Erubis::Eruby.new(templ)
6
+ end
7
+
8
+ def routers
9
+ routers = client.list_routers
10
+ projects = client.list_projects
11
+ projects.each do |project|
12
+ routers = routers + client.list_routers({projectid: project['id']})
13
+ end
14
+ routers
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,36 @@
1
+ ###############################################################################
2
+ #
3
+ # Host configuration file
4
+ #
5
+ # Created by:
6
+ # Date: <%= Date.new %>
7
+ # Version: Nagios 3.x config file
8
+ #
9
+ # --- DO NOT EDIT THIS FILE BY HAND ---
10
+ # cloudstack-cli will overwite all manual settings during the next update
11
+ #
12
+ ###############################################################################
13
+ <% routers.each do |router| -%>
14
+
15
+ define host {
16
+ host_name <%= router['name'] %>
17
+ alias <%= router['name'] %>
18
+ display_name <%= router['name'] %> <%= " - #{router['project']}" if router['project'] %>
19
+ address <%= router['linklocalip'] %>
20
+ hostgroups Cloudstack-Host-Group
21
+ check_command check-host-alive
22
+ use Linux-Host,host-pnp
23
+ notification_period S1
24
+ _COMMUNITY public
25
+ register 1
26
+ }
27
+
28
+ <% end -%>
29
+
30
+ ###############################################################################
31
+ #
32
+ # Host configuration file
33
+ #
34
+ # END OF FILE
35
+ #
36
+ ###############################################################################
@@ -0,0 +1,35 @@
1
+
2
+ ###############################################################################
3
+ #
4
+ # Host configuration file
5
+ #
6
+ # Created by:
7
+ # Date: <%= Date.new %>
8
+ # Version: Nagios 3.x config file
9
+ #
10
+ # --- DO NOT EDIT THIS FILE BY HAND ---
11
+ # cloudstack-cli will overwite all manual settings during the next update
12
+ #
13
+ ###############################################################################
14
+ <% routers.each do |router| -%>
15
+
16
+ define service {
17
+ host_name <%= router['name'] %>
18
+ service_description <%= router['name'] %> <%= " - #{router['project']}" if router['project'] %> - Memory
19
+ display_name Memory
20
+ use Generic-Service,service-pnp
21
+ check_command checkcommand.rb!memory
22
+ register 1
23
+ }
24
+
25
+
26
+ <% end -%>
27
+
28
+ ###############################################################################
29
+ #
30
+ # Host configuration file
31
+ #
32
+ # END OF FILE
33
+ #
34
+ ###############################################################################
35
+
@@ -0,0 +1,3 @@
1
+ module CloudstackNagios
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,2 @@
1
+ require "cloudstack-client/version"
2
+ require "cloudstack-client/client"
@@ -0,0 +1,4 @@
1
+ require "cloudstack-nagios/version"
2
+ require "cloudstack-nagios/helper"
3
+ require "cloudstack-nagios/base"
4
+ require "cloudstack-nagios/cli"
metadata ADDED
@@ -0,0 +1,155 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cloudstack-nagios
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Nik Wolfgramm
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-11-04 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rdoc
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: 10.0.4
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 10.0.4
46
+ - !ruby/object:Gem::Dependency
47
+ name: thor
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: 0.18.1
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 0.18.1
62
+ - !ruby/object:Gem::Dependency
63
+ name: erubis
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: 2.7.0
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 2.7.0
78
+ description: cloudstack-nagios generates nagios configuration and checks for monitoring
79
+ cloudstack with nagios.
80
+ email:
81
+ - nik.wolfgramm@gmail.com
82
+ executables:
83
+ - cs-nagios
84
+ extensions: []
85
+ extra_rdoc_files: []
86
+ files:
87
+ - .gitignore
88
+ - Gemfile
89
+ - Gemfile.lock
90
+ - LICENSE.txt
91
+ - README.md
92
+ - bin/cs-nagios
93
+ - cloudstack-nagios.gemspec
94
+ - lib/cloudstack-client/client.rb
95
+ - lib/cloudstack-client/commands/account.rb
96
+ - lib/cloudstack-client/commands/capacity.rb
97
+ - lib/cloudstack-client/commands/cluster.rb
98
+ - lib/cloudstack-client/commands/disk_offering.rb
99
+ - lib/cloudstack-client/commands/domain.rb
100
+ - lib/cloudstack-client/commands/host.rb
101
+ - lib/cloudstack-client/commands/ip_address.rb
102
+ - lib/cloudstack-client/commands/iso.rb
103
+ - lib/cloudstack-client/commands/job.rb
104
+ - lib/cloudstack-client/commands/load_balancer_rule.rb
105
+ - lib/cloudstack-client/commands/network.rb
106
+ - lib/cloudstack-client/commands/pod.rb
107
+ - lib/cloudstack-client/commands/port_forwarding_rule.rb
108
+ - lib/cloudstack-client/commands/project.rb
109
+ - lib/cloudstack-client/commands/router.rb
110
+ - lib/cloudstack-client/commands/server.rb
111
+ - lib/cloudstack-client/commands/service_offering.rb
112
+ - lib/cloudstack-client/commands/snapshot.rb
113
+ - lib/cloudstack-client/commands/ssh_key_pair.rb
114
+ - lib/cloudstack-client/commands/template.rb
115
+ - lib/cloudstack-client/commands/user.rb
116
+ - lib/cloudstack-client/commands/volume.rb
117
+ - lib/cloudstack-client/commands/zone.rb
118
+ - lib/cloudstack-client/version.rb
119
+ - lib/cloudstack-nagios/base.rb
120
+ - lib/cloudstack-nagios/cli.rb
121
+ - lib/cloudstack-nagios/commands/nagios_config.rb
122
+ - lib/cloudstack-nagios/helper.rb
123
+ - lib/cloudstack-nagios/templates/cloudstack_routers_hosts.cfg.erb
124
+ - lib/cloudstack-nagios/templates/cloudstack_routers_services.cfg.erb
125
+ - lib/cloudstack-nagios/version.rb
126
+ - lib/cloudstack_client.rb
127
+ - lib/cloudstack_nagios.rb
128
+ homepage: https://bitbucket.org/swisstxt/cloudstack-nagios
129
+ licenses:
130
+ - MIT
131
+ post_install_message:
132
+ rdoc_options:
133
+ - --line-numbers
134
+ - --inline-source
135
+ require_paths:
136
+ - lib
137
+ required_ruby_version: !ruby/object:Gem::Requirement
138
+ none: false
139
+ requirements:
140
+ - - ! '>='
141
+ - !ruby/object:Gem::Version
142
+ version: 1.9.3
143
+ required_rubygems_version: !ruby/object:Gem::Requirement
144
+ none: false
145
+ requirements:
146
+ - - ! '>='
147
+ - !ruby/object:Gem::Version
148
+ version: '0'
149
+ requirements: []
150
+ rubyforge_project:
151
+ rubygems_version: 1.8.23
152
+ signing_key:
153
+ specification_version: 3
154
+ summary: cloudstack-nagios CloudStack monitoring tools for nagios
155
+ test_files: []