Прометей mysql -экспортер - PullRequest
0 голосов
/ 05 марта 2020

Я пытаюсь использовать Прометей для получения данных от MariaDB. В частности, таблица Userstat.

У меня три машины. На первом я установил базу данных MariaDB, на втором - Prometheus, а на третьем - Grafana.

Я установил функцию пользовательской среды на MariaDB SET GLOBAL userstat=1; и создал mysql_exporter user

MariaDB [(none)]> CREATE USER 'exporter'@'444.333.22.111' IDENTIFIED BY 'password';
MariaDB [(none)]> GRANT PROCESS, REPLICATION CLIENT, SELECT ON *.* TO 'exporter'@'444.333.22.111';
MariaDB [(none)]> FLUSH PRIVILEGES;

Затем я установил Prometheus и mysql exporter на второй машине. Я получил Прометей из репозиториев и mysql_exporter.

Путь к моему экспортеру: /etc/default/prometheus-mysqld-exporter и выглядит следующим образом:

# By default the connection string will be read from
# $HOME/my.cnf or -config.my-cnf.
# To set a connection string from the environment instead, uncomment the
# following line.

 export DATA_SOURCE_NAME="exporter:password@(444.333.22.111:3306)/mysql"
# Set the command-line arguments to pass to the exporter.
# ARGS='-config.my-cnf /etc/mysql/debian.cnf'

    -collect.auto_increment.columns
    -collect.binlog_size
    -collect.info_schema.userstats
    -config.my-cnf string
    -web.listen-address=0.0.0.0:9104

Prometheus.yml:

# Sample config for Prometheus.

global:
  scrape_interval:     1s # By default, scrape targets every 15 seconds.
  evaluation_interval: 15s # By default, scrape targets every 15 seconds.
  # scrape_timeout is set to the global default (10s).

  # Attach these labels to any time series or alerts when communicating with
  # external systems (federation, remote storage, Alertmanager).
  external_labels:
      monitor: 'example'

# Load and evaluate rules in this file every 'evaluation_interval' seconds.
rule_files:
  # - "first.rules"
  # - "second.rules"

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: 'prometheus'

    # Override the global default and scrape targets from this job every 5 seconds.
    scrape_interval: 5s
    scrape_timeout: 5s

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
            - targets: ['localhost:9090', 'localhost:9104']

  - job_name: node
    # If prometheus-node-exporter is installed, grab stats about the local
    # machine by default.
    static_configs:
      - targets: ['localhost:9100']

К сожалению, он не выполняет то, что я хочу, и продолжайте следить за машиной, на которой установлен Prometheus. Есть идеи, где может быть проблема? Заранее спасибо!

...