Permalink
Browse files

moving icinga to a submodule to its own repo

  • Loading branch information...
mdxp committed Jan 25, 2012
1 parent 0879ede commit f4cf966d8415789292829393c06c1c83b97dcdc6
View
@@ -1,8 +0,0 @@
-= DESCRIPTION:
-
-= REQUIREMENTS:
-
-= ATTRIBUTES:
-
-= USAGE:
-
@@ -1,40 +0,0 @@
-default['icinga']['version'] = "1.4.2"
-default['icinga']['checksum'] = "506022493295bda95aa2514bfdc3196063ed936655bc60068f61543504b42aa6"
-default['icinga']['prefix'] = "/usr/local/icinga"
-
-default['icinga']['sysadmin_email'] = "root@localhost"
-default['icinga']['sysadmin_sms_email'] = "root@localhost"
-
-default['icinga']['user'] = "nagios"
-default['icinga']['group'] = "nagios"
-
-default['icinga']['server_role'] = "monitoring"
-default['icinga']['notifications_enabled'] = 0
-default['icinga']['check_external_commands'] = true
-default['icinga']['default_contact_groups'] = %w(admins)
-default['icinga']['sysadmin'] = "sysadmin"
-
-set['icinga']['conf_dir'] = node['icinga']['prefix'] + "/etc"
-set['icinga']['config_dir'] = node['icinga']['conf_dir'] + "/conf.d"
-set['icinga']['log_dir'] = node['icinga']['prefix'] + "/var"
-set['icinga']['cache_dir'] = node['icinga']['log_dir']
-set['icinga']['state_dir'] = node['icinga']['log_dir']
-set['icinga']['run_dir'] = node['icinga']['log_dir']
-set['icinga']['docroot'] = node['icinga']['prefix'] + "/share/"
-
-# This setting is effectively sets the minimum interval (in seconds) icinga can handle.
-# Other interval settings provided in seconds will calculate their actual from this value, since icinga works in 'time units' rather than allowing definitions everywhere in seconds
-
-default['icinga']['templates'] = Mash.new
-default['icinga']['interval_length'] = 1
-
-# Provide all interval values in seconds
-default['icinga']['default_host']['check_interval'] = 15
-default['icinga']['default_host']['retry_interval'] = 15
-default['icinga']['default_host']['max_check_attempts'] = 1
-default['icinga']['default_host']['notification_interval'] = 300
-
-default['icinga']['default_service']['check_interval'] = 60
-default['icinga']['default_service']['retry_interval'] = 15
-default['icinga']['default_service']['max_check_attempts'] = 3
-default['icinga']['default_service']['notification_interval'] = 1200
@@ -1,2 +0,0 @@
-set['icinga']['plugin_dir'] = "/usr/lib/nagios/plugins"
-
@@ -1,12 +0,0 @@
-define :icinga_conf, :variables => {}, :config_subdir => true do
- conf_dir = params[:config_subdir] ? node['icinga']['config_dir'] : node['icinga']['conf_dir']
- template "#{conf_dir}/#{params[:name]}.cfg" do
- owner "#{node['icinga']['user']}"
- group "#{node['icinga']['group']}"
- source "#{params[:name]}.cfg.erb"
- mode 0644
- variables params[:variables]
- notifies :restart, "service[icinga]"
- backup 0
- end
-end
@@ -1,15 +0,0 @@
-def icinga_boolean(true_or_false)
- true_or_false ? "1" : "0"
-end
-
-def icinga_interval(seconds)
- if seconds.to_i < node['icinga']['interval_length'].to_i
- raise ArgumentError, "Specified icinga interval of #{seconds} seconds must be equal to or greater than the default interval length of #{node['icinga']['interval_length']}"
- end
- interval = seconds / node['icinga']['interval_length']
- interval
-end
-
-def icinga_attr(name)
- node['icinga'][name]
-end
View
@@ -1,15 +0,0 @@
-maintainer "Promet Solutions"
-maintainer_email "marius@promethost.com"
-license "Apache 2.0"
-description "Installs/Configures Icinga"
-long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc'))
-version "0.1.0"
-
-%w{ apache2 build-essential }.each do |cb|
- depends cb
-end
-
-%w{ ubuntu debian }.each do |os|
- supports os
-end
-
@@ -1,78 +0,0 @@
-#
-# Author:: Marius Ducea (marius@promethost.com)
-# Cookbook Name:: icinga
-# Recipe:: core_source
-#
-# Copyright 2010-2011, Promet Solutions
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-# Install required packages
-include_recipe "build-essential"
-
-%w{ libgd2-xpm-dev libjpeg62-dev libpng12-dev libdbi0-dev snmp libsnmp-dev }.each do |pkg|
- package pkg
-end
-
-version = node['icinga']['version']
-iuser = node['icinga']['user']
-igroup = node['icinga']['group']
-
-# Download icinga core source
-remote_file "#{Chef::Config[:file_cache_path]}/icinga-#{version}.tar.gz" do
- source "http://downloads.sourceforge.net/project/icinga/icinga/#{version}/icinga-#{version}.tar.gz"
- checksum node['icinga']['checksum']
- action :create_if_missing
-end
-
-# icinga user/groups
-user "#{iuser}" do
- comment "Icinga user"
- shell "/bin/false"
-end
-group "#{igroup}" do
- members [ iuser, node['apache']['user'] ]
-end
-
-# Compile & install icinga
-bash "compile-install-icinga" do
- cwd Chef::Config[:file_cache_path]
- user "root"
- code <<-EOH
- tar -zxf icinga-#{version}.tar.gz && \
- cd icinga-#{version} && \
- ./configure --with-icinga-user=#{iuser} --with-icinga-group=#{igroup} --with-nagios-user=#{iuser} --with-nagios-group=#{igroup} \
- --with-command-user=#{iuser} --with-command-group=#{igroup} --prefix #{node['icinga']['prefix']} --enable-idoutils --enable-ssl && \
- make all && \
- make fullinstall
- EOH
- creates "#{node['icinga']['prefix']}/bin/icinga"
-end
-
-directory "#{node['icinga']['config_dir']}" do
- owner node['icinga']['user']
- group node['icinga']['group']
- mode "0755"
-end
-
-%w{ icinga cgi resource }.each do |conf|
- icinga_conf conf do
- config_subdir false
- end
-end
-
-%w{ commands templates timeperiods}.each do |conf|
- icinga_conf conf
-end
-
View
@@ -1,23 +0,0 @@
-#
-# Author:: Marius Ducea (marius@promethost.com)
-# Cookbook Name:: icinga
-# Recipe:: default
-#
-# Copyright 2010-2011, Promet Solutions
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-include_recipe "icinga::plugins_package"
-include_recipe "icinga::server"
-
@@ -1,26 +0,0 @@
-#
-# Author:: Marius Ducea (marius@promethost.com)
-# Cookbook Name:: icinga
-# Recipe:: plugins_package
-#
-# Copyright 2010-2011, Promet Solutions
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-%w{ nagios-plugins nagios-plugins-basic nagios-plugins-standard }.each do |pkg|
- package pkg
-end
-
-package "nagios-nrpe-plugin"
-
View
@@ -1,101 +0,0 @@
-#
-# Author:: Marius Ducea (marius@promethost.com)
-# Cookbook Name:: icinga
-# Recipe:: server
-#
-# Copyright 2010-2011, Promet Solutions
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-include_recipe "apache2"
-include_recipe "apache2::mod_ssl"
-include_recipe "apache2::mod_rewrite"
-include_recipe "icinga::plugins_package"
-include_recipe "icinga::core_source"
-
-sysadmins = search(:users, "groups:#{node['icinga']['sysadmin']}")
-nodes = search(:node, "hostname:[* TO *] AND chef_environment:#{node.chef_environment}")
-
-if nodes.empty?
- Chef::Log.info("No nodes returned from search, using this node so hosts.cfg has data")
- nodes = Array.new
- nodes << node
-end
-
-members = Array.new
-sysadmins.each do |s|
- members << s['id']
-end
-
-role_list = Array.new
-service_hosts= Hash.new
-search(:role, "*:*") do |r|
- role_list << r.name
- search(:node, "role:#{r.name} AND chef_environment:#{node.chef_environment}") do |n|
- service_hosts[r.name] = n['hostname']
- end
-end
-
-if node['public_domain']
- public_domain = node['public_domain']
-else
- public_domain = node['domain']
-end
-
-template "#{node['icinga']['conf_dir']}/htpasswd.users" do
- source "htpasswd.users.erb"
- owner node['icinga']['user']
- group node['apache']['user']
- mode 0640
- variables(
- :sysadmins => sysadmins
- )
-end
-
-apache_site "000-default" do
- enable false
-end
-
-template "#{node['apache']['dir']}/sites-available/icinga.conf" do
- source "apache2.conf.erb"
- mode 0644
- variables :public_domain => public_domain
- if ::File.symlink?("#{node['apache']['dir']}/sites-enabled/icinga.conf")
- notifies :reload, "service[apache2]"
- end
-end
-
-apache_site "icinga.conf"
-
-icinga_conf "services" do
- variables :service_hosts => service_hosts
-end
-
-icinga_conf "contacts" do
- variables :admins => sysadmins, :members => members
-end
-
-icinga_conf "hostgroups" do
- variables :roles => role_list
-end
-
-icinga_conf "hosts" do
- variables :nodes => nodes
-end
-
-service "icinga" do
- supports :status => true, :restart => true, :reload => true
- action [ :enable, :start ]
-end
-
@@ -1,42 +0,0 @@
-<VirtualHost *:80>
- ServerAdmin <%= node['icinga']['sysadmin_email'] %>
- ServerName <%= node[:fqdn] %>
- ServerAlias icinga icinga.<%= node.chef_environment =~ /^_default$/ ? "default" : node.chef_environment%>.<%= @public_domain %> icinga.<%= @public_domain %>
- DocumentRoot <%= node['icinga']['docroot'] %>
- CustomLog <%= node['icinga']['log_dir'] %>/apache_access.log combined
- ErrorLog <%= node['icinga']['log_dir'] %>/apache_error.log
-
- ScriptAlias /icinga/cgi-bin "/usr/local/icinga/sbin"
- Alias /icinga <%= node['icinga']['docroot'] %>
-
- <Directory "/usr/local/icinga/sbin">
- # SSLRequireSSL
- Options ExecCGI
- AllowOverride None
- Order allow,deny
- Allow from all
- # Order deny,allow
- # Deny from all
- # Allow from 127.0.0.1
- AuthName "Icinga Access"
- AuthType Basic
- AuthUserFile "<%= node['icinga']['conf_dir'] %>/htpasswd.users"
- Require valid-user
- </Directory>
-
- <Directory "<%= node['icinga']['conf_dir'] %>">
- # SSLRequireSSL
- Options None
- AllowOverride All
- Order allow,deny
- Allow from all
- # Order deny,allow
- # Deny from all
- # Allow from 127.0.0.1
- AuthName "Icinga Access"
- AuthType Basic
- AuthUserFile "<%= node['icinga']['conf_dir'] %>/htpasswd.users"
- Require valid-user
- </Directory>
-</VirtualHost>
-
Oops, something went wrong.

0 comments on commit f4cf966

Please sign in to comment.