postgres_exporter
postgres_exporter copied to clipboard
The feature `Adding new metrics` exists in README but not implemented
What did you do?
Read the README about how to add a new metric.
What did you expect to see?
Find the method about how to add a new metric.
What did you see instead? Under which circumstances?
In the README:
### Adding new metrics
The exporter will attempt to dynamically export additional metrics if they are added in the
future, but they will be marked as "untyped". Additional metric maps can be easily created
from Postgres documentation by copying the tables and using the following Python snippet:
x = """tab separated raw text of a documentation table"""
for l in StringIO(x):
column, ctype, description = l.split('\t')
print """"{0}" : {{ prometheus.CounterValue, prometheus.NewDesc("pg_stat_database_{0}", "{2}", nil, nil) }}, """.format(column.strip(), ctype, description.strip())
Adjust the value of the resultant prometheus value type appropriately. This helps build
rich self-documenting metrics for the exporter.
And I cannot find any way to add this Python code. And checked the code, there is no there method to add new metric except Adding new metrics via a config file.
Check the commit, the document comes from the very early commit https://github.com/prometheus-community/postgres_exporter/commit/2a08787a90840a27d10ec519005ff92148055cd1#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R31 looks it means I need to create a new view in PostgreSQL using PL/Python, then add a new metric type in metricMaps and recompile postgres_exporter.
I think this is a document mistake.
I also second this. Adding new metrics via a config file is deprecated but there's no clear guideline as to how we can implement custom queries.
I also third this :)
Since PG_EXPORTER_EXTEND_QUERY_PATH is deprecated how can we implement custom queries/metrics now?
Is the answer is :
Use this exporter For generic SQL database monitoring see the [sql_exporter](https://github.com/burningalchemist/sql_exporter)
@fguiet I'm currently using this to good effect. Vonng/pg_exporter
Thank you @jamius19 , I will give it a try :)
I am also looking for way to implement custom metrics since the old way was deprecated. Will there be a replacement implementation with collectors of this feature or do I have to resort to using other collectors? I try to maintain as few different deployments as possible, so a configurable Postgres exporter would be much better for us than another third party tool
Any plans on providing custom metrics at all?
- the only way to do it right now being documented as deprecated
- the
new metricsdocumentation is more of a hint for developers - users are pointed to another tool that basically does the same as this project, just with built in support for custom metrics
I don't like to say it but it seems like anyone with custom requirements is shied away from the project.
+1
I just installed this tool because I thought it would enable to me to have custom queries, I'm disappointed it's marked as deprecated. Can someone give a hint about an alternative ?