summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 83b945c)
raw | patch | inline | side by side (parent: 83b945c)
author | Sebastian Harl <sh@tokkee.org> | |
Sat, 16 Aug 2008 17:40:09 +0000 (19:40 +0200) | ||
committer | Florian Forster <octo@huhu.verplant.org> | |
Tue, 19 Aug 2008 08:12:00 +0000 (10:12 +0200) |
This is a new default query which collects the on-disk size of a database in
bytes. A new type "pg_db_size" has been added to types.db for this purpose.
The documentation in collectd.conf(5) and collection.cgi have been updated to
reflect this change.
Signed-off-by: Sebastian Harl <sh@tokkee.org>
Signed-off-by: Florian Forster <octo@huhu.verplant.org>
bytes. A new type "pg_db_size" has been added to types.db for this purpose.
The documentation in collectd.conf(5) and collection.cgi have been updated to
reflect this change.
Signed-off-by: Sebastian Harl <sh@tokkee.org>
Signed-off-by: Florian Forster <octo@huhu.verplant.org>
diff --git a/contrib/collection.cgi b/contrib/collection.cgi
index cab7543f0e844d32b1c60861bd19ce893d180f97..d3e5ccf81b4e1bbbb221841a68ce2b07abcf24ee 100755 (executable)
--- a/contrib/collection.cgi
+++ b/contrib/collection.cgi
'GPRINT:pg_blks_avg:AVERAGE:%4.1lf%s Avg,',
'GPRINT:pg_blks_max:MAX:%4.1lf%s Max,',
'GPRINT:pg_blks_avg:LAST:%4.1lf%s Last'],
+ pg_db_size => ['DEF:pg_db_size_avg={file}:value:AVERAGE',
+ 'DEF:pg_db_size_min={file}:value:MIN',
+ 'DEF:pg_db_size_max={file}:value:MAX',
+ "AREA:pg_db_size_max#$HalfBlue",
+ "AREA:pg_db_size_min#$Canvas",
+ "LINE1:pg_db_size_avg#$FullBlue:Bytes",
+ 'GPRINT:pg_db_size_min:MIN:%4.1lf%s Min,',
+ 'GPRINT:pg_db_size_avg:AVERAGE:%4.1lf%s Avg,',
+ 'GPRINT:pg_db_size_max:MAX:%4.1lf%s Max,',
+ 'GPRINT:pg_db_size_avg:LAST:%4.1lf%s Last'],
pg_n_tup_c => ['DEF:pg_n_tup_avg={file}:value:AVERAGE',
'DEF:pg_n_tup_min={file}:value:MIN',
'DEF:pg_n_tup_max={file}:value:MAX',
diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod
index 40f5027e5be6dcf7daefe094f1f873801f5f39d1..1e71badb02712d4bc83d7d56063e253cf195025e 100644 (file)
--- a/src/collectd.conf.pod
+++ b/src/collectd.conf.pod
This query collects disk block access counts for user tables.
+=item B<disk_usage>
+
+This query collects the on-disk size of the database in bytes.
+
=back
The B<Database> block defines one PostgreSQL database for which to collect
Specify a I<query> which should be executed for the database connection. This
may be any of the predefined or user-defined queries. If no such option is
given, it defaults to "backends", "transactions", "queries", "query_plans",
-"table_states", "disk_io". Else, the specified queries are used only.
+"table_states", "disk_io" and "disk_usage". Else, the specified queries are
+used only.
=back
diff --git a/src/postgresql.c b/src/postgresql.c
index 135a8270fde16a8ba71fcaf871319bf28198e536..f326a2342192a6c2c3de69126aaf0025eaaae8e0 100644 (file)
--- a/src/postgresql.c
+++ b/src/postgresql.c
"queries",
"query_plans",
"table_states",
- "disk_io"
+ "disk_io",
+ "disk_usage"
};
static int def_queries_num = STATIC_ARRAY_SIZE (def_queries);
index 93a29b6ae6ac0fd08ad0da35d593b163073415a9..9d21217cecbdc5db1110775024a6558992ad28c4 100644 (file)
Column pg_blks tidx_hit
</Query>
+<Query disk_usage>
+ Query "SELECT pg_database_size($1);"
+
+ Param database
+
+ Column pg_db_size
+</Query>
+
diff --git a/src/types.db b/src/types.db
index fabae12471cd6448d36ed83b19951e3e6a9e1cd3..a31809dc2e4b6a2969301a891ccd129d72fca2d5 100644 (file)
--- a/src/types.db
+++ b/src/types.db
nginx_requests value:COUNTER:0:134217728
percent percent:GAUGE:0:100.1
pg_blks value:COUNTER:0:U
+pg_db_size value:GAUGE:0:U
pg_n_tup_c value:COUNTER:0:U
pg_n_tup_g value:GAUGE:0:U
pg_numbackends value:GAUGE:0:U