[collectd] wip patch to annotate postgres plugin values
Mark Wong
mark.wong at myemma.com
Tue Jan 25 17:37:57 CET 2011
Hi all,
I have a couple patches put together for annotating postgresql plugin
values with database, schema, table, and index names. I'm not sure I
did this in the best way because I copied several udb_* functions into
postgresql.c with primarily parameter changes in order to pass extra
data around. Any suggestions for these 2 changes:
https://github.com/mwongatemma/collectd/commit/2ac90b916aacfe9d992e399b33ac76918e54c33d
https://github.com/mwongatemma/collectd/commit/d7ece276cd9c9a03a9a50fe2be67c4469dc8a478
To illustrate what I was attempting to accomplish:
SELECT datname, numbackends
FROM pg_stat_database
This query lets us get stats for all databases in a single query. In
the <Database> tag the following parameter needs to be set to annotate
the data with which database the data is from:
DatabasenameColumn 0
Similarly for table stats:
SELECT schemaname, relname, seq_scan
FROM pg_stat_all_tables
To keep the data distinct, the following parameters need to be set for
each value selected in the <Result> tag, resulting in a reversed order
naming scheme in type_instance:
InstancePrefix "seq_scan"
InstancesFrom "relname" "schemaname"
In the <Database> tag the following parameters need be set to annotate
the data with the schema and table information:
SchemanameColumn 0
TablenameColumn 1
Again for index stats:
SELECT schemaname, relname, indexrelname, idx_scan
FROM pg_stat_all_indexes
To keep the data distinct, the following parameters need to be set for
each value selected in the <Result> tag, resulting in a reversed order
naming scheme in type_instance:
InstancePrefix "idx_scan"
InstancesFrom "indexrelname" "relname" "schemaname"
In the <Database> tag the following parameters need be set to annotate
the data with the schema, table, and index information:
SchemanameColumn 0
TablenameColumn 1
IndexnameColumn 2
How does that sound?
Regards,
Mark
--
Mark Wong
Developer | Emma(R)
mark.wong at myemma.com
800.595.4401
Emma helps organizations everywhere communicate& market in style.
Visit us online at http://www.myemma.com.
More information about the collectd
mailing list