• Centos7.3 Prometheus2.1安装部署


    一、概述

    Prometheus 是什么?
    Prometheus是一套开源的监控&报警&时间序列数据库的组合,起始是由SoundCloud公司开发的。随着发展,越来越多公司和组织接受采用Prometheus,社区也十分活跃,他们便将它独立成开源项目,并且有公司来运作。google SRE的书内也曾提到跟他们BorgMon监控系统相似的实现是Prometheus。现在最常见的Kubernetes容器管理系统中,通常会搭配Prometheus进行监控。

    Prometheus 的优点
    非常少的外部依赖,安装使用超简单
    已经有非常多的系统集成 例如:docker HAProxy Nginx JMX等等
    服务自动化发现
    直接集成到代码
    设计思想是按照分布式、微服务架构来实现的

    Prometheus 的特性
    自定义多维度的数据模型
    非常高效的存储 平均一个采样数据占 ~3.5 bytes左右,320万的时间序列,每30秒采样,保持60天,消耗磁盘大概228G。
    强大的查询语句
    轻松实现数据可视化
    等等

    相对于Graphite这种产品,还是有不少优点的。最让我觉得不错的是非常优秀的写性能和读取性能,它数据结构实现和OpenTSDB是有相似之处,有兴趣可以看看这个文档

    二、安装Prometheus
    下载http://cactifans.hi-www.com/prometheus/prometheus-2.1.0.linux-amd64.tar.gz
    prometheus安装比较简单,下载编译好的二进制文件,修改好配置文件,直启动即可
    下载之后解压

    tar zxvf prometheus-2.1.0.linux-amd64.tar.gz

    mv prometheus-2.1.0.linux-amd64 /usr/local/rometheus

    解压之后,会有一个默认的配置文件,可以直接使用这个配置文件启动

    cd /usr/local/prometheus
    ./prometheus --config.file=prometheus.yml
    即可启动prometheus,默认端口为9090.通过浏览器可以看到如下页面,表示prometheus启动正常。

     

    prometheus自带的绘图功能比较弱,如何才能使展示效果高大上呢?这里就要使用Grafana.借助与Grafana可以完全自定义属于自己的Dashboard监控视图。

    使用Yum安装Grafana
    yum install https://dl.grafana.com/oss/release/grafana-5.4.2-1.x86_64.rpm

    这将以包安装期间创建grafana-servergrafana用户身份启动进程默认HTTP端口是3000,默认用户和组是admin

    默认登录名和密码admin/admin

    systemctl daemon-reload

    systemctl start grafana-server

    systemctl status grafana-server

     

    #!/bin/bash

    #stop prometheus
    pidnum=$(sudo ps -ef|grep prometheus|grep -v grep|awk -F " " '{print $2}')
    sudo kill -9 ${pidnum}

    #start prometheus
    sudo nohup /opt/prometheus-2.8.0/prometheus --config.file /data/prometheus/conf/prometheus.yml --storage.tsdb.path /data --storage.tsdb.retention 30d --web.console.templates /opt/prometheus-2.8.0/consoles/ --web.console.libraries /opt/prometheus-2.8.0/console_libraries &

    作者:间歇性-精神病 出处:https://www.cnblogs.com/Intermittent-psychosis/ 本文版权归作者和博客园共有,欢迎转载,但未经作者同意请保留此段声明,请在文章页面明显位置给出原文连接 Github:https://github.com/don15278/python.git
  • 相关阅读:
    Windows Server 2008安装Memcached笔记
    解决powerDesinger12逆向工程报错:Unable to list the tables
    冒泡排序算法
    ASP.NET面试题(推荐_有答案)
    ASP.NET服务器控件分类简介
    将excel文件中的数据导入导出至SQL数据库中(Microsoft.Jet.OLEDB.4.0和Microsoft.ACE.OLEDB.12.0|office2003和office2007)
    关于sql access excel以及在web.config中数据库连接字符串的写法
    ODBC / OLEDB___DAO / RDO / ADO
    什么是CSV格式文档
    AppSettings和ConnectionStrings的区别
  • 原文地址:https://www.cnblogs.com/Intermittent-psychosis/p/10989916.html
Copyright © 2020-2023  润新知