Skip to content

Instantly share code, notes, and snippets.

@lsjostro
Created June 3, 2014 13:25
Show Gist options
  • Save lsjostro/bed41eb3c61a12db6445 to your computer and use it in GitHub Desktop.
Save lsjostro/bed41eb3c61a12db6445 to your computer and use it in GitHub Desktop.
puppetdb event report shell function
# req: brew/yum install jq on MacOS X/Linux (install in .bashrc or global profile.d/)
export PUPPETDB_HOST="my.puppetdb.host.foo"
function puppet_report { curl -sG http://$PUPPETDB_HOST/v3/events --data-urlencode "query=[\"and\", [\"=\", \"latest-report?\", true],[\"~\", \"certname\", \"^$1\"]]" | jq -r '.[] | .certname+","+.["resource-type"]+"["+.["resource-title"]+"]" + "," +.status + "," + .message' | column -t -s,; }
export -f puppet_report
@lsjostro
Copy link
Author

lsjostro commented Jun 3, 2014

$ puppet_report www01
www01.foo.bar  Exec[foo]                    success  executed successfully
www01.foo.bar  Service[httpd]             success  ensure changed 'stopped' to 'running'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment