initial
This commit is contained in:
@@ -1,17 +0,0 @@
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 78
|
||||
/dav/ikwadmin/!svn/ver/4431/linux/puppetmaster/etc_puppet/modules/puppet/files
|
||||
END
|
||||
org.macports.puppet.plist
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 104
|
||||
/dav/ikwadmin/!svn/ver/3270/linux/puppetmaster/etc_puppet/modules/puppet/files/org.macports.puppet.plist
|
||||
END
|
||||
puppetd_run.sh
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 93
|
||||
/dav/ikwadmin/!svn/ver/2714/linux/puppetmaster/etc_puppet/modules/puppet/files/puppetd_run.sh
|
||||
END
|
||||
@@ -1,105 +0,0 @@
|
||||
10
|
||||
|
||||
dir
|
||||
4547
|
||||
https://uwaechte@svn.ikw.uni-osnabrueck.de/dav/ikwadmin/linux/puppetmaster/etc_puppet/modules/puppet/files
|
||||
https://uwaechte@svn.ikw.uni-osnabrueck.de/dav/ikwadmin
|
||||
|
||||
|
||||
|
||||
2011-06-21T11:23:42.358929Z
|
||||
4431
|
||||
uwaechte
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
0e4a7186-e024-0410-a49b-aced43e0d94e
|
||||
|
||||
debian
|
||||
dir
|
||||
|
||||
ganglia
|
||||
dir
|
||||
|
||||
darwin
|
||||
dir
|
||||
|
||||
org.macports.puppet.plist
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2011-07-25T16:18:40.000000Z
|
||||
de69fc6f4e6821a12a6d81e8859d1b8d
|
||||
2010-03-26T16:47:49.726793Z
|
||||
3270
|
||||
uwaechte
|
||||
has-props
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
661
|
||||
|
||||
puppetd_run.sh
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2011-07-25T16:18:40.000000Z
|
||||
0a43d883ca09d2a9eef11f4ff209cf07
|
||||
2009-08-01T09:52:05.172762Z
|
||||
2714
|
||||
uwaechte
|
||||
has-props
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
1426
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
K 12
|
||||
svn:keywords
|
||||
V 2
|
||||
Id
|
||||
END
|
||||
@@ -1,9 +0,0 @@
|
||||
K 14
|
||||
svn:executable
|
||||
V 1
|
||||
*
|
||||
K 12
|
||||
svn:keywords
|
||||
V 2
|
||||
Id
|
||||
END
|
||||
@@ -1,23 +0,0 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
|
||||
"http://www.apple.com/DTDs/PropertyList-1.0.dtd" >
|
||||
<plist version='1.0'>
|
||||
<dict>
|
||||
<key>Label</key><string>org.macports.puppet</string>
|
||||
<key>ProgramArguments</key>
|
||||
<array>
|
||||
<string>/opt/local/bin/daemondo</string>
|
||||
<string>--label=puppet</string>
|
||||
<string>--start-cmd</string>
|
||||
<string>/opt/local/sbin/puppetd</string>
|
||||
<string>--no-daemonize</string>
|
||||
<string>--verbose</string>
|
||||
<string>;</string>
|
||||
<string>--pid=exec</string>
|
||||
</array>
|
||||
<key>Debug</key><false/>
|
||||
<key>Disabled</key><true/>
|
||||
<key>OnDemand</key><false/>
|
||||
<key>RunAtLoad</key><true/>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1,44 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# $Id$
|
||||
|
||||
|
||||
# a wrapper script, to run puppetd after a random time
|
||||
# this will be called by cron at the same time on each client,
|
||||
# but should not call the master at the same time as the others.
|
||||
export FACTERLIB="/var/lib/puppet/facts"
|
||||
PATH=/opt/local/bin:/opt/local/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||
PUPPET=$(which puppetd)
|
||||
ISUNIIP=$(ifconfig |grep -c -e "131\.173\.3[2345]")
|
||||
|
||||
if [ ${ISUNIIP} -gt 0 ]; then
|
||||
if [ -e ${PUPPET} ]; then
|
||||
#mac os X laptop check
|
||||
if [ -e /usr/bin/pmset ]; then
|
||||
if [ $(/usr/bin/pmset -g batt | grep -c "Battery Power") -eq 1 ]; then
|
||||
#we are running on battery and do not want to do anything
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
#Linux laptop check
|
||||
if [ -e /proc/acpi/ac_adapter/AC/state ]; then
|
||||
if [ $(grep -c "on-line" /proc/acpi/ac_adapter/AC/state) -eq 0 ]; then
|
||||
#we are running on battery and do not want to do anything
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
MAXSLEEP=3200 #How many seconds to wait maximally
|
||||
SLEEP=${RANDOM}
|
||||
I=${RANDOM}
|
||||
|
||||
# $RANDOM must be called several times, to ensure it really
|
||||
# is something like random
|
||||
for x in 1 2 3 4 5 6 7 8 9 10 11 12; do
|
||||
SLEEP=${RANDOM}
|
||||
done
|
||||
# wait maximally $MAXSLEEP seconds
|
||||
sleep $(expr ${SLEEP} % ${MAXSLEEP})
|
||||
# run puppetd
|
||||
nice -n 12 $PUPPET -t 2&>/var/log/puppet/puppetd_run.log
|
||||
fi
|
||||
fi
|
||||
@@ -1,17 +0,0 @@
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 85
|
||||
/dav/ikwadmin/!svn/ver/2973/linux/puppetmaster/etc_puppet/modules/puppet/files/darwin
|
||||
END
|
||||
mac_inst_pkg.sh
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 101
|
||||
/dav/ikwadmin/!svn/ver/1786/linux/puppetmaster/etc_puppet/modules/puppet/files/darwin/mac_inst_pkg.sh
|
||||
END
|
||||
chplist.rb
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 96
|
||||
/dav/ikwadmin/!svn/ver/1786/linux/puppetmaster/etc_puppet/modules/puppet/files/darwin/chplist.rb
|
||||
END
|
||||
@@ -1,96 +0,0 @@
|
||||
10
|
||||
|
||||
dir
|
||||
4547
|
||||
https://uwaechte@svn.ikw.uni-osnabrueck.de/dav/ikwadmin/linux/puppetmaster/etc_puppet/modules/puppet/files/darwin
|
||||
https://uwaechte@svn.ikw.uni-osnabrueck.de/dav/ikwadmin
|
||||
|
||||
|
||||
|
||||
2009-11-17T13:03:47.348980Z
|
||||
2973
|
||||
uwaechte
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
0e4a7186-e024-0410-a49b-aced43e0d94e
|
||||
|
||||
mac_inst_pkg.sh
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2011-07-25T16:18:40.000000Z
|
||||
044606cd03adeddf802414d297e88313
|
||||
2008-05-12T14:55:08.810767Z
|
||||
1299
|
||||
admin
|
||||
has-props
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
2082
|
||||
|
||||
chplist.rb
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2011-07-25T16:18:40.000000Z
|
||||
acee173df6f801ba44cd2c8b54d8421a
|
||||
2008-05-12T14:55:08.810767Z
|
||||
1299
|
||||
admin
|
||||
has-props
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
3419
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
K 14
|
||||
svn:executable
|
||||
V 1
|
||||
*
|
||||
K 12
|
||||
svn:keywords
|
||||
V 2
|
||||
Id
|
||||
END
|
||||
@@ -1,5 +0,0 @@
|
||||
K 12
|
||||
svn:keywords
|
||||
V 2
|
||||
Id
|
||||
END
|
||||
@@ -1,148 +0,0 @@
|
||||
#!/usr/bin/env ruby -w
|
||||
# $Id$
|
||||
|
||||
|
||||
require 'rubygems'
|
||||
require 'plist'
|
||||
|
||||
class Plwrap
|
||||
attr_accessor :pl
|
||||
attr_accessor :filename
|
||||
attr_accessor :binary
|
||||
attr_accessor :do_conversion
|
||||
|
||||
def initialize(fn)
|
||||
do_conversion = true
|
||||
@filename = fn
|
||||
if ! File.exists?(fn)
|
||||
@pl = Plist::parse_xml(Hash.new.to_plist)
|
||||
return
|
||||
end
|
||||
|
||||
@binary = false
|
||||
ret = %x{file #{fn}}
|
||||
if ret =~ /binary|data/
|
||||
if do_conversion
|
||||
@binary = true
|
||||
%x{plutil -convert xml1 #{fn}}
|
||||
else
|
||||
raise "I'm not allowed to convert binary plist"
|
||||
end
|
||||
end
|
||||
@pl = Plist::parse_xml(@filename)
|
||||
end
|
||||
def get(key,path=nil)
|
||||
if(!path and get_without_path_ok?(key))
|
||||
path = guesspath(key)
|
||||
end
|
||||
mpath = modpath(path)
|
||||
return eval("@pl" + mpath)
|
||||
end
|
||||
def typeof(key,path=nil)
|
||||
return self.get(key,path).class
|
||||
end
|
||||
def set(key, val, klass=nil, path=nil)
|
||||
begin
|
||||
if(!path and get_without_path_ok?(key))
|
||||
path = guesspath(key)
|
||||
end
|
||||
rescue Exception => e
|
||||
if e.message =~ /oo many/
|
||||
raise e
|
||||
end
|
||||
path = key
|
||||
end
|
||||
mpath = modpath(path)
|
||||
mpath = "[\"#{key}\"]" if !mpath
|
||||
return eval("@pl" + mpath + "= convert(val,key,klass,path)")
|
||||
end
|
||||
def modpath(p)
|
||||
return p.split("::").map{|a| '["' + a + '"]'}.join("") if p
|
||||
end
|
||||
def guesspath(key,base=@pl)
|
||||
raise "base is not set in guesspath" if !base
|
||||
base.each do |a,b|
|
||||
if key == a
|
||||
return a
|
||||
end
|
||||
if b.methods.include?("each")
|
||||
if x = guesspath(key,b)
|
||||
x = a + "::" + x
|
||||
return x
|
||||
end
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
def set_without_path_ok?(key)
|
||||
num = num_of_keys_with_this_name(@pl,key)
|
||||
if num > 1
|
||||
raise "Too many occurences of #{key} in tree (#{num} times)"
|
||||
end
|
||||
return true
|
||||
end
|
||||
def get_without_path_ok?(key)
|
||||
num = num_of_keys_with_this_name(@pl,key)
|
||||
if num == 0
|
||||
raise "Key #{key} does not exist"
|
||||
elsif num > 1
|
||||
raise "Too many occurences of #{key} in tree (#{num} times)"
|
||||
end
|
||||
return true
|
||||
end
|
||||
def num_of_keys_with_this_name(base, key)
|
||||
sum = 0
|
||||
raise "base is not set in num_of_keys_with_this_name" if !base
|
||||
base.each do |a,b|
|
||||
sum += 1 if key == a
|
||||
if b.methods.include?("each")
|
||||
sum += num_of_keys_with_this_name(b,key)
|
||||
end
|
||||
end
|
||||
return sum
|
||||
end
|
||||
def write(fn = @filename)
|
||||
Plist::Emit::save_plist(@pl, fn)
|
||||
%x{plutil -convert binary1 #{fn}} if do_conversion and @binary
|
||||
end
|
||||
def convert(val,key=nil,klass=nil,path=nil)
|
||||
if !klass
|
||||
raise ArgumentError, "Key needed if klass not given" if !key
|
||||
if get_without_path_ok?(key)
|
||||
klass = typeof(key,path)
|
||||
end
|
||||
end
|
||||
case klass.to_s
|
||||
when "Boolean"; return ["true","1"].include?(val)
|
||||
when "TrueClass"; return ["true","1"].include?(val)
|
||||
when "FalseClass"; return ["true","1"].include?(val)
|
||||
when "Array"; return val.split("::")
|
||||
when "Hash"; raise "Conversion of hashes not yet implemented"
|
||||
when "String"; return val.to_s
|
||||
when "Integer"; return val.to_i
|
||||
when "Fixnum"; return val.to_i
|
||||
when "Float"; return val.to_f
|
||||
else raise "Unknown class #{klass}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if ARGV.size < 4
|
||||
puts "Usage: $0 file key path val klass\n"
|
||||
exit 1
|
||||
end
|
||||
|
||||
file,key,path,val,klass = ARGV
|
||||
|
||||
|
||||
klass = nil if ["","nil"].include?(klass)
|
||||
path = nil if ["","nil"].include?(path)
|
||||
|
||||
pw = Plwrap.new file
|
||||
begin
|
||||
pw.set(key,val,klass,path)
|
||||
rescue Exception => e
|
||||
puts e.message
|
||||
exit 0
|
||||
end
|
||||
pw.write(file)
|
||||
@@ -1,93 +0,0 @@
|
||||
#!/bin/bash
|
||||
# $Id$
|
||||
|
||||
|
||||
BASEURL=$1
|
||||
VERSION=$2
|
||||
PKGNAME=$3
|
||||
CHKSUM=$4
|
||||
EXTENSION=$5
|
||||
REMOVE=$6
|
||||
CHECKONLY=$7
|
||||
|
||||
# this is the naming scheme of the packages:
|
||||
PKGNS="${PKGNAME}_${VERSION}.${EXTENSION}"
|
||||
|
||||
# ZIPFILE
|
||||
ZIPFILE="${PKGNS}.zip"
|
||||
|
||||
# ------------------------------ Functions ----------------------------
|
||||
|
||||
function is_installed_with_any_version {
|
||||
if [ "`ls \"/Library/Receipts/${PGKNS}\"* 2>/dev/null`" != "" ] ; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
function is_installed_with_req_version {
|
||||
## echo "Testing whether /Library/Receipts/${PKGNS} exists"
|
||||
if [ -e "/Library/Receipts/${PKGNS}" ] ; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
function remove_old {
|
||||
echo "Removing old not yet implemented!"
|
||||
}
|
||||
|
||||
# ------------------------------ Installed? ---------------------------
|
||||
|
||||
is_installed_with_req_version
|
||||
if [ $? -eq 1 ] ; then
|
||||
echo "Required Version of ${PKGNAME} (${PKGNS}) already installed --> Done."
|
||||
exit 1;
|
||||
fi
|
||||
if [ "$CHECKONLY" != "" ] ; then
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
is_installed_with_any_version
|
||||
if [ $? -eq 1 ] ; then
|
||||
echo "Other Version of ${PKGNAME} already installed --> Updating."
|
||||
if [ "$REMOVE" == "true" ] ; then
|
||||
remove_old
|
||||
fi
|
||||
else
|
||||
echo "No Version of ${PKGNAME} already installed --> Installing."
|
||||
fi
|
||||
|
||||
# ------------------------------ Download ----------------------------
|
||||
cd /tmp
|
||||
ZIPFILE=`echo $ZIPFILE | perl -npe 's/ /%20/g'`
|
||||
curl "${BASEURL}/$ZIPFILE" -o "/tmp/$ZIPFILE"
|
||||
|
||||
# ------------------------------ Checksum ----------------------------
|
||||
if [ -e "/sw/bin/md5sum" ] ; then
|
||||
DLMD5=`/sw/bin/md5sum "$ZIPFILE" | cut -f1 -d' '`
|
||||
else
|
||||
DLMD5=`md5 "$ZIPFILE" | cut -f4 -d' '`
|
||||
fi
|
||||
|
||||
if [ "0" != "$CHKSUM" ] ; then
|
||||
if [ "$DLMD5" != "$CHKSUM" ] ; then
|
||||
echo "Could not verify checksum: Mismatch!"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "WARNING: Ignoring checksum check"
|
||||
fi
|
||||
|
||||
# ------------------------------ Install ----------------------------
|
||||
# -o: force overwrite
|
||||
unzip -o "$ZIPFILE"
|
||||
if installer -pkg "${PKGNS}" -target / ; then
|
||||
touch "/Library/Receipts/${PKGNS}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Installer failed."
|
||||
exit 1
|
||||
@@ -1,11 +0,0 @@
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 85
|
||||
/dav/ikwadmin/!svn/ver/3239/linux/puppetmaster/etc_puppet/modules/puppet/files/debian
|
||||
END
|
||||
puppetqd
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 94
|
||||
/dav/ikwadmin/!svn/ver/3239/linux/puppetmaster/etc_puppet/modules/puppet/files/debian/puppetqd
|
||||
END
|
||||
@@ -1,62 +0,0 @@
|
||||
10
|
||||
|
||||
dir
|
||||
4547
|
||||
https://uwaechte@svn.ikw.uni-osnabrueck.de/dav/ikwadmin/linux/puppetmaster/etc_puppet/modules/puppet/files/debian
|
||||
https://uwaechte@svn.ikw.uni-osnabrueck.de/dav/ikwadmin
|
||||
|
||||
|
||||
|
||||
2010-03-16T19:42:00.406592Z
|
||||
3239
|
||||
uwaechte
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
0e4a7186-e024-0410-a49b-aced43e0d94e
|
||||
|
||||
puppetqd
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2011-07-25T16:18:40.000000Z
|
||||
84deb07a79b9344f9d3b4f8399984293
|
||||
2010-03-16T19:42:00.406592Z
|
||||
3239
|
||||
uwaechte
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
4136
|
||||
|
||||
@@ -1,154 +0,0 @@
|
||||
#! /bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: puppetqd
|
||||
# Required-Start: $network stompserver
|
||||
# Required-Stop: $network
|
||||
# X-Start-Before: apache2 puppetmaster
|
||||
# X-Stop-After: apache2 puppetmaster
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Puppetqd start script
|
||||
# Description: The puppet queue daemon startup script. It queues
|
||||
# placed in /etc/init.d.
|
||||
### END INIT INFO
|
||||
|
||||
# Author: Udo Waechter <udo.waechter@uni-osnabrueck.de>
|
||||
#
|
||||
# Do NOT "set -e"
|
||||
|
||||
# PATH should only include /usr/* if it runs after the mountnfs.sh script
|
||||
PATH=/sbin:/usr/sbin:/bin:/usr/bin
|
||||
DESC="Puppet Queue daemon"
|
||||
NAME=puppetqd
|
||||
DAEMON=/usr/sbin/$NAME
|
||||
DAEMON_ARGS=""
|
||||
PIDFILE=/var/run/$NAME.pid
|
||||
SCRIPTNAME=/etc/init.d/$NAME
|
||||
|
||||
# Exit if the package is not installed
|
||||
[ -x "$DAEMON" ] || exit 0
|
||||
|
||||
# Read configuration variable file if it is present
|
||||
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
|
||||
|
||||
# Load the VERBOSE setting and other rcS variables
|
||||
. /lib/init/vars.sh
|
||||
|
||||
# Define LSB log_* functions.
|
||||
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
#
|
||||
# Function that starts the daemon/service
|
||||
#
|
||||
do_start()
|
||||
{
|
||||
# Return
|
||||
# 0 if daemon has been started
|
||||
# 1 if daemon was already running
|
||||
# 2 if daemon could not be started
|
||||
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
|
||||
|| return 1
|
||||
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
|
||||
$DAEMON_ARGS \
|
||||
|| return 2
|
||||
# Add code here, if necessary, that waits for the process to be ready
|
||||
# to handle requests from services started subsequently which depend
|
||||
# on this one. As a last resort, sleep for some time.
|
||||
}
|
||||
|
||||
#
|
||||
# Function that stops the daemon/service
|
||||
#
|
||||
do_stop()
|
||||
{
|
||||
# Return
|
||||
# 0 if daemon has been stopped
|
||||
# 1 if daemon was already stopped
|
||||
# 2 if daemon could not be stopped
|
||||
# other if a failure occurred
|
||||
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
|
||||
RETVAL="$?"
|
||||
[ "$RETVAL" = 2 ] && return 2
|
||||
# Wait for children to finish too if this is a daemon that forks
|
||||
# and if the daemon is only ever run from this initscript.
|
||||
# If the above conditions are not satisfied then add some other code
|
||||
# that waits for the process to drop all resources that could be
|
||||
# needed by services started subsequently. A last resort is to
|
||||
# sleep for some time.
|
||||
start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
|
||||
[ "$?" = 2 ] && return 2
|
||||
# Many daemons don't delete their pidfiles when they exit.
|
||||
rm -f $PIDFILE
|
||||
return "$RETVAL"
|
||||
}
|
||||
|
||||
#
|
||||
# Function that sends a SIGHUP to the daemon/service
|
||||
#
|
||||
do_reload() {
|
||||
#
|
||||
# If the daemon can reload its configuration without
|
||||
# restarting (for example, when it is sent a SIGHUP),
|
||||
# then implement that here.
|
||||
#
|
||||
start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
|
||||
return 0
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
|
||||
do_start
|
||||
case "$?" in
|
||||
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
|
||||
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
|
||||
esac
|
||||
;;
|
||||
stop)
|
||||
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
|
||||
do_stop
|
||||
case "$?" in
|
||||
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
|
||||
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
|
||||
esac
|
||||
;;
|
||||
#reload|force-reload)
|
||||
#
|
||||
# If do_reload() is not implemented then leave this commented out
|
||||
# and leave 'force-reload' as an alias for 'restart'.
|
||||
#
|
||||
#log_daemon_msg "Reloading $DESC" "$NAME"
|
||||
#do_reload
|
||||
#log_end_msg $?
|
||||
#;;
|
||||
restart|force-reload)
|
||||
#
|
||||
# If the "reload" option is implemented then remove the
|
||||
# 'force-reload' alias
|
||||
#
|
||||
log_daemon_msg "Restarting $DESC" "$NAME"
|
||||
do_stop
|
||||
case "$?" in
|
||||
0|1)
|
||||
do_start
|
||||
case "$?" in
|
||||
0) log_end_msg 0 ;;
|
||||
1) log_end_msg 1 ;; # Old process is still running
|
||||
*) log_end_msg 1 ;; # Failed to start
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
# Failed to stop
|
||||
log_end_msg 1
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
|
||||
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
|
||||
exit 3
|
||||
;;
|
||||
esac
|
||||
|
||||
:
|
||||
@@ -1,23 +0,0 @@
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 86
|
||||
/dav/ikwadmin/!svn/ver/4431/linux/puppetmaster/etc_puppet/modules/puppet/files/ganglia
|
||||
END
|
||||
puppetd_lastrun.sh
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 105
|
||||
/dav/ikwadmin/!svn/ver/2810/linux/puppetmaster/etc_puppet/modules/puppet/files/ganglia/puppetd_lastrun.sh
|
||||
END
|
||||
puppetmaster_compiletime.rb
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 114
|
||||
/dav/ikwadmin/!svn/ver/4431/linux/puppetmaster/etc_puppet/modules/puppet/files/ganglia/puppetmaster_compiletime.rb
|
||||
END
|
||||
puppetmaster.rb
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 102
|
||||
/dav/ikwadmin/!svn/ver/2789/linux/puppetmaster/etc_puppet/modules/puppet/files/ganglia/puppetmaster.rb
|
||||
END
|
||||
@@ -1,130 +0,0 @@
|
||||
10
|
||||
|
||||
dir
|
||||
4547
|
||||
https://uwaechte@svn.ikw.uni-osnabrueck.de/dav/ikwadmin/linux/puppetmaster/etc_puppet/modules/puppet/files/ganglia
|
||||
https://uwaechte@svn.ikw.uni-osnabrueck.de/dav/ikwadmin
|
||||
|
||||
|
||||
|
||||
2011-06-21T11:23:42.358929Z
|
||||
4431
|
||||
uwaechte
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
0e4a7186-e024-0410-a49b-aced43e0d94e
|
||||
|
||||
puppetd_lastrun.sh
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2011-07-25T16:18:40.000000Z
|
||||
24ae44e38ab4cb360f1ab69e1079fc4b
|
||||
2009-09-02T08:37:05.052250Z
|
||||
2810
|
||||
uwaechte
|
||||
has-props
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
615
|
||||
|
||||
puppetmaster_compiletime.rb
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2011-07-25T16:18:40.000000Z
|
||||
39f9ddaa47fe615ef7fa28c4cb3d1421
|
||||
2011-06-21T11:23:42.358929Z
|
||||
4431
|
||||
uwaechte
|
||||
has-props
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
945
|
||||
|
||||
puppetmaster.rb
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2011-07-25T16:18:40.000000Z
|
||||
90a0e7478ba23139ac01859e649158b6
|
||||
2009-08-29T13:48:55.793923Z
|
||||
2789
|
||||
uwaechte
|
||||
has-props
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
2204
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
K 12
|
||||
svn:keywords
|
||||
V 2
|
||||
Id
|
||||
END
|
||||
@@ -1,5 +0,0 @@
|
||||
K 12
|
||||
svn:keywords
|
||||
V 2
|
||||
Id
|
||||
END
|
||||
@@ -1,9 +0,0 @@
|
||||
K 14
|
||||
svn:executable
|
||||
V 1
|
||||
*
|
||||
K 12
|
||||
svn:keywords
|
||||
V 2
|
||||
Id
|
||||
END
|
||||
@@ -1,21 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# $Id$
|
||||
|
||||
# plot puppetd last run
|
||||
|
||||
GMETRIC=$(which gmetric)
|
||||
[[ -x ${GMETRIC} ]] || exit 0
|
||||
|
||||
FILE="/var/lib/puppet/state/state.yaml"
|
||||
[[ -r $FILE ]] || exit 0
|
||||
## BSD and Linux have different stat commands
|
||||
if [ $(uname -s) == "Linux" ]; then
|
||||
STIME=$(stat --format="%Y" ${FILE})
|
||||
else
|
||||
STIME=$(stat -f "%m" -t "%s" ${FILE})
|
||||
fi
|
||||
|
||||
NOW=$(date +"%s")
|
||||
GMETRIC="${GMETRIC} --dmax=30000 --tmax=300 --slope=positive --units=lastrun --type=int32"
|
||||
VALUE=$[ ( ${NOW} - ${STIME} ) / 60 ]
|
||||
$GMETRIC --value=${VALUE} --name="Minutes since last Puppet run"
|
||||
@@ -1,72 +0,0 @@
|
||||
#! /bin/env ruby
|
||||
|
||||
# returns the mem usage of a given process
|
||||
$gmetric = %x{which gmetric}.chomp
|
||||
exit 0 unless $gmetric != ""
|
||||
|
||||
def plist(psname)
|
||||
whats = ["rss","size","vsize","cpu"]
|
||||
%x{ps h -o rss,size,vsize,pcpu,command -C ruby1.8 |grep #{psname}|cut -f 1-4 -d ' '}.each do |ps|
|
||||
#rss,size,vsize,cpu,command = ps.split
|
||||
counter = 0
|
||||
ps.split.each { |value|
|
||||
what = whats[counter]
|
||||
counter += 1
|
||||
units = counter == 4 ? "time" : "kbyte"
|
||||
# puts "#{psname}_#{counter}_#{what} V=#{value} U=#{units}"
|
||||
gmetric("#{psname}_#{counter}_#{what}",value,units)
|
||||
}
|
||||
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
def gmetric(name,value,units)
|
||||
%x{#{$gmetric} --type=float --units=#{units} --name=#{name} --value=#{value} --slope=positive --tmax=300 --dmax=300000}
|
||||
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 %d")
|
||||
hour = 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
|
||||
gmetric("puppetmasterd avg_compile",(avg / count).to_s[0..3],"seconds") unless count == 0
|
||||
gmetric("puppetmasterd last5m_count",count,"clients")
|
||||
gmetric("puppetmasterd last24h_unique_count", day_count_unique, "clients")
|
||||
end
|
||||
|
||||
plist("puppetmasterd")
|
||||
gmetric("puppetmasterd known_clients",Dir.entries('/var/lib/puppet/yaml/facts/').size-2,"clients")
|
||||
phaselog
|
||||
@@ -1,21 +0,0 @@
|
||||
#!/usr/bin/env ruby
|
||||
# $Id$
|
||||
|
||||
# returns the mem usage of a given process
|
||||
gmetric = %x{which gmetric}.chomp
|
||||
exit 0 unless gmetric != ""
|
||||
gmetric = "#{gmetric} --type=float --units=seconds --slope=positive --tmax=3600 --dmax=300000"
|
||||
debug = ARGV[0].nil? ? false : true
|
||||
test = debug ? "-t ": ""
|
||||
puts "DEBUG" if debug
|
||||
vals = %x{logtail2 #{test}/var/log/daemon.log |awk '/puppet-master.*Compiled catalog for/ {print $14}'|sort -n}.chomp.split(/\n/).collect { |v| v.to_f }
|
||||
puts vals if debug
|
||||
if vals.length > 0
|
||||
min = vals[0]
|
||||
max = vals[-1]
|
||||
mean = sprintf("%.2f",(vals.inject(0) { |r,v| r += v } / vals.length))
|
||||
out = %x{#{gmetric} --name="puppetmaster MIN compile time" --value=#{min}}
|
||||
out += %x{#{gmetric} --name="puppetmaster MAX compile time" --value=#{max}}
|
||||
out += %x{#{gmetric} --name="puppetmaster MEAN compile time" --value=#{mean}}
|
||||
puts out if debug
|
||||
end
|
||||
Reference in New Issue
Block a user