9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org).

## [v1.8.0](https://github.com/puppetlabs/puppet_operational_dashboards/tree/v1.8.0) (2022-11-07)
## [v1.9.0](https://github.com/puppetlabs/puppet_operational_dashboards/tree/v1.9.0) (2022-12-02)

[Full Changelog](https://github.com/puppetlabs/puppet_operational_dashboards/compare/v1.7.0...v1.8.0)
[Full Changelog](https://github.com/puppetlabs/puppet_operational_dashboards/compare/v1.8.0...v1.9.0)

### Added

- timeouts for http inputs are now configurable [\#114](https://github.com/puppetlabs/puppet_operational_dashboards/pull/114) ([SimonHoenscheid](https://github.com/SimonHoenscheid))
- \(SUP-3761\) Add thread and file descriptor panels [\#106](https://github.com/puppetlabs/puppet_operational_dashboards/pull/106) ([m0dular](https://github.com/m0dular))
- \(SUP-3735\) have dashboards autorefresh [\#103](https://github.com/puppetlabs/puppet_operational_dashboards/pull/103) ([MartyEwings](https://github.com/MartyEwings))
- mv telegraf agent os-specific params to hiera data [\#101](https://github.com/puppetlabs/puppet_operational_dashboards/pull/101) ([zoojar](https://github.com/zoojar))
Expand All @@ -17,6 +18,10 @@ All notable changes to this project will be documented in this file. The format

- \(SUP-3764\) Fix compatability with Telegraf 1.24.3 [\#109](https://github.com/puppetlabs/puppet_operational_dashboards/pull/109) ([m0dular](https://github.com/m0dular))

## [v1.8.0](https://github.com/puppetlabs/puppet_operational_dashboards/tree/v1.8.0) (2022-11-07)

[Full Changelog](https://github.com/puppetlabs/puppet_operational_dashboards/compare/v1.7.0...v1.8.0)

## [v1.7.0](https://github.com/puppetlabs/puppet_operational_dashboards/tree/v1.7.0) (2022-10-18)

[Full Changelog](https://github.com/puppetlabs/puppet_operational_dashboards/compare/v1.6.0...v1.7.0)
Expand Down
16 changes: 16 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@ The following parameters are available in the `puppet_operational_dashboards::te
* [`local_services`](#local_services)
* [`token_name`](#token_name)
* [`influxdb_token_file`](#influxdb_token_file)
* [`http_timeout_seconds`](#http_timeout_seconds)

##### <a name="token"></a>`token`

Expand Down Expand Up @@ -659,6 +660,14 @@ This token is used in this class in a Deferred function call to retrieve a Teleg

Default value: `$puppet_operational_dashboards::influxdb_token_file`

##### <a name="http_timeout_seconds"></a>`http_timeout_seconds`

Data type: `Integer[1]`

Timeout for HTTP Telegraf inputs. Might be usefull in huge environments with slower API responses

Default value: `5`

## Defined types

### <a name="puppet_operational_dashboardstelegrafconfig"></a>`puppet_operational_dashboards::telegraf::config`
Expand All @@ -673,6 +682,7 @@ The following parameters are available in the `puppet_operational_dashboards::te
* [`protocol`](#protocol)
* [`hosts`](#hosts)
* [`ensure`](#ensure)
* [`http_timeout_seconds`](#http_timeout_seconds)

##### <a name="service"></a>`service`

Expand Down Expand Up @@ -702,6 +712,12 @@ Whether the resource should be present or absent

Default value: `'present'`

##### <a name="http_timeout_seconds"></a>`http_timeout_seconds`

Data type: `Integer[1]`

Timeout for HTTP Telegraf inputs. Might be usefull in huge environments with slower API responses

## Functions

### <a name="puppet_operational_dashboardshosts_with_profile"></a>`puppet_operational_dashboards::hosts_with_profile`
Expand Down
31 changes: 19 additions & 12 deletions manifests/telegraf/agent.pp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@
# @param influxdb_token_file
# Location on disk of an InfluxDB admin token.
# This token is used in this class in a Deferred function call to retrieve a Telegraf token if $token is unset
# @param http_timeout_seconds
# Timeout for HTTP Telegraf inputs. Might be usefull in huge environments with slower API responses
class puppet_operational_dashboards::telegraf::agent (
String $version,
Boolean $manage_repo,
Expand Down Expand Up @@ -97,6 +99,7 @@

Array[String] $profiles = puppet_operational_dashboards::pe_profiles_on_host(),
Array[String] $local_services = [],
Integer[1] $http_timeout_seconds = 5,
) {
unless [$puppetserver_hosts, $puppetdb_hosts, $postgres_hosts, $profiles, $local_services].any |$service| { $service } {
fail('No services detected on node.')
Expand Down Expand Up @@ -231,17 +234,19 @@
if $collection_method == 'all' {
unless $puppetdb_hosts.empty() {
puppet_operational_dashboards::telegraf::config { ['puppetdb', 'puppetdb_jvm']:
hosts => $puppetdb_hosts,
protocol => $protocol,
require => File['/etc/systemd/system/telegraf.service.d/override.conf'],
hosts => $puppetdb_hosts,
protocol => $protocol,
http_timeout_seconds => $http_timeout_seconds,
require => File['/etc/systemd/system/telegraf.service.d/override.conf'],
}
}

unless $puppetserver_hosts.empty() {
puppet_operational_dashboards::telegraf::config { 'puppetserver':
hosts => $puppetserver_hosts,
protocol => $protocol,
require => File['/etc/systemd/system/telegraf.service.d/override.conf'],
hosts => $puppetserver_hosts,
protocol => $protocol,
http_timeout_seconds => $http_timeout_seconds,
require => File['/etc/systemd/system/telegraf.service.d/override.conf'],
}
}

Expand All @@ -263,17 +268,19 @@
elsif $collection_method == 'local' {
if 'Puppet_enterprise::Profile::Puppetdb' in $profiles or 'puppetdb' in $local_services {
puppet_operational_dashboards::telegraf::config { ['puppetdb', 'puppetdb_jvm']:
hosts => [$trusted['certname']],
protocol => $protocol,
require => File['/etc/systemd/system/telegraf.service.d/override.conf'],
hosts => [$trusted['certname']],
protocol => $protocol,
http_timeout_seconds => $http_timeout_seconds,
require => File['/etc/systemd/system/telegraf.service.d/override.conf'],
}
}

if 'Puppet_enterprise::Profile::Master' in $profiles or 'puppetserver' in $local_services {
puppet_operational_dashboards::telegraf::config { 'puppetserver':
hosts => [$trusted['certname']],
protocol => $protocol,
require => File['/etc/systemd/system/telegraf.service.d/override.conf'],
hosts => [$trusted['certname']],
protocol => $protocol,
http_timeout_seconds => $http_timeout_seconds,
require => File['/etc/systemd/system/telegraf.service.d/override.conf'],
}
}

Expand Down
5 changes: 4 additions & 1 deletion manifests/telegraf/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@
# Array of hosts running the service
# @param ensure
# Whether the resource should be present or absent
# @param http_timeout_seconds
# Timeout for HTTP Telegraf inputs. Might be usefull in huge environments with slower API responses
define puppet_operational_dashboards::telegraf::config (
Array[String[1]] $hosts,
Enum['https', 'http'] $protocol,
Integer[1] $http_timeout_seconds,
String $service = $title,
Enum['present', 'absent'] $ensure = 'present',
) {
Expand All @@ -29,7 +32,7 @@

$inputs = epp(
"puppet_operational_dashboards/${service}_metrics.epp",
{ urls => $urls, protocol => $protocol }
{ urls => $urls, protocol => $protocol, http_timeout_seconds => $http_timeout_seconds }
).influxdb::from_toml()

telegraf::input { "${service}_metrics":
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "puppetlabs-puppet_operational_dashboards",
"version": "1.8.0",
"version": "1.9.0",
"author": "Adrian Parreiras Horta",
"summary": "A module for managing the installation and configuration of metrics dashboards for Puppet Infrastructure.",
"license": "Apache-2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
{
ensure: 'present',
protocol: 'https',
http_timeout_seconds: 5,
hosts: ['localhost.foo.com'],
}
end
Expand Down Expand Up @@ -132,6 +133,7 @@
{
ensure: 'present',
protocol: 'http',
http_timeout_seconds: 5,
hosts: ['localhost.foo.com'],
}
end
Expand Down
2 changes: 1 addition & 1 deletion spec/fixtures/defines/puppetdb_jvm_metrics.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"tls_cert":"/etc/telegraf/cert.pem", "tls_key":"/etc/telegraf/key.pem", "tls_ca":"/etc/telegraf/ca.pem", "data_format":"json_v2", "headers":{"Content-type":"application/json"}, "method":"GET", "urls":["https://localhost.foo.com:8081/status/v1/services?level=debug"], "json_v2":[{"measurement_name":"puppetdb", "object":[{"path":"status-service.status.experimental.jvm-metrics", "disable_prepend_keys":false}, {"disable_prepend_keys":true, "path":"puppetdb-status.status", "included_keys":["queue_depth"]}]}]}]
[{"tls_cert":"/etc/telegraf/cert.pem", "tls_key":"/etc/telegraf/key.pem", "tls_ca":"/etc/telegraf/ca.pem", "data_format":"json_v2", "headers":{"Content-type":"application/json"}, "method":"GET", "timeout":"5s", "urls":["https://localhost.foo.com:8081/status/v1/services?level=debug"], "json_v2":[{"measurement_name":"puppetdb", "object":[{"path":"status-service.status.experimental.jvm-metrics", "disable_prepend_keys":false}, {"disable_prepend_keys":true, "path":"puppetdb-status.status", "included_keys":["queue_depth"]}]}]}]
Loading