diff options
Diffstat (limited to 'files')
-rw-r--r-- | files/client/2.6/puppet.conf | 16 | ||||
-rw-r--r-- | files/client/debian/puppet | 2 | ||||
-rw-r--r-- | files/client/puppet.conf | 12 | ||||
-rw-r--r-- | files/cron.d/puppetd | 4 | ||||
-rw-r--r-- | files/cron.d/puppetd.CentOS | 4 | ||||
-rw-r--r-- | files/cron.d/puppetd.Gentoo | 4 | ||||
-rw-r--r-- | files/master/debian/puppetmaster | 63 | ||||
-rw-r--r-- | files/munin/puppet_ | 101 |
8 files changed, 187 insertions, 19 deletions
diff --git a/files/client/2.6/puppet.conf b/files/client/2.6/puppet.conf index 6c6a6cc..847f23c 100644 --- a/files/client/2.6/puppet.conf +++ b/files/client/2.6/puppet.conf @@ -6,18 +6,20 @@ ssldir=$vardir/ssl # Where 3rd party plugins and modules are installed - libdir = $vardir/lib - - templatedir=$vardir/templates + libdir = $vardir/lib + templatedir=$vardir/templates + modulepath=/etc/puppet/modules factpath = $libdir/facter [agent] report=true pluginsync = true - # different run-interval, default= 30min - # e.g. run puppetd every 4 hours = 14400 - # runinterval = 14400 + # Default environment + environment = production - logdest=/var/log/puppet/puppet.log + # Development environment + [development] + modulepath = /etc/puppet/development/modules + manifest = /etc/puppet/development/manifests/site.pp diff --git a/files/client/debian/puppet b/files/client/debian/puppet index 3e0ee04..59e4bde 100644 --- a/files/client/debian/puppet +++ b/files/client/debian/puppet @@ -1,7 +1,7 @@ # Defaults for puppet - sourced by /etc/init.d/puppet # Start puppet on boot? -START=yes +START=no # Startup options DAEMON_OPTS="-w 0" diff --git a/files/client/puppet.conf b/files/client/puppet.conf index 9ee333c..09b47b1 100644 --- a/files/client/puppet.conf +++ b/files/client/puppet.conf @@ -9,15 +9,17 @@ libdir = $vardir/lib templatedir=$vardir/templates - + modulepath=/etc/puppet/modules factpath = $libdir/facter [puppetd] report=true pluginsync=true - # different run-interval, default= 30min - # e.g. run puppetd every 4 hours = 14400 - # runinterval = 14400 + # Default environment + environment = production - logdest=/var/log/puppet/puppet.log + # Development environment + [development] + modulepath = /etc/puppet/development/modules + manifest = /etc/puppet/development/manifests/site.pp diff --git a/files/cron.d/puppetd b/files/cron.d/puppetd index 92af3e2..4db734a 100644 --- a/files/cron.d/puppetd +++ b/files/cron.d/puppetd @@ -1,5 +1,5 @@ # check if puppet is running -0 * * * * root /bin/ps ax | /bin/grep -v grep | /bin/grep -q puppetd || (sleep `echo $RANDOM/2000*60 | bc` && /etc/init.d/puppet restart) +0 * * * * root /bin/ps ax | /bin/grep -v grep | /bin/grep -q puppetd || (sleep $(( $(</dev/urandom od -N2 -t u2 -A n) >> 6 )) && /etc/init.d/puppet restart > /dev/null) # restart puppet once in a while and randomly delay the restart between 0 and 32 minutes -> splay puppetmaster hammering -0 22 * * */2 root sleep `echo $RANDOM/1000*60 | bc` && /etc/init.d/puppet restart > /dev/null +0 22 * * */2 root sleep $(( $( </dev/urandom od -N2 -t u2 -A none ) >> 5 )) && /etc/init.d/puppet restart > /dev/null diff --git a/files/cron.d/puppetd.CentOS b/files/cron.d/puppetd.CentOS index 9787231..30a14bb 100644 --- a/files/cron.d/puppetd.CentOS +++ b/files/cron.d/puppetd.CentOS @@ -1,5 +1,5 @@ # check if puppet is running -0 * * * * root /etc/init.d/puppet status > /dev/null || (sleep `echo $RANDOM/2000*60 | bc` && /etc/init.d/puppet restart) +0 * * * * root /etc/init.d/puppet status > /dev/null || (sleep $(( $(</dev/urandom od -N2 -t u2 -A n) >> 6 )) && /etc/init.d/puppet restart > /dev/null) # restart puppet once in a while and randomly delay the restart between 0 and 32 minutes -> splay puppetmaster hammering -0 22 * * */2 root sleep `echo $RANDOM/1000*60 | bc` && /etc/init.d/puppet restart > /dev/null +0 22 * * */2 root sleep $(( $(</dev/urandom od -N2 -t u2 -A n) >> 5 )) && /etc/init.d/puppet restart > /dev/null diff --git a/files/cron.d/puppetd.Gentoo b/files/cron.d/puppetd.Gentoo index 29655b9..2404d68 100644 --- a/files/cron.d/puppetd.Gentoo +++ b/files/cron.d/puppetd.Gentoo @@ -1,5 +1,5 @@ # check if puppet is running -# 0 * * * * root /bin/ps ax | /bin/grep -v grep | /bin/grep -q puppetd || ( sleep `echo $RANDOM/2000*60 | bc` && /etc/init.d/puppet restart ) +# 0 * * * * root /bin/ps ax | /bin/grep -v grep | /bin/grep -q puppetd || ( sleep $(( $(</dev/urandom od -N2 -t u2 -A n) >> 6 )) && /etc/init.d/puppet restart > /dev/null) # restart puppet once in a while and randomly delay the restart between 0 and 32 minutes -> splay puppetmaster hammering -# 0 22 * * */2 root sleep `echo $RANDOM/1000*60 | bc` && /etc/init.d/puppet restart > /dev/null +# 0 22 * * */2 root sleep $(( $(</dev/urandom od -N2 -t u2 -A n) >> 5 )) && /etc/init.d/puppet restart > /dev/null diff --git a/files/master/debian/puppetmaster b/files/master/debian/puppetmaster new file mode 100644 index 0000000..b0a9fe4 --- /dev/null +++ b/files/master/debian/puppetmaster @@ -0,0 +1,63 @@ +# Defaults for puppetmaster - sourced by /etc/init.d/puppetmaster + +# Start puppetmaster on boot? If you are using passenger, you should +# have this set to "no" +START=yes + +# Startup options +DAEMON_OPTS="" + +# What server type to run +# Options: +# webrick: default, cannot handle more than ~30 nodes +# mongrel: scales better than webrick because you can run +# multiple processes if you are getting +# connection-reset or End-of-file errors, switch to +# mongrel. Requires front-end web-proxy such as +# apache, nginx, or pound, more information: +# http://reductivelabs.com/trac/puppet/wiki/UsingMongrel +# passenger: no need to set this, be sure to set START=no above +SERVERTYPE=webrick + +# How many puppetmaster instances to start? Its pointless to set this +# higher than 1 if you are not using mongrel. +PUPPETMASTERS=1 + +# What port should the puppetmaster listen on (default: 8140). If +# PUPPETMASTERS is set to a number greater than 1, then the port for +# the first puppetmaster will be set to the port listed below, and +# further instances will be incremented by one +# +# NOTE: if you are using mongrel, then you will need to have a +# front-end web-proxy (such as apache, nginx, pound) that takes +# incoming requests on the port your clients are connecting to +# (default is: 8140), and then passes them off to the mongrel +# processes. In this case it is recommended to run your web-proxy on +# port 8140 and change the below number to something else, such as +# 18140. +PORT=8140 + +# Should puppetqd (the storeconfigs queuing broker) be started? +# This can take some load off of the puppetmaster by queuing the +# storeconfig updates to the database with puppetqd. You need +# to have the 'stompserver' package installed and running, and +# the following configured in your puppet.conf: +# +# [main] +# queue_type = stomp +# queue_source = stomp://localhost:61613 +# dbadapter = (sqlite3|mysql|postgresql) +# dbserver=localhost +# dbname=puppet +# dbuser=puppet +# dbpassword=xxxx +# dblocation = /var/lib/puppet/storeconfigs.sqlite <-- only if using sqlite +# [master] +# async_storeconfigs = true +# +# See: http://reductivelabs.com/trac/puppet/wiki/UsingStoredConfiguration +# +# Once you have the proper puppet.conf, and stompserver, you can enable +# the following: +PUPPETQD=no +PUPPETQD_OPTS="" diff --git a/files/munin/puppet_ b/files/munin/puppet_ new file mode 100644 index 0000000..ed488be --- /dev/null +++ b/files/munin/puppet_ @@ -0,0 +1,101 @@ +#!/usr/bin/env ruby + +# returns the mem usage of a given process +def plist(psname) + counter = 0 + %x{ps h -o rss,size,vsize,pcpu -u puppet}.each do |ps| + rss,size,vsize,cpu = ps.split + counter += 1 + puts "puppetmasterd_#{counter}.value #{rss}" + + end + return +end + +# reports how many clients compiled in the last 5 minutes +# repotrs how many unique clients compiled since the begining of the day +# report the average compilation time for all clients in the last 5 minutes. +def phaselog + logfile = ENV['puppet_logfile'] || '/var/log/daemon.log' + count,avg,day_count_unique,day_count = 0 ,0 ,0, 0 + t = Time.now + today = t.strftime("^%b ") + " ?" + t.day.to_s + hour = today + t.strftime(" %H:") + m = t.min.to_i + last5m = "" + 6.times do |i| + last5m += hour + last5m += "0" if (m-i) < 10 + last5m += (m-i).to_s + last5m += "|" unless i==5 + end + hosts = Array.new + regexp = ".* for (.*) in (.*) seconds" + + File.open(logfile).grep(/#{today}/).grep(/Compiled configuration|Compiled catalog/).each do |line| + case line + when /#{last5m}/ then + if line =~ /#{regexp}/ + avg += $2.to_f + count += 1 + unless hosts.include?($1) + hosts << $1 + end + end + when /#{regexp}/ then + day_count += 1 + unless hosts.include?($1) + hosts << $1 + day_count_unique += 1 + end + end + end + puts "avg_compile.value #{(avg / count).to_s[0..3]}" unless count == 0 + puts "last5m_count.value #{count}" + puts "last24h_unique_count.value #{day_count_unique}" +end + + +case ARGV[0] + when 'config' + case $0 + when /puppetmaster_memory/ + puts "graph_title puppetmaster memory usage" + puts "graph_vlabel memory" + # find out how many mongrel process we have - if any + File.open('/etc/default/puppetmaster') do |line| + @pm_process = line.grep(/PUPPETMASTERS/).to_s.split('=')[1].to_i + end + if @pm_process > 0 + @pm_process.times do |i| + puts "puppetmasterd_#{i+1}.label puppetmasterd #{i+1}" + end + else + puts "puppetmaster.label puppetmasterd" + end + when /puppet_clients/ + puts "graph_title puppet clients usage" + puts "graph_vlabel clients" + puts "known_clients.label Known Clients" + puts "avg_compile.label Average configuration compile" + puts "last5m_count.label Clients in the last 5 minutes" + puts "last24h_unique_count.label unique clients in the last 24 hours" + end + puts "graph_category puppet" + exit 0 + when 'autoconf' + case $0 + when /puppet_mem/,/puppet_clients/ + puts "yes" + else + puts "no" + exit 0 + end + else + plist("'ruby /usr/sbin/puppetmasterd'") if $0 =~ /puppet_mem$/ + if $0 =~ /puppet_clients$/ + puts "known_clients.value #{Dir.entries('/var/lib/puppet/yaml/facts/').size-2}" + phaselog + end +end + |