summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2018-07-25 15:50:21 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2018-07-25 15:50:21 +0200
commit4b9b8e7de2e127b179bcae3599f52c503bd20023 (patch)
treed834f26f9132279170ae10caae61d92c756dd8cd
parent1e9cf28f5bf3c468817ff98131587f08ccc428f1 (diff)
downloaditzks-systems-4b9b8e7de2e127b179bcae3599f52c503bd20023.tar.gz
itzks-systems-4b9b8e7de2e127b179bcae3599f52c503bd20023.tar.bz2
itzks-systems-4b9b8e7de2e127b179bcae3599f52c503bd20023.zip
usr-lib-nagios-plugins/check_puppetmaster.sh: Port to being used against puppet 4.8.x.
-rwxr-xr-xusr-lib-nagios-plugins/check_puppetmaster.sh13
1 files changed, 6 insertions, 7 deletions
diff --git a/usr-lib-nagios-plugins/check_puppetmaster.sh b/usr-lib-nagios-plugins/check_puppetmaster.sh
index 5799a41..67bd249 100755
--- a/usr-lib-nagios-plugins/check_puppetmaster.sh
+++ b/usr-lib-nagios-plugins/check_puppetmaster.sh
@@ -104,9 +104,9 @@ while true ; do
esac
done
-URL="https://${PUPPETMASTER}:${PORT}/production/node/${HOST}"
+URL="https://${PUPPETMASTER}:${PORT}/puppet/v3/node/${HOST}?environment=production"
T1=`date +%s.%N`
-CURL_NODE="`curl -sS --max-time $TIMEOUT --insecure -H 'Accept: yaml' --cert $SSLDIR/certs/${HOST}.pem --key $SSLDIR/private_keys/${HOST}.pem --cacert $SSLDIR/certs/ca.pem "${URL}" 2>&1`"
+CURL_NODE="`curl -sS --max-time $TIMEOUT --insecure -H 'Accept: pson' --cert $SSLDIR/certs/${HOST}.pem --key $SSLDIR/private_keys/${HOST}.pem --cacert $SSLDIR/certs/ca.pem "${URL}" 2>&1`"
CURL_RESULT=$?
T2=`date +%s.%N`
@@ -115,14 +115,13 @@ PERF_TIME=$( perl -e "printf('%1.3f', $T2 - $T1);" )
if [ "$CURL_RESULT" != 0 ]; then
EXIT=2
MESSAGE="${URL} $CURL_NODE"
-elif FOUND=$( echo "$CURL_NODE" | grep -m 1 environment: ) ; then
- # trim spaces...
- FOUND=`sed 's/^ *.//' <<<$FOUND`
+elif echo $CURL_NODE | grep '"environment":'; then
+ FOUND=$( echo "$CURL_NODE" | sed -r -e 's/.*"environment":"([^"]+)".*/\1/' )
EXIT=0
- MESSAGE="found '${FOUND}' in https://${PUPPETMASTER}:${PORT}/production/node/${HOST}"
+ MESSAGE="found '${FOUND}' in https://${PUPPETMASTER}:${PORT}/puppet/v3/node/${HOST}?environment=production"
else
EXIT=1
- MESSAGE="environment not found in https://${PUPPETMASTER}:${PORT}/production/node/${HOST}"
+ MESSAGE="environment not found in https://${PUPPETMASTER}:${PORT}/puppet/v3/node/${HOST}?environment=production"
fi
if ! perl -e "exit( $PERF_TIME >= $TIME_CRIT )" ; then