This repository has been archived on 2025-03-16. You can view files and clone it, but cannot push or open issues or pull requests.
Files
puppet/files/ganglia/.svn/text-base/puppetd_lastrun.sh.svn-base
2013-02-02 14:35:50 +01:00

22 lines
559 B
Bash

#!/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"