Prometheus 監控Rabbitmq

系統:CentOS6.6
安裝 go語言
[root@server0 ~]# tar zxvf go1.8.1.linux-amd64.tar.gz -C /usr/local
[root@server0 ~]# mkdir /Golang
[root@server0 ~]# vim /etc/profile

export GOROOT=/usr/local/go 
export GOBIN=$GOROOT/bin
export GOPKG=$GOROOT/pkg/tool/linux_amd64 
export GOARCH=amd64
export GOOS=linux
export GOPATH=/Golang
export PATH=$PATH:$GOBIN:$GOPKG:$GOPATH/bin

[root@server0 ~]# source /etc/profile
[root@server0 ~]# go version
go version go1.8.1 linux/amd64
2、安裝prometheus
[root@server0 ~]# tar zxvf prometheus-1.6.3.linux-amd64.tar.gz -C /usr/local
[root@server0 ~]# cd /usr/local/prometheus-1.6.3.linux-amd64
[root@server0 prometheus-1.6.3.linux-amd64]# nohup ./prometheus -config.file=prometheus.yml &
3、安裝grafana
[root@server0 ~]# rpm -ivh grafana-4.3.0-1.x86_64.rpm

warning: grafana-4.3.0-1.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 24098cb6: NOKEY
Preparing...                ########################################### [100%]
   1:grafana                ########################################### [100%]
### NOT starting grafana-server by default on bootup, please execute
 sudo /sbin/chkconfig --add grafana-server
### In order to start grafana-server, execute
 sudo service grafana-server start
POSTTRANS: Running script

[root@server0 ~]# service grafana-server start
Starting Grafana Server: … [確定]
[root@server0 ~]# chkconfig grafana-server on
3、安裝rabbitmq exporter
[root@server0 ~]# tar zxvf rabbitmq_exporter-0.20.0.linux-amd64.tar.gz -C /usr/local/
[root@server0 ~]# cd /usr/local/rabbitmq_exporter-0.20.0.linux-amd64/
[root@server0 rabbitmq_exporter-0.20.0.linux-amd64]# ls
LICENSE rabbitmq_exporter
[root@server0 rabbitmq_exporter-0.20.0.linux-amd64]# RABBIT_USER=erpmq RABBIT_PASSWORD=erpmq OUTPUT_FORMAT=JSON PUBLISH_PORT=9099 RABBIT_URL=http://localhost:15672 nohup ./rabbitmq_exporter &
[1] 7396
nohup: 忽略輸入並把輸出追加到”nohup.out”

[root@server0 rabbitmq_exporter-0.20.0.linux-amd64]# ls
LICENSE nohup.out rabbitmq_exporter
[root@server0 rabbitmq_exporter-0.20.0.linux-amd64]# tail nohup.out

{"level":"info","msg":"Using default certificate pool","time":"2017-05-23T20:24:50+08:00"}
{"BRANCH":"heads/v0.20.0","BUILD_DATE":"20170512-20:08:52","OUTPUT_FORMAT":"JSON","PUBLISH_PORT":"9099","RABBIT_CAPABILITIES":"","RABBIT_URL":"http://localhost:15672","RABBIT_USER":"erpmq","REVISION":"a301c6a463bb740123fb2c54b43ac6189a08c019","VERSION":"0.20.0","level":"info","msg":"Starting RabbitMQ exporter","time":"2017-05-23T20:24:50+08:00"}

4、修改prometheus的配置文件
[root@server0 prometheus-1.6.3.linux-amd64]# vim 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: 'RabbitMQ'
    static_configs:
      - targets: ['localhost:9099']
        labels:
            instance: RabbitMQ-127.0.0.1   

5、重啓prometheus
6、在grafana中添加prometheus的數據來源
這裏寫圖片描述
這裏寫圖片描述
這裏寫圖片描述這裏寫圖片描述

參考:
http://www.cnblogs.com/shhnwangjian/p/6878199.html
http://www.cnblogs.com/shhnwangjian/p/6879683.html
http://blog.csdn.net/jb19900111/article/details/55652523
https://www.cnblogs.com/sfnz/p/6566951.html

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章