Mysql 普罗米修斯
我想用普罗米修斯从马里亚布那里获取数据。特别是Userstat表 我有三台机器。第一个是我安装了MariaDB数据库,第二个是普罗米修斯数据库,第三个是Grafana数据库 我在MariaDB上设置了用户状态特性Mysql 普罗米修斯,mysql,mariadb,prometheus,grafana,prometheus-node-exporter,Mysql,Mariadb,Prometheus,Grafana,Prometheus Node Exporter,我想用普罗米修斯从马里亚布那里获取数据。特别是Userstat表 我有三台机器。第一个是我安装了MariaDB数据库,第二个是普罗米修斯数据库,第三个是Grafana数据库 我在MariaDB上设置了用户状态特性set GLOBAL userstat=1 并创建了mysql\u导出器用户 MariaDB [(none)]> CREATE USER 'exporter'@'444.333.22.111' IDENTIFIED BY 'password'; MariaDB [(none)]&g
set GLOBAL userstat=1代码>
并创建了mysql\u导出器用户
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_导出器中得到了普罗米修斯
“我的导出器”的路径是:/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
普罗米修斯:
# 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']
普罗米修斯的样本配置。
全球的:
刮伤间隔:1s默认情况下,每15秒刮伤一次目标。
评估间隔:15s默认情况下,每15秒刮取一次目标。
#刮削超时设置为全局默认值(10秒)。
#与通信时,将这些标签附加到任何时间序列或警报
#外部系统(联合、远程存储、Alertmanager)。
外部标签:
监视器:“示例”
#每隔“评估间隔”秒加载并评估此文件中的规则。
规则文件:
#-“第一,规则”
#-“第二,规则”
#仅包含一个要刮取的端点的刮取配置:
#这是普罗米修斯本人。
刮取_配置:
#作业名称作为标签“job=”添加到此配置中的任何时间序列。
-工作名称:“普罗米修斯”
#覆盖全局默认值,并每隔5秒从该作业中清除目标。
刮除间隔:5s
刮擦超时:5s
#metrics\u路径默认为“/metrics”
#方案默认为“http”。
静态\u配置:
-目标:['localhost:9090','localhost:9104']
-作业名称:节点
#如果安装了prometheus node exporter,请获取有关本地节点的统计信息
#默认情况下,这台机器。
静态\u配置:
-目标:['localhost:9100']
不幸的是,它没有做我想做的事情,并一直监视我安装了普罗米修斯的机器。你知道哪里有问题吗?
提前谢谢 我不知道是否需要,但根据我的经验,您通常希望在运行服务的机器上安装导出器,即在MariaDB服务器上安装mysqld导出器。谢谢回复!我在想导出器可以从远程服务器中删除数据库数据。他们有任何文档,我可以在哪里找到关于这个主题的一些提示?也许可以在不同的服务器上安装mysqld exporter,然后安装MariaDB-但我从来没有见过这样做的例子。也许可以尝试在MariaDB服务器上本地安装mysqld exporter,如果问题仍然存在,那么您可以继续从那里进行故障排除。请注意,您应该将mysqld exporter置于自己的工作中。工作标签通常用于标识度量领域。我不知道您期望什么,但您的节点导出器只有一个静态配置。在你的描述中有很多不符合逻辑的活动部分。这令人困惑。你说的“继续监视我安装了普罗米修斯的机器”是什么意思?我的问题基本上是,我是否可以通过普罗米修斯mysql exporter远程抓取数据?我有两台机器,第一台是普罗米修斯和mysql exporter,第二台是MariaDB。