官方網址:https://prometheus.io/html
GitHub網址:https://github.com/prometheus/prometheusnode
軟件下載地址:https://prometheus.io/download/python
第三方中文介紹:https://github.com/1046102779/prometheusmysql
Prometheus是一個開源的系統監控和報警的工具包,最初由SoundCloud發佈。linux
特色:git
組件:github
架構:redis
一、下載安裝包prometheus-1.6.2.linux-amd64.tar.gzsql
https://github.com/prometheus/prometheus/releases/tag/v1.6.2json
二、解壓
tar -xvf prometheus-1.6.2.linux-amd64.tar.gz cd prometheus-1.6.2.linux-amd64
三、配置prometheus.yml
四、啓動
nohup ./prometheus -config.file=prometheus.yml & 或 nohup /opt/prometheus-1.6.2.linux-amd64/prometheus &
五、WEB頁面訪問http://localhost:9090/ ,能夠看到Prometheus的graph頁面。
備註:參考文章 http://www.cnblogs.com/vovlie/p/Prometheus_install.html
http://docs.grafana.org/installation/rpm/
一、安裝
wget https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-4.2.0-1.x86_64.rpm sudo yum install initscripts fontconfig -y sudo rpm -Uvh grafana-4.2.0-1.x86_64.rpm
二、啓動服務service grafana-server start
三、訪問頁面http://localhost:3000 ,默認帳號、密碼admin/admin
四、Prometheus 和 Grafana 的對接
https://prometheus.io/docs/visualization/grafana/
參考文章:http://www.cnblogs.com/sfnz/p/6566951.html
https://github.com/percona/grafana-dashboards
git clone https://github.com/percona/grafana-dashboards.git cp -r grafana-dashboards/dashboards /var/lib/grafana/dashboards
編輯Grafana配置文件
vi /etc/grafana/grafana.ini [dashboards.json] enabled = true path = /var/lib/grafana/dashboards
重啓service grafana-server restart
在須要監控的mysql上安裝 node_exporter和 mysqld_exporter
下載 https://prometheus.io/download/
tar -xvf node_exporter-0.14.0.linux-amd64.tar.gz cd node_exporter-0.14.0.linux-amd64 nohup ./node_exporter &
tar -xvf mysqld_exporter-0.10.0.linux-amd64.tar.gz cd mysqld_exporter-0.10.0.linux-amd64 vi .my.cnf [client] user=root password=root ./mysqld_exporter -config.my-cnf=".my.cnf" &
服務端配置,文件prometheus.yml
scrape_configs: - job_name: 'prometheus' static_configs: - targets: ['localhost:9090'] - job_name: 'mysql' static_configs: - targets: ['10.10.83.162:9104'] labels: instance: db-10.10.83.162
下載 https://github.com/oliver006/redis_exporter/releases
tar -xvf redis_exporter-v0.11.linux-amd64.tar.gz nohup /opt/redis_exporter -redis.addr "redis://10.10.83.162:16379" &
grafana配置
下載 redis_exporter-0.11.tar.gz
tar -xvf redis_exporter-0.11.tar.gz cd redis_exporter-0.11 cp *json /var/lib/grafana/dashboards/
服務端配置,文件prometheus.yml
scrape_configs: # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config. - job_name: 'prometheus' # metrics_path defaults to '/metrics' # scheme defaults to 'http'. static_configs: - targets: ['localhost:9090'] - job_name: 'mysql' static_configs: - targets: ['10.10.83.162:9104'] labels: instance: db-10.10.83.162 - job_name: redis_exporter static_configs: - targets: ['10.10.83.162:9121'] labels: instance: redis-10.10.83.162