adding ganglia checks

This commit is contained in:
Udo Waechter
2013-06-05 13:53:00 +02:00
parent c7f29f670d
commit b33d9437a2
3 changed files with 34 additions and 2 deletions

View File

@@ -0,0 +1,21 @@
#!/usr/bin/env bash
# $Id: puppetd_lastrun.sh 2810 2009-09-02 08:37:05Z uwaechte $
# 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=350 --units=lastrun --type=int32"
VALUE=$[ ( ${NOW} - ${STIME} ) / 60 ]
$GMETRIC --value=${VALUE} --name="Minutes since last Puppet run"