Permalink
Browse files

Updated nagios recipes

  • Loading branch information...
1 parent b1d0515 commit 8a60530491345841a0d92e5159a7fbf58205cb10 @mbailey committed Jul 10, 2011
Showing with 67 additions and 154 deletions.
  1. +3 −135 TODO.txt
  2. +2 −0 docs/nagios.txt
  3. +2 −17 lib/deprec/recipes/nagios.rb
  4. +44 −0 lib/deprec/recipes/rack.rb
  5. +16 −2 lib/deprec/templates/nagios/conf.d/services_nagios2.cfg
View
138 TODO.txt
@@ -1,138 +1,6 @@
deprec/TODO.txt
+===============
-+ cap deprec:network:hostname needs to actually run 'hostname'
-
-? How do we deal with different Passenger debs for hardy and lucid? 32 x 64?
-? How do we get config for Passenger when we're installing latest gem?
- - probably specify gem version of passenger
-
-# Mysql - delete initially created accounts
-# they stop 'mike'@'%' from working
-# http://bugs.mysql.com/bug.php?id=36576
-# http://dev.mysql.com/doc/refman/5.0/en/default-privileges.html
-DROP USER '';
-DROP USER ''@'localhost';
-
-
-# collectd
-+ start on boot (init.d)
-+ install php_collection
- - auth
- - update config.php
- ($config['datadirs'] = array('/usr/local/var/lib/collectd/');)
-+ nginx plugin
- - symlink lib on install
- - add nagios to collectd group (create group)
-+ apache plugin
- /etc/apache2/mods-available/status.conf ExtendedStatus On
-
-
-# nagios
-+ pull in commands, services, hostgroups from mon.failmode
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-* show downloads version/date # shows project not stale
-* email OMGWTFTOAST
-
-* mission
-* mailing list etiquette
-* bus factor 1
-* getting contributions
-
-use 'rake gems:install' instead of gems_for_project
-
+* new wordpress
+* get rid of run_method - s/send(run_method, "/run "#{sudo} /
* clean out stale tasks (from cap -T)
-
-* check for cdrom line in /etc/apt/sources.list
-# deb cdrom:[Ubuntu-Server 7.10 _Gutsy Gibbon_ - Release i386 (20071016)]/ gutsy main restricted
-
-== Milestone 1
-
-ssl problem "ssl_error_rx_record_too_long"
-- remove default site?
-
- sort out cert generation
-
- ensure this is installed
- NameVirtualHost *:80
-
- <IfModule mod_ssl.c>
- NameVirtualHost *:443
- </IfModule>
-
-
-
-== Milestone 2
-* make quieter
-* Stop double printing of tasks when linked to canonical name
-* unlink ree when normal ruby installed
-* check REE is unlinked when ruby-1.8.7 installed
-
-
-== Milestone 3
-
-
-
-
-
-# Chef
-
-# Install Server or Client
-
- # Make sure they're in DNS or chef-client will fail with the following:
- root@node1:/etc/chef# chef-client
- /registrations/node1
- /openid/consumer/start
- /usr/local/lib/ruby/1.8/net/http.rb:2097:in `error!': 400 "Bad Request" (Net::HTTPServerException)
- from /usr/local/lib/ruby/gems/1.8/gems/chef-0.7.0/lib/chef/rest.rb:233:in `run_request'
- from /usr/local/lib/ruby/gems/1.8/gems/chef-0.7.0/lib/chef/rest.rb:95:in `post_rest'
- from /usr/local/lib/ruby/gems/1.8/gems/chef-0.7.0/lib/chef/client.rb:223:in `authenticate'
- from /usr/local/lib/ruby/gems/1.8/gems/chef-0.7.0/lib/chef/client.rb:74:in `run'
- from /usr/local/lib/ruby/gems/1.8/gems/chef-0.7.0/lib/chef/application/client.rb:163:in `run_application'
- from /usr/local/lib/ruby/gems/1.8/gems/chef-0.7.0/lib/chef/application/client.rb:161:in `loop'
- from /usr/local/lib/ruby/gems/1.8/gems/chef-0.7.0/lib/chef/application/client.rb:161:in `run_application'
- from /usr/local/lib/ruby/gems/1.8/gems/chef-0.7.0/lib/chef/application.rb:53:in `run'
- from /usr/local/lib/ruby/gems/1.8/gems/chef-0.7.0/bin/chef-client:26
- from /usr/local/bin/chef-client:19:in `load'
- from /usr/local/bin/chef-client:19
-
-$ time cap deprec:chef:install HOSTS=chef2
-real 14m17.875s
-user 0m7.457s
-sys 0m7.979s
-
-! Server setup needs to restart/reload Apache for SSL cert to get picked up
-
-! client - unable to resolve node1 - need to put in /etc/hosts?
-
-client> sudo chef-client
-chef web: Registrations -> Validate Registration
-client> sudo chef-client
-
-
-# Chef repo
-git://github.com/mbailey/chef-repo.git
-
-! client start script
-? how do we push from server?
-? where does validation token come from?
-! 8.04.2 is worth considering
View
@@ -10,6 +10,8 @@ cap deprec:nagios:config
# servers to be monitored
cap deprec:nrpe:install
+cap deprec:nrpe:test_local # does nrpe query from local host
+cap deprec:nrpe:test_remote # does nrpe query from nagios server
# TODO
@@ -10,7 +10,6 @@
set(:nagios_admin_pass) { Capistrano::CLI.ui.ask "Enter password for nagiosadmin user" }
set :nagios_cmd_group, 'nagcmd' # Submit external commands through the web interface
set :nagios_htpasswd_file, '/usr/local/nagios/etc/htpasswd.users'
- # default :application, 'nagios'
SRC_PACKAGES[:nagios] = {
:url => "http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.3.tar.gz",
@@ -139,7 +138,7 @@
desc "Push nagios config files to server"
task :config, :roles => :nagios do
- default :application, 'nagios'
+ # default :application, 'nagios'
deprec2.push_configs(:nagios, SYSTEM_CONFIG_FILES[:nagios])
config_check
restart
@@ -150,20 +149,6 @@
send(run_method, "/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg")
end
- # desc "Set Nagios to start on boot"
- # task :activate, :roles => :nagios do
- # send(run_method, "update-rc.d nagios defaults")
- # sudo "a2ensite nagios"
- # top.deprec.apache.reload
- # end
- #
- # desc "Set Nagios to not start on boot"
- # task :deactivate, :roles => :nagios do
- # send(run_method, "update-rc.d -f nagios remove")
- # sudo "a2dissite nagios"
- # top.deprec.apache.reload
- # end
-
# Control
desc "Start Nagios"
@@ -232,7 +217,7 @@
namespace :nrpe do
- default :nrpe_enable_command_args, false # set to true to compile nrpe to accept arguments
+ set :nrpe_enable_command_args, false # set to true to compile nrpe to accept arguments
# note that you'll need to set it before these recipes are loaded (e.g. in .caprc)
SRC_PACKAGES[:nrpe] = {
View
@@ -0,0 +1,44 @@
+# Copyright 2006-2011 by Mike Bailey. All rights reserved.
+Capistrano::Configuration.instance(:must_exist).load do
+ namespace :deprec do
+ namespace :rack do
+
+ set :rack_env, 'production'
+
+ desc "Install Rack stack on Ubuntu server (8.04, 10.04)"
+ task :install_stack do
+ top.deprec.git.install
+ top.deprec.ruby.install # Uses ruby_vm_type
+ gem2.install 'bundler'
+ # Some things Rails needs
+ apt.install( { :base => %w(libmysqlclient15-dev sqlite3 libsqlite3-ruby libsqlite3-dev libpq-dev) }, :stable)
+
+ top.deprec.web.install # Uses web_server_type
+ top.deprec.app.install # Uses app_server_type
+ # top.deprec.rails.install
+ top.deprec.logrotate.install
+ # top.deprec.monit.install # Not using monit lately
+ end
+
+ desc "Generate config files for rack app."
+ task :config_gen do
+ top.deprec.web.config_gen_project
+ top.deprec.app.config_gen_project
+ end
+
+ desc "Push out config files for rack app."
+ task :config do
+ top.deprec.web.config_project
+ top.deprec.app.config_project
+ end
+
+ desc "Install debs listed in :packages_for_project"
+ task :install_packages, :roles => :app do
+ if packages_for_project
+ apt.install({ :base => packages_for_project }, :stable)
+ end
+ end
+
+ end
+ end
+end
@@ -20,12 +20,26 @@ define service{
use generic-service
hostgroup_name linux-servers
service_description CPU load
- check_command check_nrpe!check_load
+ check_command check_nrpe_1arg!check_load
}
define service{
use generic-service
hostgroup_name linux-servers
service_description Check All Disks
- check_command check_nrpe!check_all_disks
+ check_command check_nrpe_1arg!check_all_disks
+}
+
+define service{
+ use generic-service
+ hostgroup_name linux-servers
+ service_description Check Memory
+ check_command check_nrpe_1arg!check_mem
+}
+
+define service{
+ use generic-service
+ hostgroup_name linux-servers
+ service_description Check Swap
+ check_command check_nrpe_1arg!check_swap
}

0 comments on commit 8a60530

Please sign in to comment.