All Projects → chop-dbhi → Prometheus Sql

chop-dbhi / Prometheus Sql

Licence: bsd-2-clause
Service that exposes Prometheus metrics for a SQL result set.

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Prometheus Sql

Query Exporter
Export Prometheus metrics from SQL queries
Stars: ✭ 166 (+18.57%)
Mutual labels:  sql, metrics, prometheus
Memcached exporter
Exports metrics from memcached servers for consumption by Prometheus.
Stars: ✭ 109 (-22.14%)
Mutual labels:  metrics, prometheus
Grafana
The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
Stars: ✭ 45,930 (+32707.14%)
Mutual labels:  metrics, prometheus
Bigbluebutton Exporter
Prometheus exporter for BigBlueButton
Stars: ✭ 117 (-16.43%)
Mutual labels:  metrics, prometheus
Cerebral
Kubernetes cluster autoscaler with pluggable metrics backends and scaling engines
Stars: ✭ 138 (-1.43%)
Mutual labels:  metrics, prometheus
Pingprom
Prometheus uptime monitoring quickstart
Stars: ✭ 107 (-23.57%)
Mutual labels:  metrics, prometheus
Client java
Prometheus instrumentation library for JVM applications
Stars: ✭ 1,644 (+1074.29%)
Mutual labels:  metrics, prometheus
Homer App
HOMER 7.x Front-End and API Server
Stars: ✭ 88 (-37.14%)
Mutual labels:  metrics, prometheus
Promplot
Create plots from Prometheus metrics and send them to you
Stars: ✭ 125 (-10.71%)
Mutual labels:  metrics, prometheus
Starlette Prometheus
Prometheus integration for Starlette.
Stars: ✭ 127 (-9.29%)
Mutual labels:  metrics, prometheus
Prometheus To Cloudwatch
Utility for scraping Prometheus metrics from a Prometheus client endpoint and publishing them to CloudWatch
Stars: ✭ 127 (-9.29%)
Mutual labels:  metrics, prometheus
Prometheus Boshrelease
Prometheus BOSH Release
Stars: ✭ 99 (-29.29%)
Mutual labels:  metrics, prometheus
Tomcat exporter
A Prometheus exporter for Apache Tomcat
Stars: ✭ 99 (-29.29%)
Mutual labels:  metrics, prometheus
Prometheus
The Prometheus monitoring system and time series database.
Stars: ✭ 40,114 (+28552.86%)
Mutual labels:  metrics, prometheus
Filodb
Distributed Prometheus time series database
Stars: ✭ 1,286 (+818.57%)
Mutual labels:  metrics, prometheus
Heplify Server
HEP Capture Server
Stars: ✭ 110 (-21.43%)
Mutual labels:  metrics, prometheus
Go Http Metrics
Go modular http middleware to measure HTTP requests independent of metrics backend (with Prometheus and OpenCensus as backend implementations) and http framework/library
Stars: ✭ 128 (-8.57%)
Mutual labels:  metrics, prometheus
Systemd exporter
Exporter for systemd unit metrics
Stars: ✭ 82 (-41.43%)
Mutual labels:  metrics, prometheus
Nginx Prometheus Metrics
A production demo to collect prometheus metrics for nginx with lua embedded.
Stars: ✭ 84 (-40%)
Mutual labels:  metrics, prometheus
Rabbitmq Prometheus
A minimalistic Prometheus exporter of core RabbitMQ metrics
Stars: ✭ 124 (-11.43%)
Mutual labels:  metrics, prometheus

Prometheus SQL

GitHub release Github Releases Docker Pulls Docker Build Status GoDoc

Service that generates basic metrics for SQL result sets and exposing them as Prometheus metrics.

This service relies on the SQL Agent service to execute and return the SQL result sets.

Behavior

  • Static configuration files are used to define the queries to monitor.
  • Each query has a designated worker for execution.
  • An interval is used to define how often to execute the query.
  • Failed queries are automatically retried using a backoff mechanism.
  • Faceted metrics are supported.
  • A single metric's different facets can be filled in from different data sources.

Format

  • Metric names are exposed in the format query_result_<metric name>.
  • With faceted metrics, the name of the data column is determined by the data-field key in config, and all other columns (and column values) are exposed as labels.
  • If the result set consists of a single row and column, the metric value is obvious and data-field is not needed.
  • Label names under the same metric should be consistent.
  • Each different query (query entry in config) for the same metric should lead to different label values.

Usage

Usage of prometheus-sql:
  -config string
        Configuration file to define common data sources etc.
  -host string
        Host of the service.
  -lax
        Tolerate invalid files in queryDir
  -port int
        Port of the service. (default 8080)
  -queries string
        Path to file containing queries. (default "queries.yml")
  -queryDir string
        Path to directory containing queries.
  -service string
        Query of SQL agent service.

Queries file

A queries file is required for the application to know which data source to query and which queries that shall be monitored.

In the repository there is an example file that you can have a look at.

Config file

The config file is optional and can defined some default values for queries and data sources which can be referenced by queries. The benefit of referencing a data source will be reduction of duplication of database connection information. See example config file here and queries file which utilizes the config information.

Run via console

Create a queries.yml file in the current directory and run the following:

prometheus-sql

or for an alternate path, use the -queries or the -queryDir option:

prometheus-sql -queries ${PWD}/queries.yml

Run using Docker

Run the SQL agent service.

docker run -d --name sqlagent dbhi/sql-agent

Run this service. Mount the queries.yml file and link the SQL Agent service.

docker run -d \
  --name prometheus-sql \
  -p 8080:8080 \
  -v ${PWD}/queries.yml:/queries.yml \
  --link sqlagent:sqlagent \
  dbhi/prometheus-sql

If you want to separate database connection information etc you can do that by specifying data sources in separate file which you then can mount:

docker run -d \
  --name prometheus-sql \
  -p 8080:8080 \
  -v ${PWD}/queries.yml:/queries.yml \
  -v ${PWD}/prometheus-sql.yml:/prometheus-sql.yml \
  --link sqlagent:sqlagent \
  dbhi/prometheus-sql \
  -service http://sqlagent:5000 \
  -config prometheus-sql.yml

To view a plain text version of the metrics, open up the browser to the http://localhost:8080/metrics (or http://192.168.59.103:8080/metrics for boot2docker users).

Run using a Docker Compose file

Alternately, use the docker-compose.yml file included in this repository. The volumes section be added for mounting the queries.yml file.

Contributing

Read instructions how to contribute before you start.

FAQ

How do you I provide additional options to the database connection?

Additional options are set in the config.yml file, specifically as additional key-value pairs in the connection map. These are passed to the SQL Agent service which construct a DSN string to establish the connection on the backend (alternately you can set the dsn key as the full string).

As an example, a common gotcha when using Postgres in a development environment is to ignore SSL not being enabled on the server. This can be done by adding the sslmode: disable option in the connection map.

    # ...
    connection:
        host: example.org
        port: 5432
        user: postgres
        password: s3cre7
        database: products
        sslmode: disable
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].