File: //usr/lib/check_mk_agent/plugins/120/locaweb-puppet
#!/bin/bash
if [ -e "/var/lib/puppet/state/last_run_summary.yaml" ]; then
LASTRUN="/var/lib/puppet/state/last_run_summary.yaml"
elif [ -e "/opt/puppetlabs/puppet/cache/state/last_run_summary.yaml" ]; then
LASTRUN="/opt/puppetlabs/puppet/cache/state/last_run_summary.yaml"
elif [ -e "/var/cache/puppet/state/last_run_summary.yaml" ]; then
LASTRUN="/var/cache/puppet/state/last_run_summary.yaml"
fi
if [ -e "${LASTRUN}" ]; then
OUT="$(cat ${LASTRUN} | sed 's/[[:space:]]\{2,\}//g')"
echo "<<<check_puppet_agent>>>"
echo "${OUT}" | grep 'last_run'
echo "${OUT}" | grep -A8 '^resources: *$' | sed 's/^/resources_/g'
echo "${OUT}" | grep -A3 '^events: *$' | sed 's/^/events_/g'
fi