prometheus-mysql

发布时间 2023-04-03 10:57:51作者: edclol

wget https://github.com/prometheus/prometheus/releases/download/v2.42.0/prometheus-2.42.0.linux-amd64.tar.gz

nohup ./node_exporter &

 netstat -lnptu | grep 9100

# 启动mysqld_exporter
nohup ./mysqld_exporter --config.my-cnf=./.my.cnf &

# 确认是否正常启动(默认端口9104)
[root@mysql01 ~]# netstat -lnptu | grep 9104
# my global config
global:
  scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
  evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
  # scrape_timeout is set to the global default (10s).

# Alertmanager configuration
alerting:
  alertmanagers:
    - static_configs:
        - targets:
           - alertmanager:9193

# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
  # - "first_rules.yml"
  # - "second_rules.yml"

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  - job_name: "prometheus"
    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.
    static_configs:
      - targets: ["localhost:8091"]
      
  - job_name: "node004_node"
    static_configs:
      - targets: ["node004:9100"]
      
  - job_name: "node004_mysql"
    static_configs:
      - targets: ["node004:9104"]      
nohup ./prometheus --config.file="./prometheus.yml" --web.listen-address=:8091 &