This repository has been archived by the owner on Jun 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add profiles, move puppetdb metric defaults
- Loading branch information
suckatrash
committed
Jun 14, 2019
1 parent
91186d7
commit 375b898
Showing
16 changed files
with
478 additions
and
313 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# @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 | ||
# | ||
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'], | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# @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 | ||
# | ||
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'], | ||
} | ||
} |
Oops, something went wrong.