alphagov/nagios-plugins — pull request #7 by dcarley (2014-09-01 16:04:12+00:00)
Title: [#77197788] Add check_puppetdb_ssh_host_keys

A new check that will query PuppetDB for exported `sshkey` resources and
raise an alert if any duplicates are found. This will be used to prevent
provisioning errors where a new host key isn't generated for new machines.

The output lists all of the affected hosts grouped by SSH key. I've
converted the public key to a fingerprint to make the output easier to read.
It will raise UNKNOWN if there are less than two hosts found. This should
prevent any problems with the PuppetDB query terms giving false-negatives.

It will also handle any errors, such as failing to connect to PuppetDB or
parsing the JSON output, for us. Although I'm not sure how to test that. It
works on the command line but not in nose.

PuppetDB hostname, protocol and API version are all configurable. But they
default to the values that we currently need. Techincally this API endpoint
should be the same for version 1 through to 4.