Puppet agent run reports contain useful metrics, such as the number of resources that were modified or failed to apply, or how much time each step of the run took.
The traditional way of retrieving these metrics is using a report processor on the Puppet master.
Since Prometheus is now a de facto standard in metrics collection, there exists a Prometheus reporter, maintained by the VoxPupuli community. However, it uses a dropzone directory of yaml files with a local node exporter, so it's not a very clean approach.
On top of this, reports and their metrics are already exported to the PuppetDB, which provides its own API to access this data.
Prometheus PuppetDB Exporter
camptocamp / prometheus-puppetdb-exporter
Prometheus Exporter for PuppetDB
Prometheus PuppetDB exporter
Usage
Usage:
prometheus-puppetdb-exporter [OPTIONS]
Application Options:
--version Show version.
-u, --puppetdb-url= PuppetDB base URL. (default: https://puppetdb:8081/pdb/query) [$PUPPETDB_URL]
--cert-file= A PEM encoded certificate file. [$PUPPETDB_CERT_FILE]
--key-file= A PEM encoded private key file. [$PUPPETDB_KEY_FILE]
--ca-file= A PEM encoded CA's certificate. [$PUPPETDB_CA_FILE]
--ssl-skip-verify Skip SSL verification. [$PUPPETDB_SSL_SKIP_VERIFY]
--scrape-interval= Duration between two scrapes. (default: 5s) [$PUPPETDB_SCRAPE_INTERVAL]
--listen-address= Address to listen on for web interface and telemetry. (default: 0.0.0.0:9635)
[$PUPPETDB_LISTEN_ADDRESS]
--metric-path= Path under which to expose metrics. (default: /metrics) [$PUPPETDB_METRIC_PATH]
--verbose Enable debug mode [$PUPPETDB_VERBOSE]
--unreported-node= Tag nodes as unreported if the latest report is older than the defined duration.
(default: 2h) [$PUPPETDB_UNREPORTED_NODE]
--categories= Report metrics categories to scrape. (default: resources,time,changes,events)
[$REPORT_METRICS_CATEGORIES]
Help Options:
-h, --help Show this help message
Metrics
# HELP puppetdb_exporter_build_info puppetdb exporter build informations
# TYPE puppetdb_exporter_build_info gauge
puppetdb_exporter_build_info{build_date="2019-02-18",commit_sha="XXXXXXXXXX",golang_version="go1.11.4",version="1.0.0"} 1
# HELP puppetdb_node_report_status_count Total count of reports status by type
# TYPE puppetdb_node_report_status_count gauge
puppetdb_node_report_status_count{status="changed"} 1
puppetdb_node_report_status_count{status="failed"} 1
…Prometheus PuppetDB Exporter is a simple go binary that can scrape the PuppetDB for report metrics for Prometheus. It runs independently of the Puppet stack, and can be tuned to collect various types of metrics:
- resources
- time
- changes
- events
The exporter provides metrics in the form puppet_report_<type>
for each of these types.
# HELP puppetdb_exporter_build_info puppetdb exporter build informations
# TYPE puppetdb_exporter_build_info gauge
puppetdb_exporter_build_info{build_date="2019-02-18",commit_sha="XXXXXXXXXX",golang_version="go1.11.4",version="1.0.0"} 1
# HELP puppetdb_node_report_status_count Total count of reports status by type
# TYPE puppetdb_node_report_status_count gauge
puppetdb_node_report_status_count{status="changed"} 1
puppetdb_node_report_status_count{status="failed"} 1
puppetdb_node_report_status_count{status="unchanged"} 1
This makes it fully compatible with Vox Pupuli's reporter implementation.
Deploying
The exporter is provided as a Docker image, and is included by default in Camptocamp's PuppetDB Helm chart.
Usage in Grafana
Coupled with (a slightly modified version of) Julien Pivotto's Puppet Report dashboard, you can make some pretty graphs from these metrics:
Top comments (0)