All Projects → braedon → prometheus-mysql-exporter

braedon / prometheus-mysql-exporter

Licence: MIT License
Prometheus MySQL Exporter

Programming Languages

python
139335 projects - #7 most used programming language
Dockerfile
14818 projects

Projects that are alternatives of or similar to prometheus-mysql-exporter

freeradius exporter
FreeRADIUS Prometheus Exporter
Stars: ✭ 25 (-24.24%)
Mutual labels:  prometheus, prometheus-exporter
dockerX
Examples of amazing Docker/Docker-Compose/Docker Swarm technologies
Stars: ✭ 17 (-48.48%)
Mutual labels:  prometheus, mariadb
hetzner exporter
Prometheus exporter for Hetzner
Stars: ✭ 16 (-51.52%)
Mutual labels:  prometheus, prometheus-exporter
sentry exporter
Prometheus exporter for Sentry
Stars: ✭ 23 (-30.3%)
Mutual labels:  prometheus, prometheus-exporter
nvidia gpu exporter
Nvidia GPU exporter for prometheus using nvidia-smi binary
Stars: ✭ 85 (+157.58%)
Mutual labels:  prometheus, prometheus-exporter
hcloud-pricing-exporter
A prometheus exporter for the current pricing and costs of your HCloud account
Stars: ✭ 19 (-42.42%)
Mutual labels:  prometheus, prometheus-exporter
magento2-prometheus-exporter
Simple Magento 2 Prometheus Exporter.
Stars: ✭ 40 (+21.21%)
Mutual labels:  prometheus, prometheus-exporter
Ssl exporter
Exports Prometheus metrics for SSL certificates
Stars: ✭ 211 (+539.39%)
Mutual labels:  prometheus, prometheus-exporter
deluge exporter
Prometheus exporter for the Deluge BitTorrent client
Stars: ✭ 24 (-27.27%)
Mutual labels:  prometheus, prometheus-exporter
postgres exporter
Postgres exporter
Stars: ✭ 14 (-57.58%)
Mutual labels:  prometheus, prometheus-exporter
Php Fpm exporter
A prometheus exporter for PHP-FPM.
Stars: ✭ 251 (+660.61%)
Mutual labels:  prometheus, prometheus-exporter
github exporter
Prometheus exporter for GitHub
Stars: ✭ 21 (-36.36%)
Mutual labels:  prometheus, prometheus-exporter
Mikrotik Exporter
prometheus mikrotik device(s) exporter
Stars: ✭ 248 (+651.52%)
Mutual labels:  prometheus, prometheus-exporter
pm2-prometheus-exporter
🐰 🐰 pm2 prometheus exporter
Stars: ✭ 90 (+172.73%)
Mutual labels:  prometheus, prometheus-exporter
Github Exporter
Prometheus exporter for github metrics
Stars: ✭ 231 (+600%)
Mutual labels:  prometheus, prometheus-exporter
chaos-exporter
Prometheus Exporter for Litmus Chaos Metrics
Stars: ✭ 25 (-24.24%)
Mutual labels:  prometheus, prometheus-exporter
Exporter exporter
A reverse proxy designed for Prometheus exporters
Stars: ✭ 194 (+487.88%)
Mutual labels:  prometheus, prometheus-exporter
Oracledb exporter
Prometheus Oracle database exporter.
Stars: ✭ 209 (+533.33%)
Mutual labels:  prometheus, prometheus-exporter
wildfly exporter
A prometheus exporter for Jboss Wildfly
Stars: ✭ 19 (-42.42%)
Mutual labels:  prometheus, prometheus-exporter
starboard-exporter
A standalone exporter for vulnerability reports and other CRs created by Starboard.
Stars: ✭ 22 (-33.33%)
Mutual labels:  prometheus, prometheus-exporter

Prometheus MySQL Exporter

This Prometheus exporter periodically runs configured queries against a MySQL server and exports the results as Prometheus gauge metrics.

Source Code | Python Package | Docker Image | Helm Chart

Installation

The exporter requires Python 3 and Pip 3 to be installed.

To install the latest published version via Pip, run:

> pip3 install prometheus-mysql-exporter

Note that you may need to add the start script location (see pip output) to your PATH.

Usage

Once installed, you can run the exporter with the prometheus-mysql-exporter command.

By default, it will bind to port 9207, query MySQL on localhost:3306 using the root user (with no password) and run queries configured in a file exporter.cfg in the working directory. You can change any defaults or other settings as required by passing in options:

> prometheus-mysql-exporter -p <port> -s <mysql server> -u <mysql username> -P <mysql password> -z <local timezone> -c <path to query config file>

Run with the -h flag to see details on all the available options.

Note that all options can be set via environment variables. The environment variable names are prefixed with MYSQL_EXPORTER, e.g. MYSQL_EXPORTER_MYSQL_USER=fred is equivalent to --mysql-user fred. CLI options take precidence over environment variables.

Command line options can also be set from a configuration file, by passing --config FILE. The format of the file should be Configobj's unrepre mode, so instead of --mysql-user fred you could use a configuration file config_file with mysql-user="fred" in it, and pass --config config_file. CLI options and environment variables take precedence over configuration files.

CLI options, environment variables, and configuration files all override any default options. The full resolution order for a given option is: CLI > Environment > Configuration file > Default.

See the provided exporter.cfg file for query configuration examples and explanation.

Docker

Docker images for released versions can be found on Docker Hub (note that no latest version is provided):

> sudo docker pull braedon/prometheus-mysql-exporter:<version>

To run a container successfully, you will need to mount a query config file to /usr/src/app/exporter.cfg and map container port 9207 to a port on the host. Any options placed after the image name (prometheus-mysql-exporter) will be passed to the process inside the container. For example, you will need to use this to configure the MySQL server using -s.

> sudo docker run --rm --name exporter \
    -v <path to query config file>:/usr/src/app/exporter.cfg \
    -p <host port>:9207 \
    braedon/prometheus-mysql-exporter:<version> -s <mysql server>

If you don't want to mount the query config file in at run time, you could extend an existing image with your own Dockerfile that copies the config file in at build time.

Helm

A Helm chart is available from the Helm repo at https://braedon.github.io/helm.

> helm repo add braedon https://braedon.github.io/helm
> helm repo update

> helm install braedon/prometheus-mysql-exporter --name <release name> \
                                                 --set mysql.server=<mysql server address> \
                                                 --set image.tag=<image tag>

See the prometheus-mysql-exporter chart README for more details on how to configure the chart.

Development

To install directly from the git repo, run the following in the root project directory:

> pip3 install .

The exporter can be installed in "editable" mode, using pip's -e flag. This allows you to test out changes without having to re-install.

> pip3 install -e .

To build a docker image directly from the git repo, run the following in the root project directory:

> sudo docker build -t <your repository name and tag> .

Send me a PR if you have a change you want to contribute!

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].