Skip to content

Commit 5a9c57f

Browse files
committed
Use localhost as the hostname for local postgres
1 parent 1a2f573 commit 5a9c57f

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed

manifests/telegraf/agent.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@
487487
$inputs = epp(
488488
"puppet_operational_dashboards/postgres.${template_format}.epp",
489489
{
490-
certname => $trusted['certname'],
490+
certname => 'localhost',
491491
telegraf_user => $telegraf_user,
492492
password => $telegraf_postgres_password,
493493
database => $database,

spec/classes/agent_spec.rb

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -157,22 +157,17 @@
157157
'outputaddress' => 'localhost.foo.com',
158158
'query' => [
159159
{ 'sqlquery' => 'SELECT * FROM pg_stat_database',
160-
'version' => 901,
161160
'withdbname' => false },
162161
{ 'tagvalue' => 'table_name',
163-
'version' => 901,
164162
'withdbname' => false,
165163
'sqlquery' => "SELECT current_database() AS datname, total_bytes AS total , table_name , index_bytes AS index , toast_bytes AS toast , table_bytes AS table FROM ( SELECT *, total_bytes-index_bytes-coalesce(toast_bytes,0) AS table_bytes FROM ( SELECT c.oid,nspname AS table_schema, relname AS table_name , c.reltuples AS row_estimate , pg_total_relation_size(c.oid) AS total_bytes , pg_indexes_size(c.oid) AS index_bytes , pg_total_relation_size(reltoastrelid) AS toast_bytes FROM pg_class c LEFT JOIN pg_namespace n ON n.oid = c.relnamespace WHERE relkind = 'r' AND nspname NOT IN ('pg_catalog', 'information_schema')) a) a" },
166164
{ 'sqlquery' => 'SELECT current_database() AS datname, relname as table, autovacuum_count, vacuum_count, n_live_tup, n_dead_tup FROM pg_stat_user_tables',
167165
'tagvalue' => 'table',
168-
'version' => 901,
169166
'withdbname' => false },
170167
{ 'sqlquery' => 'SELECT current_database() AS datname, a.indexrelname as index, pg_relation_size(a.indexrelid) as size_bytes, idx_scan, idx_tup_read, idx_tup_fetch, idx_blks_read, idx_blks_hit from pg_stat_user_indexes a join pg_statio_user_indexes b on a.indexrelid = b.indexrelid;',
171168
'tagvalue' => 'index',
172-
'version' => 901,
173169
'withdbname' => false },
174170
{ 'sqlquery' => 'SELECT current_database() AS datname, relname as 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', 'tagvalue' => 'table',
175-
'version' => 901,
176171
'withdbname' => false },
177172
]
178173
}]
@@ -204,33 +199,29 @@
204199
},
205200
postgres_hosts: ['localhost.foo.com'],
206201
template_format: 'toml',
202+
include_pe_metrics: false,
207203
}
208204
end
209205

210206
it {
211207
# rubocop:disable Layout/LineLength
212208
options = [{
213-
'address' => "postgres://[email protected]:5432/pe-puppetdb?#{params[:postgres_options].map { |k, v| "#{k}=#{v}" }.join('&').chomp}",
214-
'databases' => ['pe-puppetdb'],
209+
'address' => "postgres://[email protected]:5432/puppetdb?#{params[:postgres_options].map { |k, v| "#{k}=#{v}" }.join('&').chomp}",
210+
'databases' => ['puppetdb'],
215211
'outputaddress' => 'localhost.foo.com',
216212
'query' => [
217213
{ 'sqlquery' => 'SELECT * FROM pg_stat_database',
218-
'version' => 901,
219214
'withdbname' => false },
220215
{ 'tagvalue' => 'table_name',
221-
'version' => 901,
222216
'withdbname' => false,
223217
'sqlquery' => "SELECT current_database() AS datname, total_bytes AS total , table_name , index_bytes AS index , toast_bytes AS toast , table_bytes AS table FROM ( SELECT *, total_bytes-index_bytes-coalesce(toast_bytes,0) AS table_bytes FROM ( SELECT c.oid,nspname AS table_schema, relname AS table_name , c.reltuples AS row_estimate , pg_total_relation_size(c.oid) AS total_bytes , pg_indexes_size(c.oid) AS index_bytes , pg_total_relation_size(reltoastrelid) AS toast_bytes FROM pg_class c LEFT JOIN pg_namespace n ON n.oid = c.relnamespace WHERE relkind = 'r' AND nspname NOT IN ('pg_catalog', 'information_schema')) a) a" },
224218
{ 'sqlquery' => 'SELECT current_database() AS datname, relname as table, autovacuum_count, vacuum_count, n_live_tup, n_dead_tup FROM pg_stat_user_tables',
225219
'tagvalue' => 'table',
226-
'version' => 901,
227220
'withdbname' => false },
228221
{ 'sqlquery' => 'SELECT current_database() AS datname, a.indexrelname as index, pg_relation_size(a.indexrelid) as size_bytes, idx_scan, idx_tup_read, idx_tup_fetch, idx_blks_read, idx_blks_hit from pg_stat_user_indexes a join pg_statio_user_indexes b on a.indexrelid = b.indexrelid;',
229222
'tagvalue' => 'index',
230-
'version' => 901,
231223
'withdbname' => false },
232224
{ 'sqlquery' => 'SELECT current_database() AS datname, relname as 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', 'tagvalue' => 'table',
233-
'version' => 901,
234225
'withdbname' => false },
235226
]
236227
}]

0 commit comments

Comments
 (0)