diff --git a/.fixtures.yml b/.fixtures.yml index 0e5e6a74..ae45b496 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -15,4 +15,7 @@ fixtures: yumrepo: repo: https://github.com/puppetlabs/puppetlabs-yumrepo_core.git ref: 1.0.2 + telegraf: + repo: https://github.com/voxpupuli/puppet-telegraf.git + ref: v2.1.0 forge_modules: diff --git a/Gemfile b/Gemfile index fe273cda..98b8c9e3 100644 --- a/Gemfile +++ b/Gemfile @@ -23,6 +23,7 @@ group :development do gem "json", '= 1.8.1', require: false if Gem::Version.new(RUBY_VERSION.dup) == Gem::Version.new('2.1.9') gem "json", '= 2.0.4', require: false if Gem::Requirement.create('~> 2.4.2').satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) gem "json", '= 2.1.0', require: false if Gem::Requirement.create(['>= 2.5.0', '< 2.7.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) + gem "toml-rb", '= 1.1.2', require: false, platforms: [:ruby] gem "puppet-module-posix-default-r#{minor_version}", '~> 0.3', require: false, platforms: [:ruby] gem "puppet-module-posix-dev-r#{minor_version}", '~> 0.3', require: false, platforms: [:ruby] gem "puppet-module-win-default-r#{minor_version}", '~> 0.3', require: false, platforms: [:mswin, :mingw, :x64_mingw] diff --git a/README.md b/README.md index 3a87ab6a..554fb665 100644 --- a/README.md +++ b/README.md @@ -13,25 +13,44 @@ ## Description -This module is used to configure grafana, telegraf, and influxdb to consume metrics from Puppet service. +This module is used to configure grafana and influxdb to consume metrics from Puppet services. +By default the metrics collection is done by another service called telegraf. -You have the option of getting metrics from any or all of three of these methods: +These services can all run on a single server by applying the base class. You also have the option +to use the [included defined types](#profile-defined-types) to configure telegraf on each of your Puppet infrastructure components +(master,compilers, puppetdb, postgres server) and the metrics will be stored on another server +running grafana and influxdb. In environments where there is an existing grafana / influxdb +instance, the later option is recommended. See [Determining where telegraf runs](#determining-where-telegraf-runs) for further +details. +You have the option of collecting metrics using any or all of these methods: + +* Through telegraf, which polls several of Puppet's metrics endpoints (recommended) * Through Archive files from the [puppetlabs/puppet_metrics_collector](https://forge.puppet.com/puppetlabs/puppet_metrics_collector) module * Natively, via Puppetserver's [built-in graphite support](https://puppet.com/docs/pe/2019.0/getting_started_with_graphite.html#task-7933) -* Through telegraf, which polls several of Puppet's metrics endpoints ## Setup -### Upgrade note +### Upgrade notes, breaking changes in v2 + +The `puppet_metrics_dashboard::profile::postgres` class is now deprecated and you should use the `puppet_metrics_dashboard::profile::Master::postgres_access` class instead. + +Parameters `telegraf_agent_interval` and `http_response_timeout` were previously integers but are now strings. The value should match a time interval, such as `5s`, `10m`, or `1h`. + +`influxdb_urls` was previously a string, it should now be an array. Previous versions of this module put several `[[inputs.httpjson]]` entries in `/etc/telegraf/telegraf.conf`. These entries should be removed now as all -module-specific settings now reside in -`/etc/telegraf/telegraf.d/puppet_metrics_dashboard.conf`. Telegraf will -continue to work if you do not remove them, however, the old +module-specific settings now reside in individual files within +`/etc/telegraf/telegraf.d/`. Telegraf will continue to work if you do not remove them, however, the old `[[inputs.httpjson]]` will not be updated going forward. +### Determining where telegraf runs + +Telegraf can run on the grafana server or on each Puppet infrastructure node. To configure telegraf to run on the same host that +grafana runs on, use the `puppet_metrics_dashboard` class and the parameters: `master_list`, `puppetdb_list` and `postgres_host_list`. These parameters determine which hosts that telegraf polls. + +To configure telegraf to run on each Puppet infrastructure node, use the corresponding profiles for those hosts. See [Profile defined types](#profile-defined-types). The `puppet_metrics_dashboard` class is still applied to a separate host to setup grafana and influxdb and the profile classes configure telegraf when applied to your Puppet infrastructure hosts. ### Beginning with puppet_metrics_dashboard @@ -45,12 +64,11 @@ include puppet_metrics_dashboard ## Usage -### To install example dashboards for all of the collection methods: +### To install example dashboards and use the telegraf collection method (default): ``` class { 'puppet_metrics_dashboard': add_dashboard_examples => true, - influxdb_database_name => ['puppet_metrics','telegraf','graphite'], } ``` @@ -59,7 +77,6 @@ class { 'puppet_metrics_dashboard': ``` class { 'puppet_metrics_dashboard': add_dashboard_examples => true, - influxdb_database_name => ['puppet_metrics','telegraf','graphite'], overwrite_dashboards => false, } ``` @@ -68,8 +85,6 @@ class { 'puppet_metrics_dashboard': ``` class { 'puppet_metrics_dashboard': - configure_telegraf => true, - enable_telegraf => true, master_list => ['master1.com', # Alternate ports may be configured using # a pair of: [hostname, port_number] @@ -79,18 +94,6 @@ class { 'puppet_metrics_dashboard': } ``` -### Allow access to PE-managed postgres nodes with the following class: - -This is required for collection of postgres metrics. - -``` -class { 'puppet_metrics_dashboard::profile::postgres': - grafana_host => 'postgres01', -} -``` - -`grafana_host` is optional. If you do not specify it, the class will look for a node with the `puppet_metrics_dashboard` class applied in PuppetDB and use the `certname` of the first host returned. If the PuppetDB lookup fails and you do not specify `grafana_host` then the class outputs a warning. - ### Enable Graphite support ``` @@ -102,17 +105,15 @@ class { 'puppet_metrics_dashboard': } ``` -* This method requires enabling on the master side as described [here](https://puppet.com/docs/pe/2017.3/puppet_server_metrics/getting_started_with_graphite.html#enabling-puppet-server-graphite-support). The hostname(s) that you use in `master_list` should match the value(s) that you used for `metrics_server_id` in the `puppet_enterprise::profile::master` class. +* This method requires enabling on the master side as described [here](https://puppet.com/docs/pe/latest/puppet_server_metrics/getting_started_with_graphite.html#enabling-puppet-server-graphite-support). The hostname(s) that you use in `master_list` should match the value(s) that you used for `metrics_server_id` in the `puppet_enterprise::profile::master` class. -### Enable Telegraf, Graphite, and Archive +### Enable Telegraf, Graphite, and Archive (puppet_metrics) ``` class { 'puppet_metrics_dashboard': add_dashboard_examples => true, influxdb_database_name => ['puppet_metrics','telegraf','graphite'], consume_graphite => true, - configure_telegraf => true, - enable_telegraf => true, } ``` @@ -130,14 +131,63 @@ By default, this will create a set of certificates in `/etc/grafana` that are ba _Note:_ Enabling SSL on Grafana will not allow for running on privileged ports such as `443`. To enable this capability you can use the suggestions documented in [this Grafana documentation](http://docs.grafana.org/installation/configuration/#http-port) +### Allow access to PE-managed postgres nodes with the following class: + +This is required for collection of postgres metrics. The class should be applied to the master (or postgres server if using external postgres). + +``` +class { 'puppet_metrics_dashboard::profile::master::postgres_access': + telegraf_host => 'grafana-server.example.com', +} +``` + +`telegraf_host` is optional. If you do not specify it, the class will look for a node with the `puppet_metrics_dashboard` class applied in PuppetDB and use the `certname` of the first host returned. If the PuppetDB lookup fails and you do not specify `telegraf_host` then the class outputs a warning. + +### Profile defined types + +The module includes defined types that you can use with an existing grafana implementation. For example: + +#### Add telegraf to a master / compiler + +``` +puppet_metrics_dashboard::profile::compiler{ $facts['networking']['fqdn']: + timeout => '5s', +} +``` + +#### Add telegraf to a puppetdb node (see params.pp for `puppetdb_metrics` examples) + +``` +puppet_metrics_dashboard::profile::puppetdb{ $facts['networking']['fqdn']: + timeout => '5s', + puppetdb_metrics => [ + { 'name' => 'global_command-parse-time', + 'url' => 'puppetlabs.puppetdb.mq:name=global.command-parse-time' }, + { 'name' => 'global_discarded', + 'url' => 'puppetlabs.puppetdb.mq:name=global.discarded' }, + ] +} +``` + +#### Add telegraf to a postgres server + +``` +puppet_metrics_dashboard::profile::master::postgres{ $facts['networking']['fqdn']: + query_interval => '10m', +} +``` + +#### Note on using the defined types + +Because of the way that the telegraf module works, these examples will overwrite any configuration in telegraf.config if it is *not* already puppet-managed. See the [puppet-telegraf documentation](https://forge.puppet.com/puppet/telegraf#usage) on how to manage this file and add important settings. + ### Other possibilities -Configure the passwords for the InfluxDB and Grafana administrator users and enable additional [TICK Stack](https://www.influxdata.com/time-series-platform/) components. +Configure the passwords for the InfluxDB and enable additional [TICK Stack](https://www.influxdata.com/time-series-platform/) components. ``` class { 'puppet_metrics_dashboard': influx_db_password => 'secret', - grafana_password => 'secret', grafana_http_port => 8080, grafana_version => '4.5.2', enable_chronograf => true, @@ -147,7 +197,7 @@ class { 'puppet_metrics_dashboard': ## Reference -**Note** This section is no longer maintained. Please see the REFERENCE.MD file for current listings. +**Note** This section is no longer maintained. Please see the REFERENCE.MD file for current listings. ## Limitations @@ -159,7 +209,7 @@ Error: Execution of '/usr/bin/yum -d 0 -e 0 -y install telegraf' returned 1: Err Error: /Stage[main]/Pe_metrics_dashboard::Telegraf/Package[telegraf]/ensure: change from purged to present failed: Execution of '/usr/bin/yum -d 0 -e 0 -y install telegraf' returned 1: Error: Cannot retrieve repository metadata (repomd.xml) for repository: influxdb. Please verify its path and try again ``` -To recify the issue, please update `nss` and `curl` on the affected system. +To rectify the issue, please update `nss` and `curl` on the affected system. ``` yum install curl nss --disablerepo influxdb diff --git a/REFERENCE.md b/REFERENCE.md index 44bd8b61..e0419d04 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -23,7 +23,6 @@ * `puppet_metrics_dashboard::service`: Manages services * `puppet_metrics_dashboard::telegraf`: Install and configure Telegraf * `puppet_metrics_dashboard::telegraf::config`: Configures Telegraf -* `puppet_metrics_dashboard::telegraf::install`: Installs Telegraf * `puppet_metrics_dashboard::telegraf::service`: Manages the Telegraf service ## Defined types diff --git a/manifests/init.pp b/manifests/init.pp index c6aa143d..14bb2ad0 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -32,7 +32,7 @@ # @param consume_graphite # Whether to enable the InfluxDB Graphite plugin. # Valid values are `true`, `false`. Defaults to `false` -# This parameter enables the Graphite plugin for InfluxDB to allow for injesting Graphite metrics. Ensure `influxdb_database_name` +# This parameter enables the Graphite plugin for InfluxDB to allow for injesting Graphite metrics. Ensure `influxdb_database_name` # contains `graphite` when using this parameter. # _Note:_ If using Graphite metrics from the Puppet Master, this needs to be set to `true`. # @@ -52,8 +52,8 @@ # @param influxdb_database_name # An array of databases that should be created in InfluxDB. # Valid values are 'puppet_metrics','telegraf', 'graphite', and any other string. Defaults to `['puppet_metrics']` -# Each database in the array will be created in InfluxDB. 'puppet_metrics','telegraf', and 'graphite' are specially named and will -# be used with their associated metric collection method. Any other database name will be created, but not utilized with +# Each database in the array will be created in InfluxDB. 'puppet_metrics','telegraf', and 'graphite' are specially named and will +# be used with their associated metric collection method. Any other database name will be created, but not utilized with # components in this module. # # @param influx_db_password @@ -86,16 +86,19 @@ # Defaults to `[$trusted['certname']]` # # @param influxdb_urls -# The string for telegraf's config defining where influxdb is +# An array for telegraf's config defining where influxdb instances are # # @param telegraf_db_name # The database in influxdb where telefraf metrics are stored # # @param telegraf_agent_interval -# How often the telefraf agent queries for metrics +# How often the telefraf agent queries for metrics. Defaults to "5s" # # @param http_response_timeout -# How long to wait for the queries by telegraf to finish before giving up +# How long to wait for the queries by telegraf to finish before giving up. Defaults to "5s" +# +# @param pg_query_interval +# How often postgres queries will run when monitoring a postgres host. Defaults to "10m" # # @param overwrite_dashboards # Whether to overwrite the example Grafana dashboards. @@ -113,7 +116,7 @@ # integer that specifies the port number. # Defaults to `[$trusted['certname']]` # -# @param puppetdb_list +# @param postgres_host_list # A list of PostgreSQL servers that Telegraf will be configured to # collect metrics from. Entries in the list may be: # - A single string that contains a hostname or IP address. @@ -203,13 +206,15 @@ Boolean $enable_telegraf = $puppet_metrics_dashboard::params::enable_telegraf, Boolean $configure_telegraf = $puppet_metrics_dashboard::params::configure_telegraf, Boolean $consume_graphite = $puppet_metrics_dashboard::params::consume_graphite, - Puppet_metrics_dashboard::HostList $master_list = $puppet_metrics_dashboard::params::master_list, - Puppet_metrics_dashboard::HostList $puppetdb_list = $puppet_metrics_dashboard::params::puppetdb_list, - Puppet_metrics_dashboard::HostList $postgres_host_list = $puppet_metrics_dashboard::params::postgres_host_list, - String $influxdb_urls = $puppet_metrics_dashboard::params::influxdb_urls, + Puppet_metrics_dashboard::HostList $master_list = $puppet_metrics_dashboard::params::master_list, + Puppet_metrics_dashboard::HostList $puppetdb_list = $puppet_metrics_dashboard::params::puppetdb_list, + Puppet_metrics_dashboard::HostList $postgres_host_list = $puppet_metrics_dashboard::params::postgres_host_list, + Puppet_metrics_dashboard::Puppetdb_metric $puppetdb_metrics = $puppet_metrics_dashboard::params::puppetdb_metrics, + Array[String] $influxdb_urls = $puppet_metrics_dashboard::params::influxdb_urls, String $telegraf_db_name = $puppet_metrics_dashboard::params::telegraf_db_name, - Integer[1] $telegraf_agent_interval = $puppet_metrics_dashboard::params::telegraf_agent_interval, - Integer[1] $http_response_timeout = $puppet_metrics_dashboard::params::http_response_timeout, + String[2] $telegraf_agent_interval = $puppet_metrics_dashboard::params::telegraf_agent_interval, + String[2] $http_response_timeout = $puppet_metrics_dashboard::params::http_response_timeout, + String[2] $pg_query_interval = $puppet_metrics_dashboard::params::pg_query_interval, ) inherits puppet_metrics_dashboard::params { if $manage_repos { contain puppet_metrics_dashboard::repos diff --git a/manifests/params.pp b/manifests/params.pp index c85ca815..bb0131a6 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -27,13 +27,181 @@ $master_list = [$trusted['certname']] $puppetdb_list = [$trusted['certname']] $postgres_host_list = [$trusted['certname']] - $influxdb_urls = "['http://localhost:8086']" + $influxdb_urls = ['http://localhost:8086'] $telegraf_db_name = 'telegraf' - $telegraf_agent_interval = 5 - $http_response_timeout = 5 # this is the default value for the HTTP JSON Input + $telegraf_agent_interval = '5s' + $http_response_timeout = '5s' # this is the default value for the HTTP JSON Input + $pg_query_interval = '10m' $overwrite_dashboards_file = '/opt/puppetlabs/puppet/cache/state/overwrite_dashboards_disabled' + $activemq_metrics = [ + { 'name' => 'amq_metrics', + 'url' => 'org.apache.activemq:type=Broker,brokerName=localhost,destinationType=Queue,destinationName=puppetlabs.puppetdb.commands' }, + ] + + $base_metrics = [ + { 'name' => 'global_command-parse-time', + 'url' => 'puppetlabs.puppetdb.mq:name=global.command-parse-time' }, + { 'name' => 'global_discarded', + 'url' => 'puppetlabs.puppetdb.mq:name=global.discarded' }, + { 'name' => 'global_fatal', + 'url' => 'puppetlabs.puppetdb.mq:name=global.fatal' }, + { 'name' => 'global_message-persistence-time', + 'url' => 'puppetlabs.puppetdb.mq:name=global.message-persistence-time' }, + { 'name' => 'global_retried', + 'url' => 'puppetlabs.puppetdb.mq:name=global.retried' }, + { 'name' => 'global_retry-counts', + 'url' => 'puppetlabs.puppetdb.mq:name=global.retry-counts' }, + { 'name' => 'global_seen', + 'url' => 'puppetlabs.puppetdb.mq:name=global.seen' }, + { 'name' => 'global_processed', + 'url' => 'puppetlabs.puppetdb.mq:name=global.processed' }, + { 'name' => 'global_processing-time', + 'url' => 'puppetlabs.puppetdb.mq:name=global.processing-time' }, + ] + + $base_metrics_through_4_2 = [ + { 'name' => 'global_generate-retry-message-time', + 'url' => 'puppetlabs.puppetdb.mq:name=global.generate-retry-message-time' }, + { 'name' => 'global_retry-persistence-time', + 'url' => 'puppetlabs.puppetdb.mq:name=global.retry-persistence-time' }, + ] + + $storage_metrics = [ + { 'name' => 'storage_add-edges', + 'url' => 'puppetlabs.puppetdb.storage:name=add-edges' }, + { 'name' => 'storage_add-resources', + 'url' => 'puppetlabs.puppetdb.storage:name=add-resources' }, + { 'name' => 'storage_catalog-hash', + 'url' => 'puppetlabs.puppetdb.storage:name=catalog-hash' }, + { 'name' => 'storage_catalog-hash-match-time', + 'url' => 'puppetlabs.puppetdb.storage:name=catalog-hash-match-time' }, + { 'name' => 'storage_catalog-hash-miss-time', + 'url' => 'puppetlabs.puppetdb.storage:name=catalog-hash-miss-time' }, + { 'name' => 'storage_gc-catalogs-time', + 'url' => 'puppetlabs.puppetdb.storage:name=gc-catalogs-time' }, + { 'name' => 'storage_gc-environments-time', + 'url' => 'puppetlabs.puppetdb.storage:name=gc-environments-time' }, + { 'name' => 'storage_gc-fact-paths', + 'url' => 'puppetlabs.puppetdb.storage:name=gc-fact-paths' }, + { 'name' => 'storage_gc-params-time', + 'url' => 'puppetlabs.puppetdb.storage:name=gc-params-time' }, + { 'name' => 'storage_gc-report-statuses', + 'url' => 'puppetlabs.puppetdb.storage:name=gc-report-statuses' }, + { 'name' => 'storage_gc-time', + 'url' => 'puppetlabs.puppetdb.storage:name=gc-time' }, + { 'name' => 'storage_new-catalog-time', + 'url' => 'puppetlabs.puppetdb.storage:name=new-catalog-time' }, + { 'name' => 'storage_new-catalogs', + 'url' => 'puppetlabs.puppetdb.storage:name=new-catalogs' }, + { 'name' => 'storage_replace-catalog-time', + 'url' => 'puppetlabs.puppetdb.storage:name=replace-catalog-time' }, + { 'name' => 'storage_replace-facts-time', + 'url' => 'puppetlabs.puppetdb.storage:name=replace-facts-time' }, + { 'name' => 'storage_resource-hashes', + 'url' => 'puppetlabs.puppetdb.storage:name=resource-hashes' }, + { 'name' => 'storage_store-report-time', + 'url' => 'puppetlabs.puppetdb.storage:name=store-report-time' }, + ] + + #TODO: Track these on a less frequent cadence because they are slow to run + $storage_metrics_db_queries = [ + { 'name' => 'storage_catalog-volitilty', + 'url' => 'puppetlabs.puppetdb.storage:name=catalog-volitilty' }, + { 'name' => 'storage_duplicate-catalogs', + 'url' => 'puppetlabs.puppetdb.storage:name=duplicate-catalogs' }, + { 'name' => 'storage_duplicate-pct', + 'url' => 'puppetlabs.puppetdb.storage:name=duplicate-pct' }, + ] + + $numbers = $facts['pe_server_version'] ? { + /^2015.2/ => {'catalogs' => 6, 'facts' => 4, 'reports' => 6}, + /^2015.3/ => {'catalogs' => 7, 'facts' => 4, 'reports' => 6}, + /^2016.(1|2)/ => {'catalogs' => 8, 'facts' => 4, 'reports' => 7}, + /^2016.(4|5)/ => {'catalogs' => 9, 'facts' => 5, 'reports' => 8}, + /^2017.(1|2)/ => {'catalogs' => 9, 'facts' => 5, 'reports' => 8}, + default => {'catalogs' => 9, 'facts' => 5, 'reports' => 8}, + } + + $version_specific_metrics = [ + { 'name' => 'mq_replace_catalog_retried', + 'url' => "puppetlabs.puppetdb.mq:name=replace catalog.${numbers['catalogs']}.retried" }, + { 'name' => 'mq_replace_catalog_retry-counts', + 'url' => "puppetlabs.puppetdb.mq:name=replace catalog.${numbers['catalogs']}.retry-counts" }, + { 'name' => 'mq_replace_facts_retried', + 'url' => "puppetlabs.puppetdb.mq:name=replace facts.${numbers['facts']}.retried" }, + { 'name' => 'mq_replace_facts_retry-counts', + 'url' => "puppetlabs.puppetdb.mq:name=replace facts.${numbers['facts']}.retry-counts" }, + { 'name' => 'mq_store_report_retried', + 'url' => "puppetlabs.puppetdb.mq:name=store report.${numbers['reports']}.retried" }, + { 'name' => 'mq_store_reports_retry-counts', + 'url' => "puppetlabs.puppetdb.mq:name=store report.${numbers['reports']}.retry-counts" }, + ] + + $connection_pool_metrics = [ + { 'name' => 'PDBReadPool_pool_ActiveConnections', + 'url' => 'puppetlabs.puppetdb.database:name=PDBReadPool.pool.ActiveConnections' }, + { 'name' => 'PDBReadPool_pool_IdleConnections', + 'url' => 'puppetlabs.puppetdb.database:name=PDBReadPool.pool.IdleConnections' }, + { 'name' => 'PDBReadPool_pool_PendingConnections', + 'url' => 'puppetlabs.puppetdb.database:name=PDBReadPool.pool.PendingConnections' }, + { 'name' => 'PDBReadPool_pool_TotalConnections', + 'url' => 'puppetlabs.puppetdb.database:name=PDBReadPool.pool.TotalConnections' }, + { 'name' => 'PDBReadPool_pool_Usage', + 'url' => 'puppetlabs.puppetdb.database:name=PDBReadPool.pool.Usage' }, + { 'name' => 'PDBReadPool_pool_Wait', + 'url' => 'puppetlabs.puppetdb.database:name=PDBReadPool.pool.Wait' }, + { 'name' => 'PDBWritePool_pool_ActiveConnections', + 'url' => 'puppetlabs.puppetdb.database:name=PDBWritePool.pool.ActiveConnections' }, + { 'name' => 'PDBWritePool_pool_IdleConnections', + 'url' => 'puppetlabs.puppetdb.database:name=PDBWritePool.pool.IdleConnections' }, + { 'name' => 'PDBWritePool_pool_PendingConnections', + 'url' => 'puppetlabs.puppetdb.database:name=PDBWritePool.pool.PendingConnections' }, + { 'name' => 'PDBWritePool_pool_TotalConnections', + 'url' => 'puppetlabs.puppetdb.database:name=PDBWritePool.pool.TotalConnections' }, + { 'name' => 'PDBWritePool_pool_Usage', + 'url' => 'puppetlabs.puppetdb.database:name=PDBWritePool.pool.Usage' }, + { 'name' => 'PDBWritePool_pool_Wait', + 'url' => 'puppetlabs.puppetdb.database:name=PDBWritePool.pool.Wait' }, + ] + + $ha_sync_metrics = [ + { 'name' => 'ha_last-sync-succeeded', + 'url' => 'puppetlabs.puppetdb.ha:name=last-sync-succeeded' }, + { 'name' => 'ha_seconds-since-last-successful-sync', + 'url' => 'puppetlabs.puppetdb.ha:name=seconds-since-last-successful-sync' }, + { 'name' => 'ha_failed-request-counter', + 'url' => 'puppetlabs.puppetdb.ha:name=failed-request-counter' }, + { 'name' => 'ha_sync-duration', + 'url' => 'puppetlabs.puppetdb.ha:name=sync-duration' }, + { 'name' => 'ha_catalogs-sync-duration', + 'url' => 'puppetlabs.puppetdb.ha:name=catalogs-sync-duration' }, + { 'name' => 'ha_reports-sync-duration', + 'url' => 'puppetlabs.puppetdb.ha:name=reports-sync-duration' }, + { 'name' => 'ha_factsets-sync-duration', + 'url' => 'puppetlabs.puppetdb.ha:name=factsets-sync-duration' }, + { 'name' => 'ha_nodes-sync-duration', + 'url' => 'puppetlabs.puppetdb.ha:name=nodes-sync-duration' }, + { 'name' => 'ha_record-transfer-duration', + 'url' => 'puppetlabs.puppetdb.ha:name=record-transfer-duration' }, + ] + + # lint:ignore:140chars + $puppetdb_metrics = $facts['pe_server_version'] ? { + /^2015./ => + $activemq_metrics, + /^2016\.[45]\./ => + $activemq_metrics + $base_metrics + $base_metrics_through_4_2 + $storage_metrics + $connection_pool_metrics + $version_specific_metrics + $ha_sync_metrics, + /^2016./ => + $activemq_metrics + $base_metrics + $base_metrics_through_4_2 + $storage_metrics + $connection_pool_metrics + $version_specific_metrics, + /^201[78]\./ => + $activemq_metrics + $base_metrics + $storage_metrics + $connection_pool_metrics + $version_specific_metrics + $ha_sync_metrics, + default => + $base_metrics + $storage_metrics + $connection_pool_metrics + $version_specific_metrics, + } + # lint:endignore + case $facts['os']['family'] { 'RedHat': { $influx_db_service_name = 'influxdb' diff --git a/manifests/profile/compiler.pp b/manifests/profile/compiler.pp new file mode 100644 index 00000000..fa8f8339 --- /dev/null +++ b/manifests/profile/compiler.pp @@ -0,0 +1,46 @@ +# @summary Apply this class to a master or compiler to collect puppetserver metrics +# +# @param timeout +# Deafault timeout of http calls. Defaults to 5 seconds +# +# @param compiler +# The FQDN of the compiler / master. Defaults to the FQDN of the server where the profile is applied +# +# @param port +# The port that the puppetserver service listens on on your compiler. Defaults to 8140 +# +# @param interval +# The frequency that telegraf will poll for metrics. Defaults to '5s' +define puppet_metrics_dashboard::profile::compiler ( + String[2] $timeout = $puppet_metrics_dashboard::params::http_response_timeout, + Variant[String,Tuple[String, Integer]] $compiler = $facts['networking']['fqdn'], + Integer[1] $port = 8140, + String[2] $interval = '5s', + ){ + + telegraf::input { "puppetserver_metrics_${compiler}": + plugin_type => 'httpjson', + options => [{ + 'name' => 'puppet_stats', + 'servers' => [ "https://${compiler}:${port}/status/v1/services?level=debug" ], + 'method' => 'GET', + 'insecure_skip_verify' => true, + 'response_timeout' => $timeout, + }], + notify => Service['telegraf'], + require => Package['telegraf'], + } + + telegraf::input { "pe_last_file_sync_${compiler}": + plugin_type => 'http', + options => [{ + 'urls' => [ "https://${compiler}:${port}/status/v1/services/file-sync-client-service?level=debug" ], + 'insecure_skip_verify' => true, + 'data_format' => 'json', + 'json_string_fields' => ['status_repos_puppet-code_latest_commit_date'], + 'timeout' => $timeout, + }], + notify => Service['telegraf'], + require => Package['telegraf'], + } +} diff --git a/manifests/profile/master/postgres.pp b/manifests/profile/master/postgres.pp new file mode 100644 index 00000000..c27b3c92 --- /dev/null +++ b/manifests/profile/master/postgres.pp @@ -0,0 +1,56 @@ +# @summary Aplly this class to an agent running pe-postgresql to collect postgres metrics +# +# @param query_interval +# How often to run the queries in minutes. Defaults to 10 minutes. +# +# @param postgres_host +# The FQDN of the postgres host. Defaults to the FQDN of the server where the profile is applied +# +# @param port +# The port that the postgres service listens on. Defaults to 5432 +define puppet_metrics_dashboard::profile::master::postgres ( + Variant[String,Tuple[String, Integer]] $postgres_host = $facts['networking']['fqdn'], + String[2] $query_interval = $puppet_metrics_dashboard::params::pg_query_interval, + Integer[1] $port = 5432, + ){ + + if ! defined(Puppet_metrics_dashboard::Certs['telegraf']) { + puppet_metrics_dashboard::certs{'telegraf': + notify => Service['telegraf'], + require => Package['telegraf'], + before => Service['telegraf'], + } + } + + telegraf::input { "pe_postgres_${postgres_host}": + plugin_type => 'postgresql_extensible', + options => [{ + 'interval' => $query_interval, + 'address' => "postgres://telegraf@${postgres_host}:${port}/pe-puppetdb?sslmode=require&sslkey=/etc/telegraf/${trusted['certname']}_key.pem&sslcert=/etc/telegraf/${trusted['certname']}_cert.pem&sslrootcert=/etc/telegraf/ca.pem", + 'outputaddress' => $facts['networking']['fqdn'], + 'databases' => ['pe-puppetdb','pe-rbac','pe-activity','pe-classifier'], + 'query' => [{ + 'sqlquery' => 'SELECT * FROM pg_stat_database', + 'version' => 901, + 'withdbname' => false, + },{ + 'sqlquery' => 'SELECT relname as s_table, pg_relation_size(relid) as size FROM pg_catalog.pg_statio_user_tables ORDER BY pg_total_relation_size(relid) DESC', + 'version' => 901, + 'withdbname' => false, + 'tagvalue' => 's_table', + },{ + 'sqlquery' => 'SELECT relname as v_table, autovacuum_count, vacuum_count, n_live_tup, n_dead_tup FROM pg_stat_user_tables', + 'version' => 901, + 'withdbname' => false, + 'tagvalue' => 'v_table', + },{ + 'sqlquery' => 'SELECT relname as io_table, heap_blks_read, heap_blks_hit, idx_blks_read, idx_blks_hit, toast_blks_read, toast_blks_hit, tidx_blks_read, tidx_blks_hit FROM pg_statio_user_tables', + 'version' => 901, + 'withdbname' => false, + 'tagvalue' => 'io_table', + }] + }], + notify => Service['telegraf'], + require => Package['telegraf'], + } +} diff --git a/manifests/profile/master/postgres_access.pp b/manifests/profile/master/postgres_access.pp new file mode 100644 index 00000000..d9a3a291 --- /dev/null +++ b/manifests/profile/master/postgres_access.pp @@ -0,0 +1,63 @@ +# @summary Apply this class to a PE-managed postgres instance to allow access from telegraf +# +# @param telegraf_host +# The FQDN of the host where telegraf runs. +# Defaults to an empty string. You can explicitly set this parameter or the class attempts to lookup which host has the puppet_metrics_dashboard class applied in PuppetDB. If the parameter is not set and the lookup does not return anything we issue a warning. +# +class puppet_metrics_dashboard::profile::master::postgres_access ( + String $telegraf_host = '' +){ + + ##If a value is not supplied, we try a lookup + + if $telegraf_host.empty { + $_query = puppetdb_query('resources[certname] { + type = "Class" and + title = "Puppet_metrics_dashboard" and + nodes { + deactivated is null and + expired is null + } + order by certname asc + limit 1 + }') + unless $_query.empty {$_telegraf_host = $_query[0]['certname']} + } else { + $_telegraf_host = $telegraf_host + } + + ##If no value is supplied _and_ the lookup returns nothing, we issue a warning and do nothing + + if $_telegraf_host == undef { + + notify{ 'This class configures access for a telegaf client to connect to pe-postgresql, you must apply the Puppet_metrics_dashboard class must to an agent or set $telegraf_host before this can happen. $telegraf_host is undef':} + + } else { + + pe_postgresql::server::role { 'telegraf': } + + pe_postgresql::server::database_grant { 'telegraf': + privilege => 'CONNECT', + db => 'pe-puppetdb', + role => 'telegraf', + } + + ##If this fact doesn't exist then postgres is probably at v9.4 + + if $facts['pe_postgresql_info']['installed_server_version'] { + $postgres_version = $facts['pe_postgresql_info']['installed_server_version'] + } else { + $postgres_version = '9.4' + } + + puppet_enterprise::pg::cert_whitelist_entry { 'allow-telegraf-access': + user => 'telegraf', + database => 'pe-puppetdb', + allowed_client_certname => $_telegraf_host, + pg_ident_conf_path => "/opt/puppetlabs/server/data/postgresql/${postgres_version}/data/pg_ident.conf", + ip_mask_allow_all_users_ssl => '0.0.0.0/0', + ipv6_mask_allow_all_users_ssl => '::/0', + } + + } +} diff --git a/manifests/profile/postgres.pp b/manifests/profile/postgres.pp index 99de50a2..0177835b 100644 --- a/manifests/profile/postgres.pp +++ b/manifests/profile/postgres.pp @@ -1,63 +1,13 @@ -# @summary Apply this class to a PE-managed postgres instance to allow access from telegraf +# @summary This class is deprecated. Please use the Puppet_metrics_dashboard::Profile::Master::Postgres_access class. # # @param grafana_host -# The FQDN of the host where telegraf runs. +# The FQDN of the host where telegraf runs. # Defaults to an empty string. You can explicitly set this parameter or the class attempts to lookup which host has the puppet_metrics_dashboard class applied in PuppetDB. If the parameter is not set and the lookup does not return anything we issue a warning. # class puppet_metrics_dashboard::profile::postgres ( String $grafana_host = '' ){ - ##If a value is not supplied, we try a lookup + fail('The Puppet_metrics_dashboard::Profile::Postgres class is deprecated. Please use the Puppet_metrics_dashboard::Profile::Master::Postgres_access instead.') - if $grafana_host.empty { - $_query = puppetdb_query('resources[certname] { - type = "Class" and - title = "Puppet_metrics_dashboard" and - nodes { - deactivated is null and - expired is null - } - order by certname asc - limit 1 - }') - unless $_query.empty {$_grafana_host = $_query[0]['certname']} - } else { - $_grafana_host = $grafana_host - } - - ##If no value is supplied _and_ the lookup returns nothing, we issue a warning and do nothing - - if $_grafana_host == undef { - - notify{ 'This class configures access for a telegaf client to connect to pe-postgresql, you must apply the Puppet_metrics_dashboard class must to an agent or set $grafana_host before this can happen. $grafana_host is undef':} - - } else { - - pe_postgresql::server::role { 'telegraf': } - - pe_postgresql::server::database_grant { 'telegraf': - privilege => 'CONNECT', - db => 'pe-puppetdb', - role => 'telegraf', - } - - ##If this fact doesn't exist then postgres is probably at v9.4 - - if $facts['pe_postgresql_info']['installed_server_version'] { - $postgres_version = $facts['pe_postgresql_info']['installed_server_version'] - } else { - $postgres_version = '9.4' - } - - puppet_enterprise::pg::cert_whitelist_entry { 'allow-telegraf-access': - user => 'telegraf', - database => 'pe-puppetdb', - allowed_client_certname => $_grafana_host, - pg_ident_conf_path => "/opt/puppetlabs/server/data/postgresql/${postgres_version}/data/pg_ident.conf", - ip_mask_allow_all_users_ssl => '0.0.0.0/0', - ipv6_mask_allow_all_users_ssl => '::/0', - } - - } } diff --git a/manifests/profile/puppetdb.pp b/manifests/profile/puppetdb.pp new file mode 100644 index 00000000..63a20c2e --- /dev/null +++ b/manifests/profile/puppetdb.pp @@ -0,0 +1,51 @@ +# @summary Apply this class to a node running puppetdb to collect puppetdb metrics +# +# @param timeout +# Default timeout of http calls. Defaults to 5 seconds +# +# @param puppetdb_metrics +# An array of hashes containing name / url pairs for each puppetdb metric. See params.pp for defaults. +# +# @param puppetdb_host +# The FQDN of the puppetdb host. Defaults to the FQDN of the server where the profile is applied. +# +# @param port +# The port that the puppetdb service listens on on your compiler. Defaults to 8081 +# +# @param interval +# The frequency that telegraf will poll for metrics. Defaults to '5s' +define puppet_metrics_dashboard::profile::puppetdb ( + String[2] $timeout = $puppet_metrics_dashboard::params::http_response_timeout, + Variant[String,Tuple[String, Integer]] $puppetdb_host = $facts['networking']['fqdn'], + Puppet_metrics_dashboard::Puppetdb_metric $puppetdb_metrics = $puppet_metrics_dashboard::params::puppetdb_metrics, + Integer[1] $port = 8081, + String[2] $interval = '5s', + ){ + + $puppetdb_metrics.each |$metric| { + telegraf::input { "puppetdb_${metric['name']}_${puppetdb_host}": + plugin_type => 'httpjson', + options => [{ + 'name' => "puppetdb_${metric['name']}", + 'method' => 'GET', + 'servers' => [ "https://${puppetdb_host}:${port}/metrics/v1/mbeans/${metric['url']}" ], + 'insecure_skip_verify' => true, + 'response_timeout' => $timeout, + }], + notify => Service['telegraf'], + require => Package['telegraf'], + } + } + + telegraf::input { "puppetdb_command_queue_${puppetdb_host}": + plugin_type => 'httpjson', + options => [{ + 'name' => 'puppetdb_command_queue', + 'servers' => [ "https://${puppetdb_host}:${port}/status/v1/services?level=debug" ], + 'insecure_skip_verify' => true, + 'response_timeout' => $timeout, + }], + notify => Service['telegraf'], + require => Package['telegraf'], + } +} diff --git a/manifests/telegraf.pp b/manifests/telegraf.pp index 125322ac..47474106 100644 --- a/manifests/telegraf.pp +++ b/manifests/telegraf.pp @@ -11,12 +11,10 @@ } if $_enable_telegraf { - contain puppet_metrics_dashboard::telegraf::install contain puppet_metrics_dashboard::telegraf::config contain puppet_metrics_dashboard::telegraf::service - Class['puppet_metrics_dashboard::telegraf::install'] - -> Class['puppet_metrics_dashboard::telegraf::config'] + Class['puppet_metrics_dashboard::telegraf::config'] -> Class['puppet_metrics_dashboard::telegraf::service'] } } diff --git a/manifests/telegraf/config.pp b/manifests/telegraf/config.pp index 5236c1b6..657711d7 100644 --- a/manifests/telegraf/config.pp +++ b/manifests/telegraf/config.pp @@ -7,265 +7,77 @@ # @api private class puppet_metrics_dashboard::telegraf::config { if $puppet_metrics_dashboard::configure_telegraf { - $global_config_file = '/etc/telegraf/telegraf.conf' - $telegraf_agent_settings = { - 'interval' => "'${puppet_metrics_dashboard::telegraf_agent_interval}s'", - 'round_interval' => true, - 'metric_batch_size' => 1000, - 'metric_buffer_limit' => 10000, - 'collection_jitter' => "'0s'", - 'flush_interval' => "'10s'", - 'flush_jitter' => "'0s'", - 'precision' => "''", - 'debug' => false, - 'quiet' => false, - 'logfile' => "'/var/log/telegraf/telegraf.log'", - 'hostname' => "''", - 'omit_hostname' => false, + $_puppetdb_metrics = $puppet_metrics_dashboard::puppetdb_metrics + + class { 'telegraf': + interval => $puppet_metrics_dashboard::telegraf_agent_interval, + logfile => '/var/log/telegraf/telegraf.log', + hostname => '', + manage_repo => false, + manage_service => false, + outputs => { + 'influxdb' => [ + { + 'urls' => $puppet_metrics_dashboard::influxdb_urls, + 'database' => $puppet_metrics_dashboard::telegraf_db_name, + 'write_consistency' => 'any', + 'timeout' => '5s', + }, + ], + }, } - $telegraf_agent_settings.each |$k, $v| { - ini_setting { "telegraf agent - ${k}": - path => $global_config_file, - section => 'agent', - setting => $k, - value => $v, - indent_width => 2, - notify => Service['telegraf'], - } - } - - $telegraf_influx_output = { - 'urls' => $puppet_metrics_dashboard::influxdb_urls, - 'database' => "'${puppet_metrics_dashboard::telegraf_db_name}'", - 'retention_policy' => "''", - 'write_consistency' => "'any'", - 'timeout' => "'5s'", - } - - $telegraf_influx_output.each |$k, $v| { - ini_setting { "telegraf outputs.influxdb - ${k}": - path => $global_config_file, - section => 'outputs.influxdb', - section_prefix => '[[', - section_suffix => ']]', - setting => $k, - value => $v, - indent_width => 2, - notify => Service['telegraf'], - } - } - - # Taken from https://github.com/puppetlabs/puppetlabs-puppet_metrics_collector/blob/master/manifests/puppetdb.pp - # Configure the mbean metrics to be collected - # lint:ignore:140chars - $activemq_metrics = [ - { 'name' => 'amq_metrics', - 'url' => 'org.apache.activemq:type=Broker,brokerName=localhost,destinationType=Queue,destinationName=puppetlabs.puppetdb.commands' }, - ] - # lint:endignore - - $base_metrics = [ - { 'name' => 'global_command-parse-time', - 'url' => 'puppetlabs.puppetdb.mq:name=global.command-parse-time' }, - { 'name' => 'global_discarded', - 'url' => 'puppetlabs.puppetdb.mq:name=global.discarded' }, - { 'name' => 'global_fatal', - 'url' => 'puppetlabs.puppetdb.mq:name=global.fatal' }, - { 'name' => 'global_message-persistence-time', - 'url' => 'puppetlabs.puppetdb.mq:name=global.message-persistence-time' }, - { 'name' => 'global_retried', - 'url' => 'puppetlabs.puppetdb.mq:name=global.retried' }, - { 'name' => 'global_retry-counts', - 'url' => 'puppetlabs.puppetdb.mq:name=global.retry-counts' }, - { 'name' => 'global_seen', - 'url' => 'puppetlabs.puppetdb.mq:name=global.seen' }, - { 'name' => 'global_processed', - 'url' => 'puppetlabs.puppetdb.mq:name=global.processed' }, - { 'name' => 'global_processing-time', - 'url' => 'puppetlabs.puppetdb.mq:name=global.processing-time' }, - ] - - $base_metrics_through_4_2 = [ - { 'name' => 'global_generate-retry-message-time', - 'url' => 'puppetlabs.puppetdb.mq:name=global.generate-retry-message-time' }, - { 'name' => 'global_retry-persistence-time', - 'url' => 'puppetlabs.puppetdb.mq:name=global.retry-persistence-time' }, - ] - - $storage_metrics = [ - { 'name' => 'storage_add-edges', - 'url' => 'puppetlabs.puppetdb.storage:name=add-edges' }, - { 'name' => 'storage_add-resources', - 'url' => 'puppetlabs.puppetdb.storage:name=add-resources' }, - { 'name' => 'storage_catalog-hash', - 'url' => 'puppetlabs.puppetdb.storage:name=catalog-hash' }, - { 'name' => 'storage_catalog-hash-match-time', - 'url' => 'puppetlabs.puppetdb.storage:name=catalog-hash-match-time' }, - { 'name' => 'storage_catalog-hash-miss-time', - 'url' => 'puppetlabs.puppetdb.storage:name=catalog-hash-miss-time' }, - { 'name' => 'storage_gc-catalogs-time', - 'url' => 'puppetlabs.puppetdb.storage:name=gc-catalogs-time' }, - { 'name' => 'storage_gc-environments-time', - 'url' => 'puppetlabs.puppetdb.storage:name=gc-environments-time' }, - { 'name' => 'storage_gc-fact-paths', - 'url' => 'puppetlabs.puppetdb.storage:name=gc-fact-paths' }, - { 'name' => 'storage_gc-params-time', - 'url' => 'puppetlabs.puppetdb.storage:name=gc-params-time' }, - { 'name' => 'storage_gc-report-statuses', - 'url' => 'puppetlabs.puppetdb.storage:name=gc-report-statuses' }, - { 'name' => 'storage_gc-time', - 'url' => 'puppetlabs.puppetdb.storage:name=gc-time' }, - { 'name' => 'storage_new-catalog-time', - 'url' => 'puppetlabs.puppetdb.storage:name=new-catalog-time' }, - { 'name' => 'storage_new-catalogs', - 'url' => 'puppetlabs.puppetdb.storage:name=new-catalogs' }, - { 'name' => 'storage_replace-catalog-time', - 'url' => 'puppetlabs.puppetdb.storage:name=replace-catalog-time' }, - { 'name' => 'storage_replace-facts-time', - 'url' => 'puppetlabs.puppetdb.storage:name=replace-facts-time' }, - { 'name' => 'storage_resource-hashes', - 'url' => 'puppetlabs.puppetdb.storage:name=resource-hashes' }, - { 'name' => 'storage_store-report-time', - 'url' => 'puppetlabs.puppetdb.storage:name=store-report-time' }, - ] - - #TODO: Track these on a less frequent cadence because they are slow to run - $storage_metrics_db_queries = [ - { 'name' => 'storage_catalog-volitilty', - 'url' => 'puppetlabs.puppetdb.storage:name=catalog-volitilty' }, - { 'name' => 'storage_duplicate-catalogs', - 'url' => 'puppetlabs.puppetdb.storage:name=duplicate-catalogs' }, - { 'name' => 'storage_duplicate-pct', - 'url' => 'puppetlabs.puppetdb.storage:name=duplicate-pct' }, - ] - - $numbers = $facts['pe_server_version'] ? { - /^2015.2/ => {'catalogs' => 6, 'facts' => 4, 'reports' => 6}, - /^2015.3/ => {'catalogs' => 7, 'facts' => 4, 'reports' => 6}, - /^2016.(1|2)/ => {'catalogs' => 8, 'facts' => 4, 'reports' => 7}, - /^2016.(4|5)/ => {'catalogs' => 9, 'facts' => 5, 'reports' => 8}, - /^2017.(1|2)/ => {'catalogs' => 9, 'facts' => 5, 'reports' => 8}, - default => {'catalogs' => 9, 'facts' => 5, 'reports' => 8}, - } - - $version_specific_metrics = [ - { 'name' => 'mq_replace_catalog_retried', - 'url' => "puppetlabs.puppetdb.mq:name=replace catalog.${numbers['catalogs']}.retried" }, - { 'name' => 'mq_replace_catalog_retry-counts', - 'url' => "puppetlabs.puppetdb.mq:name=replace catalog.${numbers['catalogs']}.retry-counts" }, - { 'name' => 'mq_replace_facts_retried', - 'url' => "puppetlabs.puppetdb.mq:name=replace facts.${numbers['facts']}.retried" }, - { 'name' => 'mq_replace_facts_retry-counts', - 'url' => "puppetlabs.puppetdb.mq:name=replace facts.${numbers['facts']}.retry-counts" }, - { 'name' => 'mq_store_report_retried', - 'url' => "puppetlabs.puppetdb.mq:name=store report.${numbers['reports']}.retried" }, - { 'name' => 'mq_store_reports_retry-counts', - 'url' => "puppetlabs.puppetdb.mq:name=store report.${numbers['reports']}.retry-counts" }, - ] - - $connection_pool_metrics = [ - { 'name' => 'PDBReadPool_pool_ActiveConnections', - 'url' => 'puppetlabs.puppetdb.database:name=PDBReadPool.pool.ActiveConnections' }, - { 'name' => 'PDBReadPool_pool_IdleConnections', - 'url' => 'puppetlabs.puppetdb.database:name=PDBReadPool.pool.IdleConnections' }, - { 'name' => 'PDBReadPool_pool_PendingConnections', - 'url' => 'puppetlabs.puppetdb.database:name=PDBReadPool.pool.PendingConnections' }, - { 'name' => 'PDBReadPool_pool_TotalConnections', - 'url' => 'puppetlabs.puppetdb.database:name=PDBReadPool.pool.TotalConnections' }, - { 'name' => 'PDBReadPool_pool_Usage', - 'url' => 'puppetlabs.puppetdb.database:name=PDBReadPool.pool.Usage' }, - { 'name' => 'PDBReadPool_pool_Wait', - 'url' => 'puppetlabs.puppetdb.database:name=PDBReadPool.pool.Wait' }, - { 'name' => 'PDBWritePool_pool_ActiveConnections', - 'url' => 'puppetlabs.puppetdb.database:name=PDBWritePool.pool.ActiveConnections' }, - { 'name' => 'PDBWritePool_pool_IdleConnections', - 'url' => 'puppetlabs.puppetdb.database:name=PDBWritePool.pool.IdleConnections' }, - { 'name' => 'PDBWritePool_pool_PendingConnections', - 'url' => 'puppetlabs.puppetdb.database:name=PDBWritePool.pool.PendingConnections' }, - { 'name' => 'PDBWritePool_pool_TotalConnections', - 'url' => 'puppetlabs.puppetdb.database:name=PDBWritePool.pool.TotalConnections' }, - { 'name' => 'PDBWritePool_pool_Usage', - 'url' => 'puppetlabs.puppetdb.database:name=PDBWritePool.pool.Usage' }, - { 'name' => 'PDBWritePool_pool_Wait', - 'url' => 'puppetlabs.puppetdb.database:name=PDBWritePool.pool.Wait' }, - ] - - $ha_sync_metrics = [ - { 'name' => 'ha_last-sync-succeeded', - 'url' => 'puppetlabs.puppetdb.ha:name=last-sync-succeeded' }, - { 'name' => 'ha_seconds-since-last-successful-sync', - 'url' => 'puppetlabs.puppetdb.ha:name=seconds-since-last-successful-sync' }, - { 'name' => 'ha_failed-request-counter', - 'url' => 'puppetlabs.puppetdb.ha:name=failed-request-counter' }, - { 'name' => 'ha_sync-duration', - 'url' => 'puppetlabs.puppetdb.ha:name=sync-duration' }, - { 'name' => 'ha_catalogs-sync-duration', - 'url' => 'puppetlabs.puppetdb.ha:name=catalogs-sync-duration' }, - { 'name' => 'ha_reports-sync-duration', - 'url' => 'puppetlabs.puppetdb.ha:name=reports-sync-duration' }, - { 'name' => 'ha_factsets-sync-duration', - 'url' => 'puppetlabs.puppetdb.ha:name=factsets-sync-duration' }, - { 'name' => 'ha_nodes-sync-duration', - 'url' => 'puppetlabs.puppetdb.ha:name=nodes-sync-duration' }, - { 'name' => 'ha_record-transfer-duration', - 'url' => 'puppetlabs.puppetdb.ha:name=record-transfer-duration' }, - ] - - $_puppetdb_metrics = $facts['pe_server_version'] ? { - /^2015./ => - $activemq_metrics, - /^2016\.[45]\./ => - $activemq_metrics + $base_metrics + $base_metrics_through_4_2 + $storage_metrics + $connection_pool_metrics + $version_specific_metrics + $ha_sync_metrics, - /^2016./ => - $activemq_metrics + $base_metrics + $base_metrics_through_4_2 + $storage_metrics + $connection_pool_metrics + $version_specific_metrics, - /^201[78]\./ => - $activemq_metrics + $base_metrics + $storage_metrics + $connection_pool_metrics + $version_specific_metrics + $ha_sync_metrics, - default => - $base_metrics + $storage_metrics + $connection_pool_metrics + $version_specific_metrics, - } - - puppet_metrics_dashboard::certs{'telegraf': - notify => Service['telegraf'], - require => Package['telegraf'], - before => Service['telegraf'], + file {'/etc/telegraf/telegraf.d/puppet_metrics_dashboard.conf': + ensure => absent, } # Transform the host lists into arrays of "hostname:port", using a # service's default port if no alternate was specified. $_master_list = $puppet_metrics_dashboard::master_list.map |$entry| { $entry ? { - Tuple[String, Integer] => "${entry[0]}:${entry[1]}", - String => "${entry}:8140" + Tuple[String, Integer] => { 'host' => $entry[0], 'port' => $entry[1] }, + String => { 'host' => $entry, 'port' => 8140 }, } } $_puppetdb_list = $puppet_metrics_dashboard::puppetdb_list.map |$entry| { $entry ? { - Tuple[String, Integer] => "${entry[0]}:${entry[1]}", - String => "${entry}:8081" + Tuple[String, Integer] => { 'host' => $entry[0], 'port' => $entry[1] }, + String => { 'host' => $entry, 'port' => 8081 }, } } $_postgres_list = $puppet_metrics_dashboard::postgres_host_list.map |$entry| { $entry ? { - Tuple[String, Integer] => "${entry[0]}:${entry[1]}", - String => "${entry}:5432" + Tuple[String, Integer] => { 'host' => $entry[0], 'port' => $entry[1] }, + String => { 'host' => $entry, 'port' => 5432 }, } } - file {'/etc/telegraf/telegraf.d/puppet_metrics_dashboard.conf': - ensure => file, - owner => 0, - group => 0, - content => epp('puppet_metrics_dashboard/telegraf.conf.epp', - { - puppetdb_metrics => $_puppetdb_metrics, - master_list => $_master_list, - puppetdb_list => $_puppetdb_list, - postgres_host_list => $_postgres_list, - http_response_timeout => $puppet_metrics_dashboard::http_response_timeout, - }), - notify => Service['telegraf'], - require => Package['telegraf'], + $_master_list.each |$master| { + puppet_metrics_dashboard::profile::compiler{ $master['host']: + compiler => $master['host'], + port => $master['port'], + timeout => $puppet_metrics_dashboard::http_response_timeout, + interval => $puppet_metrics_dashboard::telegraf_agent_interval, + } } + + $_puppetdb_list.each |$puppetdb| { + puppet_metrics_dashboard::profile::puppetdb{ $puppetdb['host']: + puppetdb_host => $puppetdb['host'], + port => $puppetdb['port'], + timeout => $puppet_metrics_dashboard::http_response_timeout, + interval => $puppet_metrics_dashboard::telegraf_agent_interval, + } + } + + $_postgres_list.each |$postgres| { + puppet_metrics_dashboard::profile::master::postgres{ $postgres['host']: + postgres_host => $postgres['host'], + port => $postgres['port'], + query_interval => $puppet_metrics_dashboard::pg_query_interval, + } + } + } + } diff --git a/manifests/telegraf/install.pp b/manifests/telegraf/install.pp deleted file mode 100644 index b8e39fc4..00000000 --- a/manifests/telegraf/install.pp +++ /dev/null @@ -1,10 +0,0 @@ -# @summary Installs Telegraf -# -# Installs Telegraf -# -# @api private -class puppet_metrics_dashboard::telegraf::install { - package { 'telegraf': - ensure => present, - } -} diff --git a/manifests/telegraf/service.pp b/manifests/telegraf/service.pp index ece7a62b..ac959dfa 100644 --- a/manifests/telegraf/service.pp +++ b/manifests/telegraf/service.pp @@ -8,7 +8,6 @@ ensure => running, enable => true, require => [ - Package['telegraf'], Service[$puppet_metrics_dashboard::influx_db_service_name]], } } diff --git a/metadata.json b/metadata.json index 868eb3d0..e4836f44 100644 --- a/metadata.json +++ b/metadata.json @@ -23,6 +23,10 @@ { "name": "puppet-grafana", "version_requirement": ">= 3.0.0 < 7.0.0" + }, + { + "name": "puppet-telegraf", + "version_requirement": ">= 2.0.0 < 3.0.0" } ], "operatingsystem_support": [ @@ -54,7 +58,7 @@ "version_requirement": ">= 4.7.0 < 7.0.0" } ], - "pdk-version": "1.11.0.pre (heads/master-0-gefa15f2)", - "template-url": "https://github.com/puppetlabs/pdk-templates#master", - "template-ref": "heads/master-0-ge1be36a" + "pdk-version": "1.10.0", + "template-url": "https://github.com/puppetlabs/pdk-templates#1.10.0", + "template-ref": "1.10.0-0-gbba9ac3" } diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index cef23033..42b676b8 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -8,7 +8,7 @@ let(:facts) do facts.merge( - pe_server_version: '2017.2', + pe_server_version: '2019.1', puppet_sslpaths: { certdir: { path: '/etc/puppetlabs/puppet/ssl/certs', @@ -55,10 +55,10 @@ .with_consume_graphite(false) .with_master_list(['testhost.example.com']) .with_puppetdb_list(['testhost.example.com']) - .with_influxdb_urls("['http://localhost:8086']") + .with_influxdb_urls(['http://localhost:8086']) .with_telegraf_db_name('telegraf') - .with_telegraf_agent_interval(5) - .with_http_response_timeout(5) + .with_telegraf_agent_interval('5s') + .with_http_response_timeout('5s') case facts[:os]['family'] when 'Debian' @@ -291,7 +291,7 @@ class {'puppet_metrics_dashboard': let(:pre_condition) do <<-PRE_COND class {'puppet_metrics_dashboard': - influxdb_urls => "['http://influxdb.example.com:8086']" + influxdb_urls => ['http://influxdb.example.com:8086'] } PRE_COND end @@ -316,8 +316,8 @@ class {'puppet_metrics_dashboard': let(:pre_condition) do <<-PRE_COND class {'puppet_metrics_dashboard': - telegraf_agent_interval => 30, - http_response_timeout => 30 + telegraf_agent_interval => '30s', + http_response_timeout => '30s' } PRE_COND end diff --git a/spec/classes/telegraf/config_spec.rb b/spec/classes/telegraf/config_spec.rb index e2b409bd..c79f42e7 100644 --- a/spec/classes/telegraf/config_spec.rb +++ b/spec/classes/telegraf/config_spec.rb @@ -8,7 +8,7 @@ end let(:facts) do - facts.merge(pe_server_version: '2017.2') + facts.merge(pe_server_version: '2019.1') end context 'with defaults' do @@ -18,27 +18,56 @@ PRE_COND end - it { is_expected.to contain_ini_setting('telegraf agent - interval').with_value("'5s'") } - it { is_expected.to contain_ini_setting('telegraf agent - round_interval').with_value(true) } - it { is_expected.to contain_ini_setting('telegraf agent - metric_batch_size').with_value(1000) } - it { is_expected.to contain_ini_setting('telegraf agent - metric_buffer_limit').with_value(10_000) } - it { is_expected.to contain_ini_setting('telegraf agent - collection_jitter').with_value("'0s'") } - it { is_expected.to contain_ini_setting('telegraf agent - flush_interval').with_value("'10s'") } - it { is_expected.to contain_ini_setting('telegraf agent - flush_jitter').with_value("'0s'") } - it { is_expected.to contain_ini_setting('telegraf agent - precision').with_value("''") } - it { is_expected.to contain_ini_setting('telegraf agent - debug').with_value(false) } - it { is_expected.to contain_ini_setting('telegraf agent - quiet').with_value(false) } - it { is_expected.to contain_ini_setting('telegraf agent - logfile').with_value("'/var/log/telegraf/telegraf.log'") } - it { is_expected.to contain_ini_setting('telegraf agent - hostname').with_value("''") } - it { is_expected.to contain_ini_setting('telegraf agent - omit_hostname').with_value(false) } - it { is_expected.to contain_ini_setting('telegraf outputs.influxdb - urls').with_value("['http://localhost:8086']") } - it { is_expected.to contain_ini_setting('telegraf outputs.influxdb - database').with_value("'telegraf'") } - it { is_expected.to contain_ini_setting('telegraf outputs.influxdb - retention_policy').with_value("''") } - it { is_expected.to contain_ini_setting('telegraf outputs.influxdb - write_consistency').with_value("'any'") } - it { is_expected.to contain_ini_setting('telegraf outputs.influxdb - timeout').with_value("'5s'") } - it { is_expected.to contain_file('/etc/telegraf/telegraf.d/puppet_metrics_dashboard.conf') } + it { is_expected.to contain_file('/etc/telegraf/telegraf.d/pe_last_file_sync_testhost.example.com.conf') } + it { is_expected.to contain_file('/etc/telegraf/telegraf.d/pe_postgres_testhost.example.com.conf') } + it { is_expected.to contain_file('/etc/telegraf/telegraf.d/puppetdb_command_queue_testhost.example.com.conf') } + it { is_expected.to contain_file('/etc/telegraf/telegraf.d/puppetdb_global_command-parse-time_testhost.example.com.conf') } + it { is_expected.to contain_file('/etc/telegraf/telegraf.d/puppetdb_global_discarded_testhost.example.com.conf') } + it { is_expected.to contain_file('/etc/telegraf/telegraf.d/puppetdb_global_fatal_testhost.example.com.conf') } + it { is_expected.to contain_file('/etc/telegraf/telegraf.d/puppetdb_global_message-persistence-time_testhost.example.com.conf') } + it { is_expected.to contain_file('/etc/telegraf/telegraf.d/puppetdb_global_processed_testhost.example.com.conf') } + it { is_expected.to contain_file('/etc/telegraf/telegraf.d/puppetdb_global_processing-time_testhost.example.com.conf') } + it { is_expected.to contain_file('/etc/telegraf/telegraf.d/puppetdb_global_retried_testhost.example.com.conf') } + it { is_expected.to contain_file('/etc/telegraf/telegraf.d/puppetdb_global_retry-counts_testhost.example.com.conf') } + it { is_expected.to contain_file('/etc/telegraf/telegraf.d/puppetdb_global_seen_testhost.example.com.conf') } + it { is_expected.to contain_file('/etc/telegraf/telegraf.d/puppetdb_mq_replace_catalog_retried_testhost.example.com.conf') } + it { is_expected.to contain_file('/etc/telegraf/telegraf.d/puppetdb_mq_replace_catalog_retry-counts_testhost.example.com.conf') } + it { is_expected.to contain_file('/etc/telegraf/telegraf.d/puppetdb_mq_replace_facts_retried_testhost.example.com.conf') } + it { is_expected.to contain_file('/etc/telegraf/telegraf.d/puppetdb_mq_replace_facts_retry-counts_testhost.example.com.conf') } + it { is_expected.to contain_file('/etc/telegraf/telegraf.d/puppetdb_mq_store_report_retried_testhost.example.com.conf') } + it { is_expected.to contain_file('/etc/telegraf/telegraf.d/puppetdb_mq_store_reports_retry-counts_testhost.example.com.conf') } + it { is_expected.to contain_file('/etc/telegraf/telegraf.d/puppetdb_PDBReadPool_pool_ActiveConnections_testhost.example.com.conf') } + it { is_expected.to contain_file('/etc/telegraf/telegraf.d/puppetdb_PDBReadPool_pool_IdleConnections_testhost.example.com.conf') } + it { is_expected.to contain_file('/etc/telegraf/telegraf.d/puppetdb_PDBReadPool_pool_PendingConnections_testhost.example.com.conf') } + it { is_expected.to contain_file('/etc/telegraf/telegraf.d/puppetdb_PDBReadPool_pool_TotalConnections_testhost.example.com.conf') } + it { is_expected.to contain_file('/etc/telegraf/telegraf.d/puppetdb_PDBReadPool_pool_Usage_testhost.example.com.conf') } + it { is_expected.to contain_file('/etc/telegraf/telegraf.d/puppetdb_PDBReadPool_pool_Wait_testhost.example.com.conf') } + it { is_expected.to contain_file('/etc/telegraf/telegraf.d/puppetdb_PDBWritePool_pool_ActiveConnections_testhost.example.com.conf') } + it { is_expected.to contain_file('/etc/telegraf/telegraf.d/puppetdb_PDBWritePool_pool_IdleConnections_testhost.example.com.conf') } + it { is_expected.to contain_file('/etc/telegraf/telegraf.d/puppetdb_PDBWritePool_pool_PendingConnections_testhost.example.com.conf') } + it { is_expected.to contain_file('/etc/telegraf/telegraf.d/puppetdb_PDBWritePool_pool_TotalConnections_testhost.example.com.conf') } + it { is_expected.to contain_file('/etc/telegraf/telegraf.d/puppetdb_PDBWritePool_pool_Usage_testhost.example.com.conf') } + it { is_expected.to contain_file('/etc/telegraf/telegraf.d/puppetdb_PDBWritePool_pool_Wait_testhost.example.com.conf') } + it { is_expected.to contain_file('/etc/telegraf/telegraf.d/puppetdb_storage_add-edges_testhost.example.com.conf') } + it { is_expected.to contain_file('/etc/telegraf/telegraf.d/puppetdb_storage_add-resources_testhost.example.com.conf') } + it { is_expected.to contain_file('/etc/telegraf/telegraf.d/puppetdb_storage_catalog-hash_testhost.example.com.conf') } + it { is_expected.to contain_file('/etc/telegraf/telegraf.d/puppetdb_storage_catalog-hash-match-time_testhost.example.com.conf') } + it { is_expected.to contain_file('/etc/telegraf/telegraf.d/puppetdb_storage_catalog-hash-miss-time_testhost.example.com.conf') } + it { is_expected.to contain_file('/etc/telegraf/telegraf.d/puppetdb_storage_gc-catalogs-time_testhost.example.com.conf') } + it { is_expected.to contain_file('/etc/telegraf/telegraf.d/puppetdb_storage_gc-environments-time_testhost.example.com.conf') } + it { is_expected.to contain_file('/etc/telegraf/telegraf.d/puppetdb_storage_gc-fact-paths_testhost.example.com.conf') } + it { is_expected.to contain_file('/etc/telegraf/telegraf.d/puppetdb_storage_gc-params-time_testhost.example.com.conf') } + it { is_expected.to contain_file('/etc/telegraf/telegraf.d/puppetdb_storage_gc-report-statuses_testhost.example.com.conf') } + it { is_expected.to contain_file('/etc/telegraf/telegraf.d/puppetdb_storage_gc-time_testhost.example.com.conf') } + it { is_expected.to contain_file('/etc/telegraf/telegraf.d/puppetdb_storage_new-catalogs_testhost.example.com.conf') } + it { is_expected.to contain_file('/etc/telegraf/telegraf.d/puppetdb_storage_new-catalog-time_testhost.example.com.conf') } + it { is_expected.to contain_file('/etc/telegraf/telegraf.d/puppetdb_storage_replace-catalog-time_testhost.example.com.conf') } + it { is_expected.to contain_file('/etc/telegraf/telegraf.d/puppetdb_storage_replace-facts-time_testhost.example.com.conf') } + it { is_expected.to contain_file('/etc/telegraf/telegraf.d/puppetdb_storage_resource-hashes_testhost.example.com.conf') } + it { is_expected.to contain_file('/etc/telegraf/telegraf.d/puppetdb_storage_store-report-time_testhost.example.com.conf') } it { is_expected.to contain_file('/etc/telegraf/testhost.example.com_cert.pem') } it { is_expected.to contain_file('/etc/telegraf/testhost.example.com_key.pem') } + it { is_expected.to contain_file('/etc/telegraf/telegraf.conf') } end context 'when master_list includes entries with port numbers' do @@ -54,9 +83,9 @@ class { 'puppet_metrics_dashboard': end it do - is_expected.to contain_file('/etc/telegraf/telegraf.d/puppet_metrics_dashboard.conf')\ - .with_content(%r{some-host\.test:8140}) - is_expected.to contain_file('/etc/telegraf/telegraf.d/puppet_metrics_dashboard.conf')\ + is_expected.to contain_file('/etc/telegraf/telegraf.d/puppetserver_metrics_some-host.test.conf')\ + .with_content(%r{some-host\.test}) + is_expected.to contain_file('/etc/telegraf/telegraf.d/puppetserver_metrics_some-other.host.test.conf')\ .with_content(%r{some-other\.host\.test:9140}) end end @@ -74,9 +103,9 @@ class { 'puppet_metrics_dashboard': end it do - is_expected.to contain_file('/etc/telegraf/telegraf.d/puppet_metrics_dashboard.conf')\ - .with_content(%r{some-host\.test:8081}) - is_expected.to contain_file('/etc/telegraf/telegraf.d/puppet_metrics_dashboard.conf')\ + is_expected.to contain_file('/etc/telegraf/telegraf.d/puppetdb_command_queue_some-host.test.conf')\ + .with_content(%r{some-host\.test}) + is_expected.to contain_file('/etc/telegraf/telegraf.d/puppetdb_command_queue_some-other.host.test.conf')\ .with_content(%r{some-other\.host\.test:8100}) end end @@ -89,15 +118,14 @@ class { 'puppet_metrics_dashboard': puppetdb_list => [], postgres_host_list => ['some-host.test', ['some-other.host.test', 9000]], - } PRE_COND end it do - is_expected.to contain_file('/etc/telegraf/telegraf.d/puppet_metrics_dashboard.conf')\ - .with_content(%r{some-host\.test:5432}) - is_expected.to contain_file('/etc/telegraf/telegraf.d/puppet_metrics_dashboard.conf')\ + is_expected.to contain_file('/etc/telegraf/telegraf.d/pe_postgres_some-host.test.conf')\ + .with_content(%r{some-host\.test}) + is_expected.to contain_file('/etc/telegraf/telegraf.d/pe_postgres_some-other.host.test.conf')\ .with_content(%r{some-other\.host\.test:9000}) end end @@ -105,16 +133,16 @@ class { 'puppet_metrics_dashboard': let(:pre_condition) do <<-PRE_COND class { 'puppet_metrics_dashboard': - http_response_timeout => 123, + http_response_timeout => '123s', } PRE_COND end it do - is_expected.to contain_file('/etc/telegraf/telegraf.d/puppet_metrics_dashboard.conf')\ - .with_content(%r{\s*timeout\s*=\s*\'123s\'}) - is_expected.to contain_file('/etc/telegraf/telegraf.d/puppet_metrics_dashboard.conf')\ - .with_content(%r{\s*response_timeout\s*=\s*\'123s\'}) + is_expected.to contain_file('/etc/telegraf/telegraf.d/pe_last_file_sync_testhost.example.com.conf')\ + .with_content(%r{\s*timeout\s*=\s*\"123s\"}) + is_expected.to contain_file('/etc/telegraf/telegraf.d/puppetserver_metrics_testhost.example.com.conf')\ + .with_content(%r{\s*response_timeout\s*=\s*\"123s\"}) end end end diff --git a/spec/classes/telegraf/install_spec.rb b/spec/classes/telegraf/install_spec.rb deleted file mode 100644 index d1141069..00000000 --- a/spec/classes/telegraf/install_spec.rb +++ /dev/null @@ -1,25 +0,0 @@ -require 'spec_helper' - -describe 'puppet_metrics_dashboard::telegraf::install' do - on_supported_os(facterversion: '3.7').each do |os, facts| - context "with facter 3.7 on #{os}" do - let(:node) do - 'testhost.example.com' - end - - let(:facts) do - facts.merge(pe_server_version: '2017.2') - end - - context 'with defaults' do - let(:pre_condition) do - <<-PRE_COND - include puppet_metrics_dashboard - PRE_COND - end - - it { is_expected.to contain_package('telegraf').with_ensure('present') } - end - end - end -end diff --git a/spec/classes/telegraf_spec.rb b/spec/classes/telegraf_spec.rb index 43d2c06d..68cf1f13 100644 --- a/spec/classes/telegraf_spec.rb +++ b/spec/classes/telegraf_spec.rb @@ -18,7 +18,6 @@ PRE_COND end - it { is_expected.to contain_class('puppet_metrics_dashboard::telegraf::install') } it { is_expected.to contain_class('puppet_metrics_dashboard::telegraf::config') } it { is_expected.to contain_class('puppet_metrics_dashboard::telegraf::service') } end @@ -33,7 +32,6 @@ class {'puppet_metrics_dashboard': PRE_COND end - it { is_expected.not_to contain_class('puppet_metrics_dashboard::telegraf::install') } it { is_expected.not_to contain_class('puppet_metrics_dashboard::telegraf::config') } it { is_expected.not_to contain_class('puppet_metrics_dashboard::telegraf::service') } end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 31e3c902..70d81e05 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -41,8 +41,6 @@ end end -# Ensures that a module is defined -# @param module_name Name of the module def ensure_module_defined(module_name) module_name.split('::').reduce(Object) do |last_module, next_module| last_module.const_set(next_module, Module.new) unless last_module.const_defined?(next_module, false) diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 6ade5de2..7f538cfc 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -28,6 +28,8 @@ on host, puppet('module', 'install', 'puppet-grafana') on host, puppet('module', 'install', 'puppetlabs-inifile') + on host, puppet('module', 'install', 'puppet-telegraf') + on host, puppet('resource', 'package', 'toml-rb', 'ensure=installed', 'provider=puppet_gem') if fact('osfamily') == 'Debian' on host, puppet('module', 'install', 'puppetlabs-apt') end diff --git a/types/puppetdb_metric.pp b/types/puppetdb_metric.pp new file mode 100644 index 00000000..8f4feba3 --- /dev/null +++ b/types/puppetdb_metric.pp @@ -0,0 +1,9 @@ +# A metric name corresponding to an endpoint (url) +type Puppet_metrics_dashboard::Puppetdb_metric = Tuple[ + Struct[{ + name => String[1], + url => String[1] + }], + 1, + default +]