博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
prometheus + grafana安装部署(centos6.8)
阅读量:4359 次
发布时间:2019-06-07

本文共 2813 字,大约阅读时间需要 9 分钟。

官方网址:

GitHub网址:

软件下载地址:

第三方中文介绍:

 

prometheus介绍

       Prometheus是一个开源的系统监控和报警的工具包,最初由SoundCloud发布。

特点:

  • 多维数据模型(有metric名称和键值对确定的时间序列)
  • 灵活的查询语言
  • 不依赖分布式存储
  • 通过pull方式采集时间序列,通过http协议传输
  • 支持通过中介网关的push时间序列的方式
  • 监控数据通过服务或者静态配置来发现
  • 支持图表和dashboard等多种方式

组件:

  • Prometheus 主程序,主要是负责存储、抓取、聚合、查询方面。
  • Alertmanager 程序,主要是负责实现报警功能。
  • Pushgateway 程序,主要是实现接收由Client push过来的指标数据,在指定的时间间隔,由主程序来抓取。
  • *_exporter 这类是不同系统已经实现了的集成。

架构:

prometheus部署

1、下载安装包prometheus-1.6.2.linux-amd64.tar.gz

2、解压

tar -xvf prometheus-1.6.2.linux-amd64.tar.gzcd prometheus-1.6.2.linux-amd64

3、配置prometheus.yml 

  • scrape_interval: 15s   # 默认15秒到目标处抓取数据

4、启动

nohup ./prometheus -config.file=prometheus.yml &或nohup /opt/prometheus-1.6.2.linux-amd64/prometheus &

5、WEB页面访问http://localhost:9090/ ,可以看到Prometheus的graph页面。

备注:参考文章 

 

grafana部署

1、安装

wget https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-4.2.0-1.x86_64.rpmsudo yum install initscripts fontconfig -ysudo rpm -Uvh grafana-4.2.0-1.x86_64.rpm

2、启动服务service grafana-server start

3、访问页面http://localhost:3000 ,默认账号、密码admin/admin

4、Prometheus 和 Grafana 的对接

参考文章:

 

MySQL的dashboards(Grafana)

git clone https://github.com/percona/grafana-dashboards.gitcp -r grafana-dashboards/dashboards /var/lib/grafana/dashboards

编辑Grafana配置文件

vi /etc/grafana/grafana.ini[dashboards.json]enabled = truepath = /var/lib/grafana/dashboards

重启service grafana-server restart

 

mysql监控部署

在需要监控的mysql上安装 node_exporter和 mysqld_exporter

下载

tar -xvf node_exporter-0.14.0.linux-amd64.tar.gzcd node_exporter-0.14.0.linux-amd64nohup ./node_exporter &
tar -xvf mysqld_exporter-0.10.0.linux-amd64.tar.gzcd mysqld_exporter-0.10.0.linux-amd64vi .my.cnf[client]user=rootpassword=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

 

redis监控部署

下载 

tar -xvf redis_exporter-v0.11.linux-amd64.tar.gznohup /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.gzcd redis_exporter-0.11 cp *json /var/lib/grafana/dashboards/

服务端配置,文件prometheus.yml

scrape_configs:  # The job name is added as a label `job=
` 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

 

转载于:https://www.cnblogs.com/shhnwangjian/p/6878199.html

你可能感兴趣的文章
ios中@class和 #import,两种方式的讨论
查看>>
OpenStack,ceph
查看>>
Odoo 8.0 new API 之Environment
查看>>
页面传值中get和post区别
查看>>
PHP-CGI漏洞成因原理剖析和利用
查看>>
20145212 罗天晨 《网络对抗》Exp3 Advanced 恶意代码伪装技术实践
查看>>
访问快科技(驱动之家)某个新闻会自动跳转到web.techtoutiao.win
查看>>
Cisco 的基本配置实例之四----vlan的规划及配置(核心交换机)
查看>>
Windows2003无法连接远程桌面问题 解决方法!
查看>>
解决 The word is not correctly spelled问题(转载)
查看>>
main函数的参数和返回值
查看>>
js的键盘事件监控回车,然后禁用当前input编辑,创建的input,但是如下代码只能监控到一次,第二次不能监控到。...
查看>>
【转帖】4412ARM开发板学习笔记(一)
查看>>
数据库中的事务控制语句
查看>>
课堂作业——找1
查看>>
Mac下安装与配置Go语言开发环境
查看>>
组件化网页开发 3步骤 / 20门课
查看>>
LeetCode 896. 单调数列(Monotonic Array)
查看>>
HDU 6318 - Swaps and Inversions [2018杭电多校联赛第二场 J](离散化+逆序对)
查看>>
千万级高性能长连接网关揭秘
查看>>