• 【Linux】【Services】【SaaS】Docker+kubernetes(12. 部署prometheus/grafana/Influxdb实现监控)


    1.简介

    1.1. 官方网站:

    promethos:https://prometheus.io/

    grafana:https://grafana.com/

    1.2. 架构图

    2. 环境

    2.1. 机器列表

    功能与组件 机器名 Public IP Private IP Processor Cores RAM Storage 备注
    DNS/NTP/Ansible/Prometheus服务器 HCTJOSINFRA01 10.30.2.81 172.16.0.81        
    DNS/NTP/Ansible/Prometheus服务器 HCTJOSINFRA02 10.30.2.82 172.16.0.82        

    2.2. 软件版本

    promethos:2.1

    grafana:5.0

    3. 安装与配置

    3.1. promethos

    下载

    https://github.com/prometheus/prometheus/releases/download/v2.1.0/prometheus-2.1.0.linux-amd64.tar.gz

     解压

    tar zxfv prometheus-2.1.0.linux-amd64.tar.gz -C /opt/prometheus/

    直接后台启动

    ./prometheus --config.file=prometheus.yml &

    3.2. exporter

    常见exporter

    https://prometheus.io/download/

    以node_exporter为例监控机器

    tar zxvf node_exporter-0.15.2.linux-amd64.tar.gz -C /opt/prometheus_exporters/

    默认启动就好

    /opt/prometheus_exporters/node_exporter &

    修改配置文件/opt/prometheus/prometheus-2.1.0.linux-amd64/prometheus.yml

    [root@hctjosinfra01 prometheus-2.1.0.linux-amd64]# grep -E -v "^[[:space:]]*$|^[[:space:]]*#" /opt/prometheus/prometheus-2.1.0.linux-amd64/prometheus.yml
    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.
    alerting:
      alertmanagers:
      - static_configs:
        - targets:
    rule_files:
    scrape_configs:
      - job_name: 'prometheus'
        static_configs:
          - targets: ['localhost:9090']
      - job_name: 'linux_server'
        static_configs:
        - targets: ['172.16.0.81:9100']
          labels:
            instance: linux_server

    重启下prometheus-server

    3.3. grafana

    下载

    https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.0.0-1.x86_64.rpm

    安装

    yum install grafana-5.0.0-1.x86_64.rpm

    修改配置文件/etc/grafana/grafana.ini

    [database]
    url = mysql://grafana:grafana@172.16.0.25:3306/grafana
    [security]
    admin_user = admin
    admin_password = admin

    可以启动了

    systemctl start grafana-server

    输入机器IP:3000进入界面,添加数据源Prometheus(都是图形化的,就不赘述了)

  • 相关阅读:
    线段树&&线段树的创建线段树的查询&&单节点更新&&区间更新
    树&二叉树&&满二叉树&&完全二叉树&&完满二叉树
    Git学习记录 力做全网最强入门教程
    Markdown测试
    [转载] c++对结构体数组排序
    c/c++ 中#ifndef和#endif的作用及使用
    交互题(apio2016Gap)
    linux下对拍
    CTSC2017密钥、吉夫特
    省队十连测
  • 原文地址:https://www.cnblogs.com/demonzk/p/8418583.html
Copyright © 2020-2023  润新知