Skip to content
Browse files

Updated readme, tweaked package lists in the yml file, and dropped in…

… updated cookbook.
  • Loading branch information...
1 parent 618b53b commit 0e377edb06492dd3534b9183e58ad4a539802b6c @khudgins committed Dec 8, 2011
View
4 README.txt
@@ -12,7 +12,9 @@ A Barclamp is a module component that implements functionality for Crowbar. Cor
About this Zenoss
-------------------------------------
-Information for this barclamp is maintained on the Crowbar Framework Wiki: https://github.com/dellcloudedge/crowbar/wiki
+This barclamp installs Zenoss in your crowbar environment.
+
+This is an early, development prerelease that doesn't do much at the moment.
View
3 chef/cookbooks/zenoss/CHANGELOG.md
@@ -62,6 +62,9 @@ add support for Zenoss 3.1.0
yum cookbook dependency
CentOS 5.6 and Scientific Linux 5.5 support via yum_repository LWRP
+0.7.2
+=====
+add support for Zenoss 3.2.1
0.8
mysql::server dependency for rpm installs
View
11 chef/cookbooks/zenoss/attributes/default.rb
@@ -28,7 +28,7 @@
default[:zenoss][:device][:modeler_plugins] = [] #overwritten by roles or on nodes
default[:zenoss][:device][:properties] = {} #overwritten by roles or on nodes
default[:zenoss][:device][:templates] = [] #overwritten by roles or on nodes
-default[:zenoss][:server][:version] = "3.1.0-0"
+default[:zenoss][:server][:version] = "3.2.1-0"
default[:zenoss][:server][:zenoss_pubkey] = "" #gets set in the server recipe, read by clients
case node['platform']
when "ubuntu","debian"
@@ -44,13 +44,8 @@
"ZenPacks.community.MySQLSSH" => "0.4",
}
+#patches from http://dev.zenoss.com/trac/report/6 marked 'closed'
#it might matter that these get ordered eventually as well
default[:zenoss][:server][:zenpatches] = {
- "25711" => "http://dev.zenoss.com/trac/ticket/7497",
- "25814" => "http://dev.zenoss.com/trac/ticket/7772",
- "25902" => "http://dev.zenoss.com/trac/ticket/7591",
- "25926" => "http://dev.zenoss.com/trac/ticket/7802",
- "25963" => "http://dev.zenoss.com/trac/ticket/7114",
- "26025" => "http://dev.zenoss.com/trac/ticket/7813",
- "26059" => "http://dev.zenoss.com/trac/ticket/7820",
+
}
View
2 chef/cookbooks/zenoss/metadata.rb
@@ -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.1"
+version "0.7.2"
depends "apt"
depends "openssh"
depends "openssl"
View
98 chef/cookbooks/zenoss/providers/zenbatchload.rb
@@ -1,65 +1,91 @@
#loads the hash into a file for zenbatchload and loads it
action :run do
- devices = new_resource.devices
- locations = new_resource.locations
groups = new_resource.groups
+ systems = new_resource.systems
+ locations = new_resource.locations
+ devices = new_resource.devices
batch = ""
- Chef::Log.debug "zenbatchload devices:#{devices}"
- Chef::Log.debug "zenbatchload locations:#{locations}"
- Chef::Log.debug "zenbatchload groups:#{groups}"
+
+ #sort the groups and write them out
+ groups.keys.sort!.each do |group|
+ Chef::Log.debug "zenbatchload group:#{group}"
+ batch += "\"/Groups/#{group}\""
+ batch += " description=\"#{groups[group]['description']}\"\n"
+ end
+ #sort the systems and write them out
+ systems.sort!.each do |system|
+ Chef::Log.debug "zenbatchload system:#{system}"
+ batch += "\"/Systems/#{system}\"\n"
+ end
+ #sort the locations and write them out
+ locations.keys.sort!.each do |location|
+ Chef::Log.debug "zenbatchload location:#{location}"
+ batch += "\"/Locations/#{location}\""
+ batch += " description=\"#{locations[location]['description']}\""
+ batch += ", setAddress=\"#{locations[location]['address']}\"\n"
+ end
+
#sort the hash and construct the batchload file
devices.keys.sort!.each do |dclass|
- batch += "#{dclass}\n"
- devices[dclass].sort_by {|n| n.ipaddress}.each do |device|
+ Chef::Log.debug "zenbatchload deviceclass:#{dclass}"
+ batch += "\"/Devices#{dclass}\"\n"
+ #write out any settings for the device class as well?
+ devices[dclass]['nodes'].sort_by {|n| n.ipaddress}.each do |device|
#set for hybrid clouds
- if device.attribute["cloud"] and device.attribute["cloud"]["public_ips"]
+ if device['cloud'] and device['cloud']['public_ips']
batch += "#{device.cloud.public_ips[0]} "
else
batch += "#{device.ipaddress} "
end
#set the ID to the ec2 public name or fqdn
- if device.attribute["ec2"]
- batch += "setTitle='#{device["ec2"]["public_hostname"]}', "
+ if device['ec2']
+ batch += "setTitle=\"#{device['ec2']['public_hostname']}\", "
else
- batch += "setTitle='#{device["fqdn"]}', "
+ batch += "setTitle=\"#{device['fqdn']}\", "
end
#set the Location & Groups
devlocation = ""
- devgroups = "setGroups=[["
- device.roles.each do |role|
+ devgroups = "setGroups=["
+ device.roles.sort!.each do |role|
if locations.member?(role)
- devlocation = "setLocation='#{role}', "
+ devlocation = "setLocation=\"/#{role}\", "
elsif groups.member?(role)
- devgroups += "'#{role}',"
+ devgroups += "\"/#{role}\","
end
#ignore deviceclass roles
end
- devgroups += "]], "
- batch += "#{devlocation}#{devgroups}"
- #set the Systems
- devsystems = "setSystems=[["
- systems = device.expand!.recipes
- systems.collect! {|sys| sys.gsub('::', '/')}
- systems.each {|sys| devsystems += "'#{sys}',"}
- devsystems += "]], "
- batch += "#{devsystems}"
- #only use device.attribute["zenoss"]["device"].current_normal for node-specific templates, modeler_plugins and properties
- if node.attribute["zenoss"] and node.attribute["zenoss"]["device"] and node.attribute["zenoss"]["device"].current_normal
- if node.attribute["zenoss"]["device"].current_normal["modeler_plugins"]
- plugins = node.attribute["zenoss"]["device"].current_normal["modeler_plugins"]
+ devgroups += "], "
+ batch += devlocation
+ batch += devgroups
+ #set the Systems
+ devsystems = "setSystems=["
+ dsystems = device.expand!.recipes.sort!
+ dsystems.collect! {|sys| sys.gsub('::', '/')}
+ 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.attribute["zenoss"]["device"].current_normal["templates"]
- templates = node.attribute["zenoss"]["device"].current_normal["templates"]
+ if node['zenoss']['device'].current_normal['templates']
+ templates = node['zenoss']['device'].current_normal['templates']
batch += "zDeviceTemplates=#{templates}, "
end
- if node.attribute["zenoss"]["device"].current_normal["properties"]
- node.attribute["zenoss"]["device"].current_normal["properties"].each {|k, v| batch += "#{k}='#{v}', " }
+ 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
+
+ #clean up any ' or -
+ batch.gsub!('\'','')
+ batch.gsub!('-','_')
+
Chef::Log.debug batch
#write the content to a temp file
file "/tmp/chefzenbatch.batch" do
@@ -72,10 +98,10 @@
execute "zenbatchload" do
user "zenoss"
environment ({
- 'LD_LIBRARY_PATH' => "#{node[:zenoss][:server][:zenhome]}/lib",
- 'PYTHONPATH' => "#{node[:zenoss][:server][:zenhome]}/lib/python",
- 'ZENHOME' => node[:zenoss][:server][:zenhome]
- })
+ 'LD_LIBRARY_PATH' => "#{node[:zenoss][:server][:zenhome]}/lib",
+ 'PYTHONPATH' => "#{node[:zenoss][:server][:zenhome]}/lib/python",
+ 'ZENHOME' => node[:zenoss][:server][:zenhome]
+ })
command "#{node[:zenoss][:server][:zenhome]}/bin/zenbatchload /tmp/chefzenbatch.batch"
action :run
end
View
118 chef/cookbooks/zenoss/recipes/server.rb
@@ -24,20 +24,20 @@
case node[:platform]
when "centos","redhat","scientific"
include_recipe "yum"
-
+
yum_key "RPM-GPG-KEY-zenoss" do
url "http://dev.zenoss.com/yum/RPM-GPG-KEY-zenoss"
action :add
end
-
+
yum_repository "zenoss" do
description "Zenoss Stable repo"
key "RPM-GPG-KEY-zenoss"
url "http://dev.zenoss.com/yum/stable/"
failovermethod "priority"
action :add
end
-
+
packages = %w{mysql-server net-snmp net-snmp-utils gmp libgomp libgcj liberation-fonts}
packages.each do |pkg|
yum_package pkg do
@@ -59,27 +59,28 @@
end
yum_package "zenoss" do
+ arch node['kernel']['machine']
action :install
end
#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|
apt_package pkg do
action :install
end
end
-
+
#Zenoss hasn't signed their repository http://dev.zenoss.org/trac/ticket/7421
apt_package "zenoss-stack" do
version node["zenoss"]["server"]["version"]
@@ -90,8 +91,8 @@
end
-#apply post 3.1.0 patches from http://dev.zenoss.com/trac/report/6 marked 'closed'
-node["zenoss"]["server"]["zenpatches"].each do |patch, url|
+#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
@@ -106,7 +107,7 @@
when "redhat", "centos", "scientific"
service_name "zenoss"
end
- action [:enable, :start ]
+ action [:enable, :start ]
end
#skip the new install Wizard.
@@ -155,60 +156,56 @@
end
#this list should get appended by other recipes
-node["zenoss"]["server"]["installed_zenpacks"].each do |package, zpversion|
+node["zenoss"]["server"]["installed_zenpacks"].each do |package, zpversion|
zenoss_zenpack "#{package}" do
version zpversion
action :install
notifies :restart, resources(:service => "zenoss"), :immediate
end
end
-#find the roles and push their settings in via zendmd
-deviceclasslist = []
-locationlist = []
-grouplist = []
+#move the localhost to SSH monitoring since we're not using SNMP
+zenoss_zendmd "move Zenoss server" do
+ batch = "dev = dmd.Devices.findDevice('#{node[:fqdn]}')\n"
+ batch += "if not dev:\n"
+ batch += " dev = dmd.Devices.findDevice('localhost*')\n\n"
+ batch += "dev.changeDeviceClass('/Server/SSH/Linux')\n"
+ batch += "dev.setManageIp('#{node[:ipaddress]}')"
+ command batch
+ action :run
+end
+
+#find the roles and push their settings in via zenbatchload
+devices = {}
+locations = {}
+groups = {}
search(:role, "*:*").each do |role|
- if role.override_attributes["zenoss"] and role.override_attributes["zenoss"]["device"]
- if role.override_attributes["zenoss"]["device"]["device_class"]
+ if role.override_attributes['zenoss'] and role.override_attributes['zenoss']['device']
+ if role.override_attributes['zenoss']['device']['device_class']
#add the role as a Device Class
- deviceclasslist.push(role.name)
- zenoss_zendmd role.override_attributes["zenoss"]["device"]["device_class"] do
- description role.description
- modeler_plugins role.default_attributes["zenoss"]["device"]["modeler_plugins"]
- templates role.default_attributes["zenoss"]["device"]["templates"]
- properties role.default_attributes["zenoss"]["device"]["properties"]
- action :deviceclass
- end
- elsif role.override_attributes["zenoss"]["device"]["location"]
+ Chef::Log.debug "deviceclass from role:#{role.name}:#{role.override_attributes['zenoss']['device']['device_class']}"
+ devices[role.override_attributes['zenoss']['device']['device_class']] = {
+ 'description' => role.description,
+ 'modeler_plugins' => role.default_attributes['zenoss']['device']['modeler_plugins'],
+ 'templates' => role.default_attributes['zenoss']['device']['templates'],
+ 'properties' => role.default_attributes['zenoss']['device']['properties'],
+ 'nodes' => []
+ }
+ elsif role.override_attributes['zenoss']['device']['location']
#add the role as a Location
- locationlist.push(role.name)
- zenoss_zendmd role.name do
- location role.override_attributes["zenoss"]["device"]["location"]
- description role.description
- address role.override_attributes["zenoss"]["device"]["address"]
- action :location
- end
+ locations[role.name] = {
+ 'location' => role.override_attributes['zenoss']['device']['location'],
+ 'description' => role.description,
+ 'address' => role.override_attributes['zenoss']['device']['address']
+ }
end
else
#create Groups for the rest of the roles
- grouplist.push(role.name)
- zenoss_zendmd role.name do
- description role.description
- action :group
- end
+ groups[role.name] = {'description' => role.description}
end
end
-#move the localhost to SSH monitoring since we're not using SNMP
-zenoss_zendmd "move Zenoss server" do
- batch = "dmd.Devices.moveDevices('/Server/SSH/Linux/MySQL', '#{node[:fqdn]}')\n"
- batch += "dev = dmd.Devices.findDevice('#{node[:fqdn]}')\n"
- batch += "dev.setManageIp('#{node[:ipaddress]}')"
- command batch
- action :run
-end
-
-#all nodes (for now, until pick a role or other flag to standardize on)
+#all nodes with zenoss:device
nodes = search(:node, 'zenoss:device*') || []
#find the recipes and create Systems for them
systems = []
@@ -217,28 +214,29 @@
systems.uniq!
#make suborganizers with recipes
systems.collect! {|sys| sys.gsub('::', '/')}
-systems.each do |system|
- zenoss_zendmd system do
- action :system
- end
-end
-#using the nodes list, write out a zenbatchload
+
+#now that we have Device Classes, Systems, Groups and Locations zenbatchload
+#using the nodes list, write out a zenbatchload
#find all the device classes and the devices each one has.
-devices = {}
nodes.each do |node|
- if node.attribute["zenoss"] and node.attribute["zenoss"]["device"]
- dclass = node.attribute["zenoss"]["device"]["device_class"]
+ if node['zenoss'] and node['zenoss']['device']
+ dclass = node['zenoss']['device']['device_class']
if devices.has_key?(dclass)
- devices[dclass].push(node)
+ devices[dclass]['nodes'].push(node)
else
- devices[dclass] = [node]
+ Chef::Log.debug "deviceclass from node:#{dclass}"
+ devices[dclass] = {
+ 'nodes' => [node]
+ }
end
end
end
+
zenoss_zenbatchload "zenbatchloading devices" do
devices devices
- locations locationlist
- groups grouplist
+ systems systems
+ groups groups
+ locations locations
action :run
end
View
5 chef/cookbooks/zenoss/resources/zenbatchload.rb
@@ -1,5 +1,6 @@
actions :run
attribute :devices, :kind_of => Hash, :default => {}
-attribute :locations, :kind_of => Array, :default => []
-attribute :groups, :kind_of => Array, :default => []
+attribute :groups, :kind_of => Hash, :default => {}
+attribute :systems, :kind_of => Array, :default => []
+attribute :locations, :kind_of => Hash, :default => {}
View
6 chef/cookbooks/zenoss/roles/ZenossServer.rb
@@ -4,7 +4,7 @@
#you may want to set the [:zenoss][:server][:admin_password]
default_attributes(
"zenoss" => {
- "device" => {
+ "device" => {
"properties" => {
"zCommandUsername" => "zenoss",
"zKeyPath" => "/home/zenoss/.ssh/id_dsa",
@@ -17,8 +17,8 @@
override_attributes(
"zenoss" => {
- "device" => {
- "device_class" => "/Server/SSH/Linux/MySQL"
+ "device" => {
+ "device_class" => "/Server/SSH/Linux"
}
}
)
View
34 crowbar.yml
@@ -31,26 +31,26 @@ barclamp:
# another barclamp to provide some of its functionality.
# All barclamps implicitly rely on the crowbar barclamp.
requires:
- - another-barclamp # rely on a single other barclamp
- - @barclamp-group # rely on another group of barclamps.
+# - another-barclamp # rely on a single other barclamp
+# - @barclamp-group # rely on another group of barclamps.
# Member allows you to declare that this barclamp is a member
# of a group of related barclamp. A barclamp can be a member of
# muliple groups, and a group name can be used instead of a barclamp
# in a requires: clause by prefixing it with an @ sign.
member:
- - barclamp-group
- - another-barclamp-group
+# - barclamp-group
+# - another-barclamp-group
# Os_support allows you to declare that this barclamp only supports
# specific operating systems. If you don't have an os_support
# section, Crowbar will assume the barclamp works on all the operating
# systems it supports.
os_support:
- - redhat-5.6
+# - redhat-5.6
- ubuntu-10.10
crowbar:
layout: 1
- order: 1000
+ order: 100
proposal_schema_version: 2
nav:
@@ -79,13 +79,15 @@ debs:
# packages here -- if apt-get install gets all the dependencies, you do not
# need to list them here.
pkgs:
+ - ttf-liberation
+ - ttf-linux-libertine
# put your packages here
# - mod_fcgid
# raw_pkgs is a list of URLs to .deb packages that the build system will try
# to download and add to the iso. It does not do dependency checking, and
# it uses curl to handle the actual download process.
raw_pkgs:
- - http://your_site/your_special_deb.deb
+ - http://dev.zenoss.org/deb/dists/main/stable/binary-amd64/zenoss-stack_3.2.1_x64.deb
# You can have multiple OS specific sections as well. You can declare
# dependencies for repos, ppas, pkgs, and raw_pkgs here, and they will
# be picked up when building Crowbar on that OS.
@@ -100,17 +102,17 @@ rpms:
repos:
# rpm repos allow you to declare that you want to use a repo that
# is set up using an RPM. EPEL is a good example of such a repo.
- - rpm http://repo_addr/repo.rpm
+# - rpm http://repo_addr/repo.rpm
# bare allows you to declare that you want to use a repository that
# does not allow easy installation via rpm.
# It has a slightly more complex declaration:
# bare repo_name numeric_repo_priority repo_url
- - bare epel5-nagios3 10 http://repos.fedorapeople.org/repos/peter/nagios3/epel-5/x86_64/
+# - bare epel5-nagios3 10 http://repos.fedorapeople.org/repos/peter/nagios3/epel-5/x86_64/
pkgs:
# put your rpms here
# - httpd
raw_pkgs:
- - http://your_site/your_special_rpm.rpm
+# - http://your_site/your_special_rpm.rpm
# gems allows you to declare the gems you need.
# Unlike the other package types, you can ask for a specific version of a gem
@@ -120,8 +122,8 @@ rpms:
gems:
pkgs:
# put your gems here.
- - i18n
- - rails-2.3.12 # Will try and pull rails-2.3.12 exactly.
+# - i18n
+# - rails-2.3.12 # Will try and pull rails-2.3.12 exactly.
# extra_files downloads and saves a file to be slipstreamed on to the
# crowbar .iso in the extra/files directory (or a subdirectory thereof).
@@ -130,15 +132,15 @@ gems:
# .rpm files as if they were provided by raw_pkgs.
extra_files:
# will place file into extra/files
- - http://some/file
+# - http://some/file
# will place file into extra/files/foo
- - http://some/file foo
+# - http://some/file foo
# will place image.tar.gz in extra/files/ami.
# For backwards compatibility, it will also be available at /ami
- - http://some/amazon/image.tar.gz ami
+# - http://some/amazon/image.tar.gz ami
# Will download a java package and try to install its RPMS
# if bulding Crowbar staged on Redhat.
- - http://java.oracle.com/java-version-x64-rpm.bin java
+# - http://java.oracle.com/java-version-x64-rpm.bin java
locale_additions:

0 comments on commit 0e377ed

Please sign in to comment.
Something went wrong with that request. Please try again.