deprec 2.0.15 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. data/CHANGELOG +7 -1
  2. data/lib/deprec/capistrano_extensions.rb +1 -1
  3. data/lib/deprec/recipes/collectd.rb +60 -79
  4. data/lib/deprec/recipes/haproxy.rb +105 -0
  5. data/lib/deprec/recipes/nagios.rb +90 -72
  6. data/lib/deprec/recipes/postfix.rb +1 -1
  7. data/lib/deprec/recipes/ssh.rb +1 -1
  8. data/lib/deprec/recipes/syslog.rb +63 -0
  9. data/lib/deprec/recipes/utils.rb +1 -1
  10. data/lib/deprec/recipes_minus_rails.rb +2 -0
  11. data/lib/deprec/templates/collectd/collectd.conf.erb +686 -0
  12. data/lib/deprec/templates/nagios/{cgi.cfg → cgi.cfg.erb} +27 -2
  13. data/lib/deprec/templates/nagios/htpasswd.users +1 -0
  14. data/lib/deprec/templates/nagios/{nagios.cfg → nagios.cfg.erb} +35 -7
  15. data/lib/deprec/templates/nagios/nrpe.cfg.erb +15 -3
  16. data/lib/deprec/templates/nagios/nrpe.xinetd.erb +1 -1
  17. data/lib/deprec/templates/nagios/objects/{commands.cfg → commands.cfg.erb} +27 -2
  18. data/lib/deprec/templates/nagios/objects/{contacts.cfg → contacts.cfg.erb} +23 -0
  19. data/lib/deprec/templates/nagios/{hosts.cfg.erb → objects/hosts.cfg.erb} +30 -54
  20. data/lib/deprec/templates/{old → nagios/objects}/localhost.cfg.erb +0 -41
  21. data/lib/deprec/templates/nagios/{services.cfg.erb → objects/services.cfg.erb} +88 -2
  22. data/lib/deprec/templates/{old → nagios/objects}/timeperiods.cfg.erb +0 -0
  23. data/lib/deprec/templates/{old → nagios}/resource.cfg.erb +1 -1
  24. data/lib/deprec/templates/syslog/syslog.conf.erb +71 -0
  25. data/lib/deprec/templates/syslog/syslogd.erb +13 -0
  26. metadata +16 -22
  27. data/lib/deprec/templates/nagios/objects/localhost.cfg +0 -157
  28. data/lib/deprec/templates/nagios/objects/templates.cfg +0 -190
  29. data/lib/deprec/templates/nagios/objects/timeperiods.cfg +0 -94
  30. data/lib/deprec/templates/nagios/resource.cfg +0 -34
  31. data/lib/deprec/templates/nagios_config.tgz +0 -0
  32. data/lib/deprec/templates/old/apache_vhost.erb +0 -45
  33. data/lib/deprec/templates/old/cgi.cfg.erb +0 -321
  34. data/lib/deprec/templates/old/commands.cfg.erb +0 -240
  35. data/lib/deprec/templates/old/contacts.cfg.erb +0 -57
  36. data/lib/deprec/templates/old/htpasswd.users +0 -1
  37. data/lib/deprec/templates/old/templates.cfg.erb +0 -9
data/CHANGELOG CHANGED
@@ -1,4 +1,10 @@
1
- == git
1
+ # deprec changelog
2
+
3
+ = 2.1.0 (Aug 24, 2009)
4
+
5
+ * Added Collectd
6
+ * Added Syslog
7
+ * Updated Nagios to 3.2.0
2
8
 
3
9
  == 2.0.15 (August 10, 2009)
4
10
 
@@ -314,10 +314,10 @@ module Deprec2
314
314
 
315
315
  # install package from source
316
316
  def install_from_src(src_package, src_dir)
317
+ set_package_defaults(src_package)
317
318
  package_dir = File.join(src_dir, src_package[:dir])
318
319
  unpack_src(src_package, src_dir)
319
320
  apt.install( {:base => %w(build-essential)}, :stable )
320
- # XXX replace with invoke_command
321
321
  sudo <<-SUDO
322
322
  sh -c '
323
323
  cd #{package_dir};
@@ -3,31 +3,18 @@ Capistrano::Configuration.instance(:must_exist).load do
3
3
  namespace :deprec do
4
4
  namespace :collectd do
5
5
 
6
- # latest rrdtool
7
- # apt-get install intltool
8
- # wget http://oss.oetiker.ch/rrdtool/pub/rrdtool.tar.gz
9
- # tar zxf rrdtool.tar.gz
10
- # cd rrdtool
11
- # ./configure --prefix=/usr/local
12
- # make
13
- # sudo make install
6
+ set(:collectd_server) { Capistrano::CLI.ui.ask 'Enter Collectd server hostname' }
7
+
8
+ # XXX master only
9
+ # Update libdir for libcollectdclient.so.0
10
+ # collectd-nagios is not finding it in /usr/local/lib
14
11
  #
15
- # wget http://oss.oetiker.ch/rrdtool/pub/contrib/ruby-rrd-1.1.tar.gz
16
- # tar zxf ruby-rrd-1.1.tar.gz
17
- # cd ruby-rrd-1.1
18
- # ruby extconf.rb
19
- # make
20
- # make install
21
-
22
- # Ruby bindings
23
- # RRD.so
24
-
25
-
12
+ # Copy collection-php to /var/www/collectd
26
13
 
27
14
  SRC_PACKAGES[:collectd] = {
28
- :url => "http://collectd.org/files/collectd-4.7.1.tar.gz",
29
- :md5sum => "9ec7f111e74dc55ad2aa9fcc11b8221c collectd-4.7.1.tar.gz",
30
- :configure => "./configure --prefix=/usr/local"
15
+ :url => "http://collectd.org/files/collectd-4.7.2.tar.gz",
16
+ :md5sum => "893c7a861b7a4a591188d9468622d89d collectd-4.7.2.tar.gz",
17
+ :configure => "./configure --prefix=/usr/local;"
31
18
  }
32
19
 
33
20
  desc "Install collectd"
@@ -37,76 +24,70 @@ Capistrano::Configuration.instance(:must_exist).load do
37
24
  deprec2.install_from_src(SRC_PACKAGES[:collectd], src_dir)
38
25
  end
39
26
 
40
- # install dependencies for nginx
27
+ # install dependencies for sysklogd
41
28
  task :install_deps do
42
29
  apt.install( {:base => %w(liboping-dev libperl-dev libdbi0-dev libesmtp-dev libganglia1-dev libmemcache-dev libnet1-dev libnotify-dev libopenipmi-dev liboping-dev libpcap-dev libperl-dev librrd2-dev libsensors-dev libstatgrab-dev nut-dev libvirt-dev)}, :stable )
43
30
  apt.install( {:base => %w(rrdtool librrd2-dev librrds-perl libconfig-general-perl libhtml-parser-perl libregexp-common-perl)}, :stable )
44
31
  end
45
32
 
46
- # "Start git server in local directory"
47
- task :serve do
48
- cmd = "git-daemon --verbose --port=#{git_port} --base-path=#{Dir.pwd} --base-path-relaxed"
49
- puts cmd
50
- `#{cmd}`
51
- end
52
-
53
- desc "Create git repos for current dir"
54
- task :init do
55
- `git init`
56
- create_gitignore
57
- create_files_in_empty_dirs
58
- `git add . && git commit -m 'initial import'`
33
+ SYSTEM_CONFIG_FILES[:collectd] = [
34
+
35
+ {:template => "collectd.conf.erb",
36
+ :path => '/usr/local/etc/collectd.conf',
37
+ :mode => 0640,
38
+ :owner => 'root:root'},
39
+
40
+ ]
41
+
42
+ desc "Generate Collectd configs"
43
+ task :config_gen do
44
+ SYSTEM_CONFIG_FILES[:collectd].each do |file|
45
+ deprec2.render_template(:collectd, file)
46
+ end
59
47
  end
60
-
61
- task :create_gitignore do
62
- system("echo '.DS_Store' >> .gitignore") # files sometimes created by OSX
63
- system("echo 'log/*' >> .gitignore") if File.directory?('log')
64
- system("echo 'tmp/**/*' >> .gitignore") if File.directory?('tmp')
48
+
49
+ desc "Push Chef config files (system & project level) to server"
50
+ task :config, :roles => :all_hosts, :except => {:collectd_master => true} do
51
+ deprec2.push_configs(:collectd, SYSTEM_CONFIG_FILES[:collectd])
52
+ restart
65
53
  end
66
-
67
- task :create_files_in_empty_dirs do
68
- %w(log tmp).each { |dir|
69
- system("touch #{dir}/.gitignore") if File.directory?(dir)
70
- }
54
+
55
+ desc "Start collectd"
56
+ task :start, :roles => :all_hosts, :except => { :collectd_master => true } do
57
+ run "#{sudo} collectd"
71
58
  end
72
59
 
73
- desc "Create remote origin for current dir"
74
- task :create_remote_origin do
75
- File.directory?('.git') || init
76
-
77
- # Push to remote git repo
78
- hostname = capture "echo $CAPISTRANO:HOST$"
79
- system "git remote add origin git@#{hostname.chomp}:#{application}"
80
- system "git push origin master:refs/heads/master"
81
-
82
- puts
83
- puts "New remote Git repo: #{git_user}@#{hostname.chomp}:#{application}"
84
- puts
85
-
86
- # File.open('.git/config', 'w') do |c|
87
- # c.write 'Add the following to .git/config'
88
- # c.write '[branch "master"]'
89
- # c.write ' remote = origin'
90
- # c.write ' merge = refs/heads/master'
91
- # end
92
-
93
- end
94
-
95
- # Create root dir for git repositories
96
- task :create_git_root do
97
- deprec2.mkdir(git_root, :mode => 02775, :owner => git_user, :group => git_group, :via => :sudo)
98
- sudo "chmod -R g+w #{git_root}"
60
+ desc "Stop collectd"
61
+ task :stop, :roles => :all_hosts, :except => { :collectd_master => true } do
62
+ run "#{sudo} killall collectd; exit 0;"
99
63
  end
100
64
 
101
- # regenerate git authorized keys file from users file in same dir
102
- task :regenerate_authorized_keys do
103
- sudo "echo '' > #{git_keys_file}"
104
- sudo "for file in `ls #{git_keys_file}-*`; do cat $file >> #{git_keys_file}; echo \"\n\" >> #{git_keys_file} ; done"
105
- sudo "chown #{git_user}.#{git_group} #{git_keys_file}"
106
- sudo "chmod 0600 #{git_keys_file}"
65
+ desc "Restart collectd"
66
+ task :restart, :roles => :all_hosts, :except => { :collectd_master => true } do
67
+ stop
68
+ start
107
69
  end
108
70
 
109
-
110
71
  end
72
+
111
73
  end
112
74
  end
75
+
76
+ # latest rrdtool
77
+ # apt-get install intltool
78
+ # wget http://oss.oetiker.ch/rrdtool/pub/rrdtool.tar.gz
79
+ # tar zxf rrdtool.tar.gz
80
+ # cd rrdtool
81
+ # ./configure --prefix=/usr/local
82
+ # make
83
+ # sudo make install
84
+ #
85
+ # wget http://oss.oetiker.ch/rrdtool/pub/contrib/ruby-rrd-1.1.tar.gz
86
+ # tar zxf ruby-rrd-1.1.tar.gz
87
+ # cd ruby-rrd-1.1
88
+ # ruby extconf.rb
89
+ # make
90
+ # make install
91
+
92
+ # Ruby bindings
93
+ # RRD.so
@@ -0,0 +1,105 @@
1
+ # # Copyright 2006-2009 by Mike Bailey. All rights reserved.
2
+ # Capistrano::Configuration.instance(:must_exist).load do
3
+ # namespace :deprec do
4
+ # namespace :haproxy do
5
+ #
6
+ # SRC_PACKAGES[:haproxy] = {
7
+ # :md5sum => "e37046e0cb2f407d92c41d7731d1dd10 haproxy-1.3.20.tar.gz",
8
+ # :url => "http://haproxy.1wt.eu/download/1.3/src/haproxy-1.3.20.tar.gz"
9
+ # }
10
+ #
11
+ # desc "Install haproxy"
12
+ # task :install do
13
+ # install_deps
14
+ # deprec2.download_src(SRC_PACKAGES[:haproxy], src_dir)
15
+ # deprec2.install_from_src(SRC_PACKAGES[:haproxy], src_dir)
16
+ # end
17
+ #
18
+ # task :install_deps do
19
+ # apt.install( {:base => %w(build-essential)}, :stable )
20
+ # end
21
+ #
22
+ # SYSTEM_CONFIG_FILES[:haproxy] = [
23
+ #
24
+ # # {:template => "example.conf.erb",
25
+ # # :path => '/etc/example/example.conf',
26
+ # # :mode => 0755,
27
+ # # :owner => 'root:root'}
28
+ #
29
+ # ]
30
+ #
31
+ # PROJECT_CONFIG_FILES[:haproxy] = [
32
+ #
33
+ # # {:template => "example.conf.erb",
34
+ # # :path => 'conf/example.conf',
35
+ # # :mode => 0755,
36
+ # # :owner => 'root:root'}
37
+ # ]
38
+ #
39
+ #
40
+ # desc "Generate configuration file(s) for XXX from template(s)"
41
+ # task :config_gen do
42
+ # config_gen_system
43
+ # config_gen_project
44
+ # end
45
+ #
46
+ # task :config_gen_system do
47
+ # SYSTEM_CONFIG_FILES[:haproxy].each do |file|
48
+ # deprec2.render_template(:haproxy, file)
49
+ # end
50
+ # end
51
+ #
52
+ # task :config_gen_project do
53
+ # PROJECT_CONFIG_FILES[:haproxy].each do |file|
54
+ # deprec2.render_template(:haproxy, file)
55
+ # end
56
+ # end
57
+ #
58
+ # desc 'Deploy configuration files(s) for XXX'
59
+ # task :config, :roles => :web do
60
+ # config_system
61
+ # config_project
62
+ # end
63
+ #
64
+ # task :config_system, :roles => :web do
65
+ # deprec2.push_configs(:haproxy, SYSTEM_CONFIG_FILES[:haproxy])
66
+ # end
67
+ #
68
+ # task :config_project, :roles => :web do
69
+ # deprec2.push_configs(:haproxy, PROJECT_CONFIG_FILES[:haproxy])
70
+ # end
71
+ #
72
+ #
73
+ # task :start, :roles => :web do
74
+ # run "#{sudo} /etc/init.d/haproxy start"
75
+ # end
76
+ #
77
+ # task :stop, :roles => :web do
78
+ # run "#{sudo} /etc/init.d/haproxy stop"
79
+ # end
80
+ #
81
+ # task :restart, :roles => :web do
82
+ # run "#{sudo} /etc/init.d/haproxy restart"
83
+ # end
84
+ #
85
+ # task :reload, :roles => :web do
86
+ # run "#{sudo} /etc/init.d/haproxy reload"
87
+ # end
88
+ #
89
+ # task :activate, :roles => :web do
90
+ # run "#{sudo} update-rc.d haproxy defaults"
91
+ # end
92
+ #
93
+ # task :deactivate, :roles => :web do
94
+ # run "#{sudo} update-rc.d -f haproxy remove"
95
+ # end
96
+ #
97
+ # task :backup, :roles => :web do
98
+ # end
99
+ #
100
+ # task :restore, :roles => :web do
101
+ # end
102
+ #
103
+ # end
104
+ # end
105
+ # end
@@ -6,47 +6,50 @@ Capistrano::Configuration.instance(:must_exist).load do
6
6
  set :nagios_user, 'nagios'
7
7
  set :nagios_group, 'nagios'
8
8
  set(:nagios_host) { Capistrano::CLI.ui.ask "Enter hostname of nagios server" }
9
+ set(:nagios_ip) { Capistrano::CLI.ui.ask "Enter ip address of nagios server" }
9
10
  set(:nagios_admin_pass) { Capistrano::CLI.ui.ask "Enter password for nagiosadmin user" }
10
11
  set :nagios_cmd_group, 'nagcmd' # Submit external commands through the web interface
11
12
  set :nagios_htpasswd_file, '/usr/local/nagios/etc/htpasswd.users'
12
13
  # default :application, 'nagios'
13
14
 
14
15
  SRC_PACKAGES[:nagios] = {
15
- :url => "http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.0.6.tar.gz",
16
- :md5sum => "900e3f4164f4b2a18485420eeaefe812 nagios-3.0.6.tar.gz",
17
- :configure => %w(
18
- ./configure
19
- --with-command-group=nagcmd
20
- ;
21
- ).reject{|arg| arg.match '#'}.join(' '),
16
+ :url => "http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.0.tar.gz",
17
+ :md5sum => "3566167cc60ddeaad34e7d2e26ed4a58 nagios-3.2.0.tar.gz",
18
+ :configure => "./configure --with-command-group=nagcmd;",
22
19
  :make => 'make all;',
23
- :install => 'make fullinstall'
20
+ :install => 'make install install-init install-commandmode install-webconf;'
24
21
  }
25
22
 
26
- task :install_all do
23
+ desc "Install and configure Nagios server"
24
+ task :setup_server, :roles => :nagios do
27
25
  install
26
+ top.deprec.nagios_plugins.install
27
+ top.deprec.nrpe.install
28
28
  config_gen
29
- htpass
30
29
  config
31
30
  end
32
31
 
32
+ desc "Setup client"
33
+ task :setup_client do
34
+ top.deprec.nagios_plugins.install
35
+ top.deprec.nrpe.install
36
+ top.deprec.nrpe.config
37
+ end
38
+
33
39
  desc "Install nagios"
34
- task :install do
40
+ task :install, :roles => :nagios do
35
41
  install_deps
36
42
  create_nagios_user
37
- # deprec2.mkdir('/usr/local/nagios/etc', :owner => "#{nagios_user}.#{nagios_group}", :via => :sudo)
38
- # deprec2.mkdir('/usr/local/nagios/objects', :owner => "#{nagios_user}.#{nagios_group}", :via => :sudo)
39
43
  deprec2.download_src(SRC_PACKAGES[:nagios], src_dir)
40
44
  deprec2.install_from_src(SRC_PACKAGES[:nagios], src_dir)
41
- activate
42
45
  end
43
46
 
44
47
  # Install dependencies for nagios
45
- task :install_deps do
46
- apt.install( {:base => %w(mailx)}, :stable )
48
+ task :install_deps, :roles => :nagios do
49
+ apt.install( {:base => %w(apache2 mailx postfix libapache2-mod-php5 libgd2-xpm-dev)}, :stable )
47
50
  end
48
51
 
49
- task :create_nagios_user do
52
+ task :create_nagios_user, :roles => :nagios do
50
53
  deprec2.groupadd(nagios_group)
51
54
  deprec2.useradd(nagios_user, :group => nagios_group, :homedir => false)
52
55
  # deprec2.add_user_to_group(nagios_user, apache_user)
@@ -76,6 +79,16 @@ Capistrano::Configuration.instance(:must_exist).load do
76
79
 
77
80
  SYSTEM_CONFIG_FILES[:nagios] = [
78
81
 
82
+ {:template => 'cgi.cfg.erb',
83
+ :path => '/usr/local/nagios/etc/cgi.cfg',
84
+ :mode => 0664,
85
+ :owner => 'nagios:nagios'},
86
+
87
+ {:template => 'htpasswd.users',
88
+ :path => '/usr/local/nagios/etc/htpasswd.users',
89
+ :mode => 0660,
90
+ :owner => 'nagios:www-data'},
91
+
79
92
  {:template => 'nagios.cfg.erb',
80
93
  :path => '/usr/local/nagios/etc/nagios.cfg',
81
94
  :mode => 0664,
@@ -86,50 +99,35 @@ Capistrano::Configuration.instance(:must_exist).load do
86
99
  :mode => 0660,
87
100
  :owner => 'nagios:nagios'},
88
101
 
89
- {:template => 'cgi.cfg.erb',
90
- :path => '/usr/local/nagios/etc/cgi.cfg',
102
+ {:template => 'objects/commands.cfg.erb',
103
+ :path => '/usr/local/nagios/etc/objects/commands.cfg',
91
104
  :mode => 0664,
92
105
  :owner => 'nagios:nagios'},
93
106
 
94
- {:template => 'htpasswd.users',
95
- :path => '/usr/local/nagios/etc/htpasswd.users',
96
- :mode => 0660,
107
+ {:template => 'objects/contacts.cfg.erb',
108
+ :path => '/usr/local/nagios/etc/objects/contacts.cfg',
109
+ :mode => 0664,
97
110
  :owner => 'nagios:nagios'},
98
111
 
99
- {:template => 'objects/commands.cfg',
100
- :path => '/usr/local/nagios/etc/objects/commands.cfg',
112
+ {:template => 'objects/hosts.cfg.erb',
113
+ :path => '/usr/local/nagios/etc/objects/hosts.cfg',
101
114
  :mode => 0664,
102
- :owner => 'nagios:nagios'}# ,
115
+ :owner => 'nagios:nagios'},
116
+
117
+ {:template => 'objects/localhost.cfg.erb',
118
+ :path => '/usr/local/nagios/etc/objects/localhost.cfg',
119
+ :mode => 0664,
120
+ :owner => 'nagios:nagios'},
121
+
122
+ {:template => 'objects/services.cfg.erb',
123
+ :path => '/usr/local/nagios/etc/objects/services.cfg',
124
+ :mode => 0664,
125
+ :owner => 'nagios:nagios'},
103
126
 
104
- # {:template => 'contacts.cfg.erb',
105
- # :path => '/usr/local/nagios/etc/objects/contacts.cfg',
106
- # :mode => 0664,
107
- # :owner => 'nagios:nagios'},
108
- #
109
- # {:template => 'localhost.cfg.erb',
110
- # :path => '/usr/local/nagios/etc/objects/localhost.cfg',
111
- # :mode => 0664,
112
- # :owner => 'nagios:nagios'},
113
- #
114
- # {:template => 'hosts.cfg.erb',
115
- # :path => '/usr/local/nagios/etc/objects/hosts.cfg',
116
- # :mode => 0664,
117
- # :owner => 'nagios:nagios'},
118
- #
119
- # {:template => 'services.cfg.erb',
120
- # :path => '/usr/local/nagios/etc/objects/services.cfg',
121
- # :mode => 0664,
122
- # :owner => 'nagios:nagios'},
123
- #
124
- # {:template => 'templates.cfg.erb',
125
- # :path => '/usr/local/nagios/etc/objects/templates.cfg',
126
- # :mode => 0664,
127
- # :owner => 'nagios:nagios'},
128
- #
129
- # {:template => 'timeperiods.cfg.erb',
130
- # :path => '/usr/local/nagios/etc/objects/timeperiods.cfg',
131
- # :mode => 0664,
132
- # :owner => 'nagios:nagios'}
127
+ {:template => 'objects/timeperiods.cfg.erb',
128
+ :path => '/usr/local/nagios/etc/objects/timeperiods.cfg',
129
+ :mode => 0664,
130
+ :owner => 'nagios:nagios'}
133
131
 
134
132
  ]
135
133
 
@@ -153,19 +151,19 @@ Capistrano::Configuration.instance(:must_exist).load do
153
151
  send(run_method, "/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg")
154
152
  end
155
153
 
156
- desc "Set Nagios to start on boot"
157
- task :activate, :roles => :nagios do
158
- send(run_method, "update-rc.d nagios defaults")
159
- sudo "a2ensite nagios"
160
- top.deprec.apache.reload
161
- end
162
-
163
- desc "Set Nagios to not start on boot"
164
- task :deactivate, :roles => :nagios do
165
- send(run_method, "update-rc.d -f nagios remove")
166
- sudo "a2dissite nagios"
167
- top.deprec.apache.reload
168
- end
154
+ # desc "Set Nagios to start on boot"
155
+ # task :activate, :roles => :nagios do
156
+ # send(run_method, "update-rc.d nagios defaults")
157
+ # sudo "a2ensite nagios"
158
+ # top.deprec.apache.reload
159
+ # end
160
+ #
161
+ # desc "Set Nagios to not start on boot"
162
+ # task :deactivate, :roles => :nagios do
163
+ # send(run_method, "update-rc.d -f nagios remove")
164
+ # sudo "a2dissite nagios"
165
+ # top.deprec.apache.reload
166
+ # end
169
167
 
170
168
  # Control
171
169
 
@@ -200,8 +198,8 @@ Capistrano::Configuration.instance(:must_exist).load do
200
198
  end
201
199
 
202
200
  SRC_PACKAGES[:nagios_plugins] = {
203
- :url => "http://downloads.sourceforge.net/nagiosplug/nagios-plugins-1.4.12.tar.gz",
204
- :md5sum => "af68d00bbe2c39de02803d23e5eecca3 nagios-plugins-1.4.12.tar.gz",
201
+ :url => "http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.13.tar.gz",
202
+ :md5sum => "be6cc7699fff3ee29d1fd4d562377386 nagios-plugins-1.4.13.tar.gz",
205
203
  :configure => "./configure --with-nagios-user=#{nagios_user} --with-nagios-group=#{nagios_group};",
206
204
  }
207
205
 
@@ -210,7 +208,7 @@ Capistrano::Configuration.instance(:must_exist).load do
210
208
  desc "Install nagios plugins"
211
209
  task :install do
212
210
  install_deps
213
- top.deprec.nagios.create_nagios_user
211
+ create_nagios_user
214
212
  deprec2.download_src(SRC_PACKAGES[:nagios_plugins], src_dir)
215
213
  deprec2.install_from_src(SRC_PACKAGES[:nagios_plugins], src_dir)
216
214
  end
@@ -220,6 +218,15 @@ Capistrano::Configuration.instance(:must_exist).load do
220
218
  apt.install( {:base => %w(libmysqlclient15-dev)}, :stable )
221
219
  end
222
220
 
221
+ task :create_nagios_user do
222
+ deprec2.groupadd(nagios_group)
223
+ deprec2.useradd(nagios_user, :group => nagios_group, :homedir => false)
224
+ # deprec2.add_user_to_group(nagios_user, apache_user)
225
+ deprec2.groupadd(nagios_cmd_group)
226
+ deprec2.add_user_to_group(nagios_user, nagios_cmd_group)
227
+ deprec2.add_user_to_group(apache_user, nagios_cmd_group)
228
+ end
229
+
223
230
 
224
231
  end
225
232
 
@@ -240,7 +247,7 @@ Capistrano::Configuration.instance(:must_exist).load do
240
247
  desc 'Install NRPE'
241
248
  task :install do
242
249
  install_deps
243
- top.deprec.nagios.create_nagios_user
250
+ create_nagios_user
244
251
  deprec2.download_src(SRC_PACKAGES[:nrpe], src_dir)
245
252
  deprec2.install_from_src(SRC_PACKAGES[:nrpe], src_dir)
246
253
  # XXX this should only be run on the nrpe clients
@@ -253,6 +260,15 @@ Capistrano::Configuration.instance(:must_exist).load do
253
260
  apt.install( {:base => %w(xinetd libssl-dev openssl)}, :stable )
254
261
  end
255
262
 
263
+ task :create_nagios_user do
264
+ deprec2.groupadd(nagios_group)
265
+ deprec2.useradd(nagios_user, :group => nagios_group, :homedir => false)
266
+ # deprec2.add_user_to_group(nagios_user, apache_user)
267
+ deprec2.groupadd(nagios_cmd_group)
268
+ deprec2.add_user_to_group(nagios_user, nagios_cmd_group)
269
+ deprec2.add_user_to_group(apache_user, nagios_cmd_group)
270
+ end
271
+
256
272
  SYSTEM_CONFIG_FILES[:nrpe] = [
257
273
 
258
274
  {:template => 'nrpe.xinetd.erb',
@@ -293,10 +309,12 @@ Capistrano::Configuration.instance(:must_exist).load do
293
309
  sudo "/etc/init.d/xinetd start"
294
310
  end
295
311
 
312
+ desc "Test whether NRPE is listening on client"
296
313
  task :test_local do
297
314
  run "/usr/local/nagios/libexec/check_nrpe -H localhost"
298
315
  end
299
316
 
317
+ desc "Test whether nagios server can query client via NRPE"
300
318
  task :test_remote, :roles => :nagios do
301
319
  target_host = Capistrano::CLI.ui.ask "target hostname"
302
320
  run "/usr/local/nagios/libexec/check_nrpe -H #{target_host}"
@@ -304,7 +322,7 @@ Capistrano::Configuration.instance(:must_exist).load do
304
322
 
305
323
  end
306
324
 
307
- # PHP4nagios
325
+ # PNP4nagios
308
326
  # http://downloads.sourceforge.net/sourceforge/pnp4nagios/pnp-0.4.14.tar.gz?use_mirror=internode
309
327
 
310
328