![]() Now check some takeaways about the postgres-exporter configuration. This is only a very simple example of what you can do. Pg_database_size_bytes 8.602115e+06Īs you can see, the metric also shows the information added to the definition, the TYPE and the description as HELP, and all fields with LABEL type are added to the metric between the curly brackets among others gathered from the environment.Īnd a simple representation using Grafana: # HELP pg_database_size_bytes Disk space used by the database in bytes # TYPE pg_database_size_bytes gauge Metric definition:Ī basic metric definition, could look like this: This implies that there must be at least a numeric value ( GAUGE, COUNTER OR HISTROGRAM) in every metric. Metrics with LABEL type are not exposed by the API because they will be part of the numeric metrics and they will be very useful to apply filters. Postgres exporter will expose the metrics making a concatenation of the metric name and the metric field: How the metrics are built and expose by the API: Usage: LABEL, GAUGE, COUNTER OR HISTROGRAM this will depend on the data retrieved and how you plan to show it in a graph.ĭescription: A short description of the data retrieved. Define it in the order as the query results and for each metric(field), you need to specify: Metrics: This is an array of each field returned by your query. Each field returned by your query will represent a metric in the definition. Query: Here goes your query definition and it doesn’t matter the complexity, it could be a simple or a very complex one just make sure the execution is fast. Consider adding this parameter if the metrics data does not change very often. ![]() Master: This value is often confused with the Leader host in a replication environment but what it really means is that the query will only be executed in the database configured in the DATA_SOURCE_NAME parameter.Ĭache_seconds: The amount of time to keep the last value scraped before running the query again. Metric_name: Simple as the name you want for your metric. The structure is very simple and there are some consideration you need to know about each part of it: Metric_name: master: true (optional) cache_seconds: 30 (optional) query: "SELECT metric_1, metric_2 FROM table" metrics: - metric_1: usage: "LABEL" description: "Metric 1 description" - metric_2: usage: "GAUGE" description: "Metric 2 description"
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |