diff options
Diffstat (limited to 'files')
-rw-r--r-- | files/client/puppet.conf | 43 | ||||
-rw-r--r-- | files/master/config.ru | 19 | ||||
-rw-r--r-- | files/master/puppet.conf | 100 | ||||
-rw-r--r-- | files/munin/puppet_ | 175 |
4 files changed, 155 insertions, 182 deletions
diff --git a/files/client/puppet.conf b/files/client/puppet.conf index 09b47b1..ab8c552 100644 --- a/files/client/puppet.conf +++ b/files/client/puppet.conf @@ -1,25 +1,22 @@ [main] - logdir=/var/log/puppet - vardir=/var/lib/puppet - rundir=/var/run/puppet - - ssldir=$vardir/ssl - - # Where 3rd party plugins and modules are installed - libdir = $vardir/lib - - templatedir=$vardir/templates - modulepath=/etc/puppet/modules - factpath = $libdir/facter + confdir = /etc/puppet + logdir = /var/log/puppet + vardir = /var/lib/puppet + ssldir = $vardir/ssl + rundir = /var/run/puppet + factpath = $vardir/lib/facter + templatedir = $confdir/templates + #certname = puppetmaster01.example.com + #server = puppet.example.com + #user = pe-puppet + #group = pe-puppet + #archive_files = true + #archive_file_server = puppet.example.com -[puppetd] - report=true - pluginsync=true - - # Default environment - environment = production - - # Development environment - [development] - modulepath = /etc/puppet/development/modules - manifest = /etc/puppet/development/manifests/site.pp +[agent] + report = true + classfile = $vardir/classes.txt + localconfig = $vardir/localconfig + graph = true + pluginsync = true + environment = production diff --git a/files/master/config.ru b/files/master/config.ru index b0fd250..984017e 100644 --- a/files/master/config.ru +++ b/files/master/config.ru @@ -2,7 +2,7 @@ # SSL needs to be handled outside this, though. # if puppet is not in your RUBYLIB: -# $:.unshift('/opt/puppet/lib') +# $LOAD_PATH.unshift('/opt/puppet/lib') $0 = "master" @@ -11,16 +11,21 @@ $0 = "master" ARGV << "--rack" +# Rack applications typically don't start as root. Set --confdir and --vardir +# to prevent reading configuration from ~puppet/.puppet/puppet.conf and writing +# to ~puppet/.puppet +ARGV << "--confdir" << "/etc/puppet" +ARGV << "--vardir" << "/var/lib/puppet" # NOTE: it's unfortunate that we have to use the "CommandLine" class -# here to launch the app, but it contains some initialization logic -# (such as triggering the parsing of the config file) that is very -# important. We should do something less nasty here when we've -# gotten our API and settings initialization logic cleaned up. +# here to launch the app, but it contains some initialization logic +# (such as triggering the parsing of the config file) that is very +# important. We should do something less nasty here when we've +# gotten our API and settings initialization logic cleaned up. # # Also note that the "$0 = master" line up near the top here is -# the magic that allows the CommandLine class to know that it's -# supposed to be running master. +# the magic that allows the CommandLine class to know that it's +# supposed to be running master. # # --cprice 2012-05-22 diff --git a/files/master/puppet.conf b/files/master/puppet.conf index f6471d7..893dfb6 100644 --- a/files/master/puppet.conf +++ b/files/master/puppet.conf @@ -1,72 +1,36 @@ [main] - confdir=/srv/puppet/etc - - # Where Puppet stores dynamic and growing data. - # The default value is '/var/puppet'. - vardir = /srv/puppet - - # The Puppet log directory. - # The default value is '$vardir/log'. - logdir = /var/log/puppet - - # Where Puppet PID files are kept. - # The default value is '$vardir/run'. - rundir = /var/run/puppet - - # Where SSL certificates are kept. - # The default value is '$confdir/ssl'. - ssldir = $vardir/ssl - - factpath = $vardir/lib/facter - plugindest = $vardir/lib/puppet - -[agent] - # The file in which puppetd stores a list of the classes - # associated with the retrieved configuratiion. Can be loaded in - # the separate ``puppet`` executable using the ``--loadclasses`` - # option. - # The default value is '$confdir/classes.txt'. - classfile = $vardir/classes.txt - - # Where puppetd caches the local configuration. An - # extension indicating the cache format is added automatically. - # The default value is '$confdir/localconfig'. - localconfig = $vardir/localconfig - - report=true - pluginsync = true - - logdest=/var/log/puppet/puppet.log + confdir = /etc/puppet + logdir = /var/log/puppet + vardir = /var/lib/puppet + ssldir = $vardir/ssl + rundir = /var/run/puppet + factpath = $vardir/lib/facter + templatedir = $confdir/templates + #certname = puppetmaster01.example.com + #server = puppet.example.com + #user = pe-puppet + #group = pe-puppet + #archive_files = true + #archive_file_server = puppet.example.com [master] - reportdir = $logdir/reports - autoflush = true - #storeconfigs=true - dbadapter=mysql - dbserver=localhost - dbuser=puppet - dbpassword=**************** - dbsocket=/var/lib/mysql/mysql.sock - - #usage for clusters - #ssl_client_header=HTTP_X_SSL_SUBJECT - - # apache2/passenger usage: http://github.com/reductivelabs/puppet/tree/master/ext/rack - ssl_client_header = SSL_CLIENT_S_DN - ssl_client_verify_header = SSL_CLIENT_VERIFY - - - # specify allowed environments - environments=production,development - - # configure environments - [development] - manifest=$vardir/development/etc/manifests/site.pp - modulepath=$vardir/development/modules/ - templatepath=$vardir/development/templates/ - - [production] - manifest=$vardir/production/etc/manifests/site.pp - modulepath=$vardir/production/modules/ - templatepath=$vardir/production/templates/ + #certname = puppetmaster01.example.com + #dns_alt_names = puppetmaster01,puppetmaster01.example.com,puppet,puppet.example.com + #ca_name = 'Puppet CA generated on puppetmaster01.example.com at 2013-08-09 19:11:11 +0000' + reports = http,puppetdb + reporturl = https://localhost:443/reports/upload + #node_terminus = exec + #external_nodes = /etc/puppetlabs/puppet-dashboard/external_node + ssl_client_header = SSL_CLIENT_S_DN + ssl_client_verify_header = SSL_CLIENT_VERIFY + #storeconfigs_backend = puppetdb + #storeconfigs = true + #autosign = true +[agent] + report = true + classfile = $vardir/classes.txt + localconfig = $vardir/localconfig + graph = true + pluginsync = true + environment = production diff --git a/files/munin/puppet_ b/files/munin/puppet_ index ed488be..0fc8e52 100644 --- a/files/munin/puppet_ +++ b/files/munin/puppet_ @@ -2,100 +2,107 @@ # 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 + 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 +def phaselog(logfile) + 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" + 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}" + 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 #{count == 0 ? 0 : (avg / count).to_s[0..3]}" + puts "last5m_count.value #{count}" + puts "last24h_unique_count.value #{day_count_unique}" end +sys_file = '/etc/default/puppetmaster' +sys_file = '/etc/sysconfig/puppetmaster' if !File.exists?(sys_file) && File.exists?('/etc/sysconfig/puppetmaster') +logfile = ENV['puppet_logfile'] || '/var/log/daemon.log' +facts_dir = ENV['facts_dir'] || '/var/lib/puppet/yaml/facts/' 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 + 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(sys_files) do |line| + @pm_process = line.grep(/(PUPPETMASTERS|PUPPETMASTER_PORTS)/).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/ + if File.exists?(sys_file) && File.exists?(logfile) && File.directory?(facts_dir) + puts "yes" + else + puts "no" + end + 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(facts_dir).size-2}" + phaselog(logfile) + end end |