zoukankan      html  css  js  c++  java
  • ClickHouse 监控及备份 (二)Prometheus&Grafana 的安装

    0 Prometheus&Grafana 的安装

    Prometheus 下载地址:https://prometheus.io/download/
    Grafana 下载地址:https://grafana.com/grafana/download

    1 安装 Prometheus

    Prometheus 基于 Golang 编写,编译后的软件包,不依赖于任何的第三方依赖。只需要下载对应平台的二进制包,解压并且添加基本的配置即可正常启动 Prometheus Server。
    1.1 上传安装包
    上传 prometheus-2.26.0.linux-amd64.tar.gz 到虚拟机的/opt/software 目录
    1.2 解压安装包
    (1)解压到/opt/module 目录下
    [atguigu@hadoop1 software]$ tar -zxvf prometheus-2.26.0.linux-amd64.tar.gz -C /opt/module
    (2)修改目录名
    [atguigu@hadoop1 ~] cd /opt/module
    [atguigu@hadoop1 module] mv prometheus-2.26.0.linux-amd64 prometheus-2.26.0
    1.3 修改配置文件 prometheus.yml
    [atguigu@hadoop1 prometheus-2.26.0]$ vim prometheus.yml
    在 scrape_configs 配置项下添加配置:
    scrape_configs:
     
     - job_name: 'prometheus'
     static_configs:
     - targets: ['hadoop1:9090']
     #添加 ClickHouse 监控配置
     - job_name: clickhouse-1
     static_configs:
     - targets: ['hadoop1:9363']
    配置说明:
    1、global 配置块:控制 Prometheus 服务器的全局配置
    ➢scrape_interval:配置拉取数据的时间间隔,默认为 1 分钟。
    ➢evaluation_interval:规则验证(生成 alert)的时间间隔,默认为 1 分钟。
    2、rule_files 配置块:规则配置文件
    3、scrape_configs 配置块:配置采集目标相关, prometheus 监视的目标。Prometheus 自身
    的运行信息可以通过 HTTP 访问,所以 Prometheus 可以监控自己的运行数据。
    ➢job_name:监控作业的名称
    ➢static_configs:表示静态目标配置,就是固定从某个 target 拉取数据
    ➢targets : 指 定 监 控 的 目 标 , 其 实 就 是 从 哪 儿 拉 取 数 据 。 Prometheus 会 从
    http://hadoop1:9090/metrics 上拉取数据。
    Prometheus 是可以在运行时自动加载配置的。启动时需要添加:--web.enable-lifecycle
    1.4 启动 Prometheus Server
    [atguigu@hadoop1 prometheus-2.26.0]$ nohup ./prometheus --config.file=prometheus.yml > ./prometheus.log 2>&1 &
    ➢浏览器输入:http://hadoop1:9090/
    ➢点击 Status,选中 Targets:
    prometheus 是 up 状态,表示安装启动成功:

    2 Grafana 安装

    2.1 上传并解压
    (1)将 grafana-7.5.2.linux-amd64.tar.gz 上传至/opt/software/目录下,解压: 
    [atguigu@hadoop1 software]$ tar -zxvf grafana-7.5.2.linux-amd64.tar.gz -C /opt/module/
    (2)更改名字: 
    [atguigu@hadoop1 module]$ mv grafana-7.5.2.linux-amd64 grafana-7.5.2
    2.2 启动 Grafana
    [atguigu@hadoop1 grafana-7.5.2]$ nohup ./bin/grafana-server web > ./grafana.log 2>&1 &
    打开 web:http://hadoop1:3000,默认用户名和密码:admin
     

    本文来自博客园,作者:秋华,转载请注明原文链接:https://www.cnblogs.com/qiu-hua/p/15114354.html

  • 相关阅读:
    技巧和诀窍;在VS 2005里优化ASP.NET 2.0Web项目的Build性能
    [资源]Flex 中文帮助
    13 Awesome Javascript CSS Menus
    兼容FF\IE的事件获得方法
    MSVCR80D.dll not found解决方案
    [转]一种革命性的自绘菜单实现
    [ZZ]马化腾关于产品设计与用户体验的培训
    [ZZ]WatiN:在.NET中测试Web应用程序
    How to Recommender Systems?
    淘宝第三届D2在上海举办
  • 原文地址:https://www.cnblogs.com/qiu-hua/p/15114354.html
Copyright © 2011-2022 走看看