Giter VIP home page Giter VIP logo

prometheus_sql_exporter's Introduction

CircleCI Go Report Card Coverage Status

prometheus_sql_exporter

The Prometheus SQL Exporter (PROSE) is a tool that converts user-specified SQL queries into Prometheus metrics. It has the following features

  • Create any number of Prometheus gauges
  • Attach any number of raw SQL queries to a Prometheus gauge
  • Support PostgreSQL and MySQL

Caveats:

  • Only gauges are supported
  • All SQL queries must return a single integer metric (e.g. count())

Getting started

It is intended that this tool is used as a Docker container.

To use with Kubernetes, use a manifest that looks like the provided example

CLI Arguments

$ docker run -it quay.io/weaveworks/prometheus_sql_exporter --help
This service will monitor a database for specified queries and expose them to prometheus

Usage:
prose [flags]
prose [command]

Available Commands:
version     Output the version of prose

Flags:
    --dbsource string   Database source name; includes the DB driver as the scheme. E.g. postgres://user:password@localhost:5432/database?sslmode=disable or mysql://user:password@tcp(localhost:3306)/database?tls=skip-verify
    --listen string     Listen address for API clients (default ":80")
    --queries string    Path to yaml file which describes metrics and queries (default "queries.yaml")

Use "prose [command] --help" for more information about a command.

Queries configuration

Below is an example queries yaml file:

gauges:
- gauge:
  namespace: "mynamespace"
  subsystem: "mysubsystem"
  name: "some_name"
  label: "state"
  queries:
  - name: "number"
    query: "SELECT count(1) FROM database WHERE id > 10"
  - name: "ok"
    query: "SELECT count(1) FROM database"
...
  • gauges is a list of Prometheus gauges
  • gauge is a single instance
  • namespace, subsystem, and name form the name of the Prometheus object
  • label is the Prometheus label corresponding to the queries
  • queries is a list of queries to perform
  • queries.name is a name applied to the label.
  • queries.query is the SQL query to perform on the DB.

This configuration will produce two Prometheus metrics, in the form:

# HELP mynamespace_mysubsystem_some_name Prose Guage for some_name
# TYPE mynamespace_mysubsystem_some_name gauge
mynamespace_mysubsystem_some_name{state="number"} 90
mynamespace_mysubsystem_some_name{state="ok"} 100

Development

The build lifecycle is controlled by the Makefile. See the Makefile for details

Release

To perform a release, create a new GH release.

Getting Help

If you have any questions about, feedback for or problems with prometheus_sql_exporter:

Weaveworks follows the CNCF Code of Conduct. Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting a Weaveworks project maintainer, or Alexis Richardson ([email protected]).

Your feedback is always welcome!

prometheus_sql_exporter's People

Contributors

dholbach avatar paulbellamy avatar philwinder avatar prymitive avatar rade avatar squaremo avatar tomwilkie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

prometheus_sql_exporter's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.