Skip to content

Instantly share code, notes, and snippets.

@op-ct
Created June 3, 2016 23:50
Show Gist options
  • Save op-ct/79c2a53668d86b175d63e1214f8f1082 to your computer and use it in GitHub Desktop.
Save op-ct/79c2a53668d86b175d63e1214f8f1082 to your computer and use it in GitHub Desktop.
Some collectd.conf settings for PuppetDB
# Selected portions of /etc/collectd.conf to monitor OS some PuppetDB metrics.
# Take the useful bits and wisely merge them into your own!
# ------------------------------------------------------------------------------
# collectd logging plugins
# ------------------------------------------------------------------------------
# logs the behavior of collectd itself. It's somewhat noisy and the log bloats up on busy systems
# Occasionally useful for troubleshooting
### LoadPlugin logfile
# Starts a local log file in logstash-friendly json format.
LoadPlugin log_logstash
<Plugin log_logstash>
LogLevel info
File "/var/log/collectd.json.log"
</Plugin>
# allows us to sebd our data to another collectd instance. In systems the need to minimize disk I/O
LoadPlugin network
# Needed to get any output
LoadPlugin write_log
# ------------------------------------------------------------------------------
# os metrics plugins
# ------------------------------------------------------------------------------
LoadPlugin cpu
LoadPlugin disk
LoadPlugin interface
LoadPlugin load
LoadPlugin memory
LoadPlugin vmem
# libvirt, useful on virt hosts to break down metrics per VM
LoadPlugin virt
# ------------------------------------------------------------------------------
# report PuppetDB metrics
# ------------------------------------------------------------------------------
# Note: it seems that, although curl_json can be # configured to accept SSL CA
# certs, it is not possible to specify an SSL key or # certificate for the
# (collectd+libcurl) client itself. :/
#
# So, these queries point to the plaintext HTTP, localhost-only API service on
# the PuppetDB server.
#
# Other things:
# - This uses v3 PuppetDB API.
# - Many of PuppetDB's endpoints do not lend themselves to mass *-based #
# collections, so each URL must be individually worked out. If you want to add
# to it, it's easiest to query `/v3/metrics/mbeans` for a mapping between the
# endpoints and the names you'll add to the URL tags below.
# - We decided to query these particular data points every 60 seconds instead
# of the global default of 10
# ------------------------------------------------------------------------------
LoadPlugin curl_json
<Plugin "curl_json">
# - For info on Types, see: https://collectd.org/wiki/index.php/Data_source
# The number of nodes in your population.
<URL "http://localhost:8138/v3/metrics/mbean/com.puppetlabs.puppetdb.query.population%3Atype%3Ddefault%2Cname%3Dnum-nodes">
Interval 60
Instance "puppetdb"
Header "Accept: application/json"
<Key "Value">
Instance "num-nodes"
Type "count"
</Key>
</URL>
<URL "http://localhost:8138/v3/aggregate-event-counts?query=%5B%22%3D%22%2C%22latest-report%3F%22%2Ctrue%5D&summarize-by=resource">
Interval 60
Instance "puppet-aggregate-event-counts"
Header "Accept: application/json"
<Key "*">
Type "gauge"
</Key>
</URL>
# The average number of resources per node in your population.
<URL "http://localhost:8138/v3/metrics/mbean/com.puppetlabs.puppetdb.query.population%3Atype%3Ddefault%2Cname%3Davg-resources-per-node">
Interval 60
Instance "puppetdb-avg-resources-per-node"
Header "Accept: application/json"
Instance "puppetdb"
<Key "Value">
Type "gauge"
Instance "avg-resources-per-node"
</Key>
</URL>
# Database connection pool metrics. How long it takes to get a free
# connection, average execution times, number of free connections, etc.
<URL "http://localhost:8138/v3/metrics/mbean/com.jolbox.bonecp:type=BoneCP">
Interval 60
Instance "puppetdb-metrics"
Header "Accept: application/json"
<Key "*">
Type "gauge"
</Key>
</URL>
# JVM memory statistics (returns hash k/v pairs)
<URL "http://localhost:8138/v3/metrics/mbean/java.lang:type=Memory">
Interval 60
Instance "puppetdb-jvm'"
Header "Accept: application/json"
<Key "HeapMemoryUsage/*">
Type "gauge"
</Key>
<Key "NonHeapMemoryUsage/*">
Type "gauge"
</Key>
</URL>
</Plugin>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment