Last active
March 15, 2016 20:23
-
-
Save natemccurdy/b68497e1769c16e8fab0 to your computer and use it in GitHub Desktop.
Check when the last class refresh happened in the Puppet Node Classifier
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# GIST_URL: https://gist.github.com/b68497e1769c16e8fab0 | |
# Get the timestamp of the last class update in the Node Classifier. | |
# This can be run from any Puppet Master or the Puppet Console. | |
# https://docs.puppetlabs.com/pe/latest/nc_last_class_update.html | |
CONFDIR="$(puppet master --configprint confdir)" | |
CERT="$(puppet master --confdir "${CONFDIR}" --configprint hostcert)" | |
CACERT="$(puppet master --confdir "${CONFDIR}" --configprint localcacert)" | |
PRVKEY="$(puppet master --confdir "${CONFDIR}" --configprint hostprivkey)" | |
OPTIONS="--cert ${CERT} --cacert ${CACERT} --key ${PRVKEY}" | |
CONSOLE="$(awk '/server: /{print $NF}' "${CONFDIR}/classifier.yaml")" | |
/opt/puppetlabs/puppet/bin/curl -s -X GET $OPTIONS "https://${CONSOLE}:4433/classifier-api/v1/last-class-update" | python -m json.tool |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment