[manual] puppet: Puppetize Munin

To deploy this, the zulip_internal::base and zulip_internal::munin classes must
be added to nagios.zulip.net.

(imported from commit 50d6a4ed19fcc9c62c7104977d69043bf5b9bbf9)
This commit is contained in:
Zev Benjamin
2014-02-10 14:52:05 -05:00
parent 98737a012e
commit 41e3a89398
5 changed files with 98 additions and 79 deletions

View File

@@ -1,73 +0,0 @@
# Configfile for Munin master
dbdir /var/lib/munin
htmldir /var/www/munin
logdir /var/log/munin
rundir /var/run/munin
# We run Munin through SSH tunnels. Until setting these up is
# puppetized, follow the instructions in
# https://wiki.zulip.net/wiki/Deployment_process/components#Munin for
# how to set them up.
#
# If you add a new Munin node, update the documentation to include
# the SSH tunnel instructions for that node. Also change the number
# of autossh processes that we check for with Nagios.
[nagios]
address 127.0.0.1
use_node_name yes
[trac]
address 127.0.0.1
port 5000
use_node_name yes
[zmirror]
address 127.0.0.1
port 5001
use_node_name yes
[staging]
address 127.0.0.1
port 5002
use_node_name yes
[git]
address 127.0.0.1
port 5003
use_node_name yes
[bots]
address 127.0.0.1
port 5004
use_node_name yes
[app]
address 127.0.0.1
port 5005
use_node_name yes
[stats]
address 127.0.0.1
port 5007
use_node_name yes
[postgres1]
address 127.0.0.1
port 5008
use_node_name yes
[postgres2]
address 127.0.0.1
port 5009
use_node_name yes
[redis0]
address 127.0.0.1
port 5010
use_node_name yes
[redis1]
address 127.0.0.1
port 5011
use_node_name yes

View File

@@ -0,0 +1,52 @@
class zulip_internal::munin {
include zulip::supervisor
$munin_packages = [# Packages needed for munin
"munin",
"autossh",
]
package { $munin_packages: ensure => "installed" }
# If you add a new Munin node, change the number of autossh processes that we
# check for with Nagios.
$hosts = ["trac",
"zmirror",
"staging",
"git",
"bots",
"prod0",
"stats",
"postgres1",
"postgres2",
"redis0",
]
file { "/etc/munin":
require => Package["munin"],
recurse => true,
owner => "root",
group => "root",
mode => 644,
source => "puppet:///modules/zulip_internal/munin"
}
file { "/etc/munin/munin.conf":
require => [ Package["munin"], File["/etc/munin"] ],
ensure => file,
owner => "root",
group => "root",
mode => 644,
content => template("zulip_internal/munin/munin.conf.erb")
}
file { "/etc/supervisor/conf.d/munin_tunnels.conf":
require => Package["supervisor", "autossh"],
ensure => file,
mode => 644,
owner => "root",
group => "root",
content => template("zulip_internal/supervisor/conf.d/munin_tunnels.conf.erb"),
notify => Service["supervisor"]
}
}

View File

@@ -1,12 +1,8 @@
class zulip_internal::nagios {
include zulip_internal::base
include zulip_internal::apache
$nagios_packages = [# Packages needed for Nagios
"nagios3",
"autossh",
# Packages needed for munin
"munin",
# Needed for check_website_response
"netcat",
]
@@ -79,6 +75,4 @@ class zulip_internal::nagios {
}
# TODO: Install our API
# TODO: Add munin configuration
}

View File

@@ -0,0 +1,25 @@
# This file was auto-generated by Puppet. Do not edit by hand.
# Configfile for Munin master
dbdir /var/lib/munin
htmldir /var/www/munin
logdir /var/log/munin
rundir /var/run/munin
[nagios]
address 127.0.0.1
use_node_name yes
<%
i = 0
@hosts.each do |host|
-%>
[<%= host %>]
address 127.0.0.1
port <%= 5000 + i %>
use_node_name yes
<%
i += 1
end
-%>

View File

@@ -0,0 +1,21 @@
; This file was auto-generated by Puppet. Do not edit by hand.
<%
i = 0
@hosts.each do |host|
-%>
[program:munin-tunnel-<%= host %>]
command=autossh -2 -N -M <%= 20000 + 2 * i %> -L <%= 5000 + i %>:localhost:4949 nagios@<%= host %>.zulip.net
priority=200 ; the relative start priority (default 999)
autostart=true ; start at supervisord start (default: true)
autorestart=true ; whether/when to restart (default: unexpected)
stopsignal=TERM ; signal used to kill process (default TERM)
stopwaitsecs=30 ; max num secs to wait b4 SIGKILL (default 10)
user=nagios ; setuid to this UNIX account to run the program
redirect_stderr=true ; redirect proc stderr to stdout (default false)
stdout_logfile=/var/log/zulip/autossh.<%= host %>.log ; stdout log path, NONE for none; default AUTO
<%
i += 1
end
-%>