diff options
| -rwxr-xr-x | usr-lib-nagios-plugins/check_puppetmaster.sh | 13 | 
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 | 
