Permalink
Browse files

Merged changes from latest opscode cookbook with crowbar-specific cha…

…nges
  • Loading branch information...
khudgins committed Jan 3, 2012
1 parent 8df5501 commit 5dfe5cf195f96b9a3d132dd4e8e4c7fa7ad57170
@@ -6,29 +6,28 @@ CHANGELOG.md covers history and planned features
Requirements
============
-Written with Chef 0.10.0.rc.0 and uses fairly recent search capabilities of roles.
+Written with Chef 0.10 and uses recent search capabilities of roles.
The example roles in the `zenoss/roles` directory should be loaded for use, refer to the Roles subsection.
Testing
-------
-Tested on Ubuntu 10.04 and 10.10 and tested with Chef 0.9.12.
-Tested on CentOS 5.6 and Scientific Linux 5.5 and tested with Chef 0.10.0.rc.0.
+Tested on Ubuntu 10.04 and 10.10 and CentOS 5.7 and tested with Chef 0.10.
Attributes
==========
Attributes under the `zenoss` namespace.
-* `["zenoss"]["device"]["device_class"]` - Device Class for the device, "/Discovered" is the default and may be overwritten at the Role or Node.
-* `["zenoss"]["device"]["location"]` - Location for the device, may be set at the Role or Node.
-* `["zenoss"]["device"]["modeler_plugins"]` - Modeler Plugins used by the device, may be set at the Role or Node.
-* `["zenoss"]["device"]["properties"]` - Configuration Properties used by the device, may be set at the Role or Node.
-* `["zenoss"]["device"]["templates"]` - Monitoring Templates used by the device, may be set at the Role or Node.
-* `["zenoss"]["server"]["admin_password"]` - Password for the `admin` account, default is `chefzenoss`
-* `["zenoss"]["server"]["installed_zenpacks"]` - Hash of ZenPacks and their versions, defaults are `"ZenPacks.zenoss.LinuxMonitor" => "1.1.5", "ZenPacks.community.MySQLSSH" => "0.4"`
-* `["zenoss"]["server"]["zenhome"]` - Directory of the Zenoss server installation, default is `/usr/local/zenoss/zenoss` for Debian/Ubuntu and `/opt/zenoss` for CentOS/RHEL/Scientific Linux.
-* `["zenoss"]["server"]["zenoss_pubkey"]` - Public key for the `zenoss` user used for monitoring. Set on the server automatically if it does not exist.
-* `["zenoss"]["server"]["zenpatches"]` - Hash of patches and the tickets providing the patches, defaults are `"23716" => "http://dev.zenoss.com/trac/ticket/7485", "23833" => "http://dev.zenoss.com/trac/ticket/6959"`
+* `['zenoss']['device']['device_class']` - Device Class for the device, "/Discovered" is the default and may be overwritten at the Role or Node.
+* `['zenoss']['device']['location']` - Location for the device, may be set at the Role or Node.
+* `['zenoss']['device']['modeler_plugins']` - Modeler Plugins used by the device, may be set at the Role or Node.
+* `['zenoss']['device']['properties']` - Configuration Properties used by the device, may be set at the Role or Node.
+* `['zenoss']['device']['templates']` - Monitoring Templates used by the device, may be set at the Role or Node.
+* `['zenoss']['server']['admin_password']` - Password for the `admin` account, default is `chefzenoss`
+* `['zenoss']['server']['installed_zenpacks']` - Hash of ZenPacks and their versions, defaults are `"ZenPacks.zenoss.LinuxMonitor" => "1.1.5", "ZenPacks.community.MySQLSSH" => "0.4"`
+* `['zenoss']['server']['zenhome']` - Directory of the Zenoss server installation, default is `/usr/local/zenoss/zenoss` for Debian/Ubuntu and `/opt/zenoss` for CentOS/RHEL/Scientific Linux.
+* `['zenoss']['server']['zenoss_pubkey']` - Public key for the `zenoss` user used for monitoring. Set on the server automatically if it does not exist.
+* `['zenoss']['server']['zenpatches']` - Hash of patches and the tickets providing the patches, defaults are `"23716" => "http://dev.zenoss.com/trac/ticket/7485", "23833" => "http://dev.zenoss.com/trac/ticket/6959"`
Resources/Providers
===================
@@ -60,22 +59,23 @@ The client includes the `openssh` recipe and adds the device to the Zenoss serve
Server
------
-The server includes the `openssh` and `apt` recipes. The server recipe installs Zenoss from the .deb stack installer via the `apt` cookbook, handling and configuring all the dependencies.
+The server includes the `openssh` recipe. The server recipe installs Zenoss from either the .deb stack installer or the .rpm, handling and configuring all the dependencies. The crowbar distribution of this recipe differs slightly from the Opscode community cookbookto better support the crowbar environment.
+
+
The recipe does the following:
-1. Installs Zenoss per the Zenoss Installation Guide.
-2. Applies post-3.1.0 patches from closed tickets.
-3. Starts server.
+1. Installs Zenoss per the Zenoss Installation Guide from the zenpack package built within the barclamp.
+2. Applies any patches that you have specified with the `['zenoss']['server']['zenpatches']` attribute.
+3. Starts server (skipping the setup wizard).
4. Sets the `admin` password.
-5. Adds any other users to the proper Zenoss roles.
+5. Searches for members of the `sysadmins` group by searching through `users` data bag and adds them to the server.
6. Creates a `zenoss` user for running Zenoss and monitoring clients via SSH.
7. Installs ZenPacks required for monitoring.
-8. Creates Device Classes, Groups and Locations based on Chef roles containing custom settings.
-9. Adds Systems to the server based on which recipes are used within Chef.
-10. Adds itself to be monitored.
-11. Searches for members of the `sysadmins` group by searching through `users` data bag and adds them to the server.
-12. Finds all nodes implementing `zenoss::client` and adds them for monitoring and places them in the proper Device Classes, Groups, Systems and Locations and any node-specific settings as well.
+8. Adds itself to be monitored.
+9. Creates Device Classes, Groups and Locations based on Chef roles containing custom settings.
+10. Adds Systems to the server based on which recipes are used within Chef.
+11. Finds all nodes implementing `zenoss::client` and adds them for monitoring and places them in the proper Device Classes, Groups, Systems and Locations and any node-specific settings as well via `zenbatchload`.
Data Bags
=========
@@ -142,9 +142,12 @@ Zenoss has the concept of Devices, which belong to a single Device Class and Loc
If you are monitoring devices running on Amazon's EC2 with Zenoss, you will need to allow ICMP ping from your Zenoss server.
+Because of limitations in zenbatchload, changing settings after initial configuration may not persist. This will be revisited with the upcoming Zenoss 4.x release (COO-895).
+
License and Author
==================
Author:: Matt Ray <matt@opscode.com>
+Author:: Keith Hudgins <keith@dtosolutions.com>
Copyright:: 2010, Zenoss, Inc
Copyright:: 2010, 2011 Opscode, Inc
@@ -2,7 +2,7 @@
maintainer_email "cookbooks@opscode.com"
license "Apache 2.0"
description "Installs and configures Zenoss and registers nodes as devices"
-version "0.7.2"
+version "0.7.5"
depends "openssh"
depends "openssl"
recipe "zenoss", "Defaults to the client recipe."
@@ -25,11 +25,28 @@
batch += ", setAddress=\"#{locations[location]['address']}\"\n"
end
- #sort the hash and construct the batchload file
+ #load the devices by device class
devices.keys.sort!.each do |dclass|
Chef::Log.debug "zenbatchload deviceclass:#{dclass}"
- batch += "\"/Devices#{dclass}\"\n"
- #write out any settings for the device class as well?
+ batch += "\"/Devices#{dclass}\""
+ #write out any settings for the device class
+ #individual node settings aren't supported
+ if devices[dclass]['modeler_plugins']
+ batch += " zCollectorPlugins=("
+ devices[dclass]['modeler_plugins'].each {|k| batch += "\"#{k}\"," }
+ batch += "),"
+ end
+ if devices[dclass]['templates']
+ batch += " zDeviceTemplates=["
+ devices[dclass]['templates'].each {|k| batch += "\"#{k}\"," }
+ batch += "],"
+ end
+ if devices[dclass]['properties']
+ devices[dclass]['properties'].each {|k, v| batch += " #{k}=\"#{v}\"," }
+ end
+ batch += "\n"
+
+ #add the individual nodes
devices[dclass]['nodes'].sort_by {|n| n.ipaddress}.each do |device|
#set for hybrid clouds
if device['cloud'] and device['cloud']['public_ips']
@@ -64,20 +81,7 @@
dsystems.each {|sys| devsystems += "\"/#{sys}\","}
devsystems += "], "
batch += devsystems
- #only use device['zenoss']['device'].current_normal for node-specific templates, modeler_plugins and properties
- if node['zenoss'] and node['zenoss']['device'] and node['zenoss']['device'].current_normal
- if node['zenoss']['device'].current_normal['modeler_plugins']
- plugins = node['zenoss']['device'].current_normal['modeler_plugins']
- batch += "zCollectorPlugins=#{plugins}, "
- end
- if node['zenoss']['device'].current_normal['templates']
- templates = node['zenoss']['device'].current_normal['templates']
- batch += "zDeviceTemplates=#{templates}, "
- end
- if node['zenoss']['device'].current_normal['properties']
- node['zenoss']['device'].current_normal['properties'].each {|k, v| batch += "#{k}='#{v}', " }
- end
- end
+
batch += "\n"
end
end
@@ -2,6 +2,8 @@
patch = new_resource.svnpatch
#check if the patch is already applied
unless ::File.exists?("#{node[:zenoss][:server][:zenhome]}/Products/r#{patch}.patch")
+ package("patch") { action :nothing }.run_action(:install)
+ package("wget") { action :nothing }.run_action(:install)
Chef::Log.info "Applying patch #{patch} from ticket #{new_resource.ticket}."
#apply the patch
execute "#{node[:zenoss][:server][:zenhome]}/bin/zenpatch #{patch}" do
@@ -19,11 +19,9 @@
# limitations under the License.
#
-include_recipe "zenoss::client"
-
case node[:platform]
when "centos","redhat","scientific"
- include_recipe "yum"
+ package "libgcj" #moved here to make CentOS 5.6 happy (COOK-908)
yum_key "RPM-GPG-KEY-zenoss" do
url "http://dev.zenoss.com/yum/RPM-GPG-KEY-zenoss"
@@ -38,9 +36,9 @@
action :add
end
- packages = %w{mysql-server net-snmp net-snmp-utils gmp libgomp libgcj liberation-fonts}
+ packages = %w{mysql-server net-snmp net-snmp-utils gmp libgomp liberation-fonts}
packages.each do |pkg|
- yum_package pkg do
+ package pkg do
action :install
end
end
@@ -65,14 +63,6 @@
#end redhat/centos/scientific block
when "debian","ubuntu"
- #include_recipe "apt"
-
- #apt_repository "zenoss" do
- # uri "http://dev.zenoss.org/deb"
- # distribution "main"
- # components ["stable"]
- # action :add
- #end
packages = %w{ttf-liberation ttf-linux-libertine}
packages.each do |pkg|
@@ -82,6 +72,8 @@
end
#Zenoss hasn't signed their repository http://dev.zenoss.org/trac/ticket/7421
+ #This package must be imported into the crowbar server to work. Use the official
+ #tarball if you're not building the barclamp yourself. --Keith
apt_package "zenoss-stack" do
version node["zenoss"]["server"]["version"]
options "--allow-unauthenticated"
@@ -92,10 +84,12 @@
#apply post 3.2.0 patches from http://dev.zenoss.com/trac/report/6 marked 'closed'
-node["zenoss"]["server"]["zenpatches"].each do |patch, url|
- zenoss_zenpatch patch do
- ticket url
- action :install
+if node['zenoss'] and node['zenoss']['server'] and node['zenoss']['server']['zenpatches']
+ node['zenoss']['server']['zenpatches'].each do |patch, url|
+ zenoss_zenpatch patch do
+ ticket url
+ action :install
+ end
end
end
@@ -133,6 +127,8 @@
action :users
end
+include_recipe "zenoss::client"
+
#put public key in an attribute
ruby_block "zenoss public key" do
block do
@@ -3,7 +3,9 @@
"description": "Installation for Zenoss",
"attributes": {
"zenoss": {
- "foo": "bar"
+ "server": {
+ "password": "password"
+ }
}
},
"deployment": {
@@ -12,7 +12,19 @@
"type": "map",
"required": true,
"mapping": {
- "foo": { "type": "str", "required": true }
+ "server": {
+ "type": "map",
+ "required": true,
+ "mapping": {
+ = : {
+ "type": "map",
+ "required": true,
+ "mapping": {
+ "password": { "type": "str", "required": true },
+ }
+ }
+ }
+ }
}
}
}

0 comments on commit 5dfe5cf

Please sign in to comment.