1、简介

prometheus就是监控系统+TSDB(时间序列数据库),通过pull方式从exporter获取时间序列数据,存入本地TSDB,被监控端需安装exporter作为http端点暴露指标数据

prometheus server只提供一套内置查询语言PromQL,一个表达式浏览器和一个浏览数据的图形界面

2、prometheus部署

安装prometheus之前必须安装ntp时间同步,因为prometheus采集的T_S数据对系统时间的准确性要求

2.1 二进制安装
mkdir /application
wget https://github.com/prometheus/prometheus/releases/download/v2.22.0/prometheus-2.22.0.linux-amd64.tar.gz
tar xf prometheus-2.22.0.linux-amd64.tar.gz -C /application/
cd /applicaiton &&mv prometheus-2.22.0.linux-amd64 prometheus
2.2 配置
cd /prometheus
vim prometheus.yml
# 全局配置
global:
scrape_interval: 15s # 采集数据的时间间隔为15s(时间越短,存储压力越大)
evaluation_interval: 15s # 监控规则评估时间间隔(检查报警规则rule的间隔时间) # Alertmanager配置(prometheus的警报)
alerting: #服务器的警报配置
alertmanagers: #列出服务器使用的每个alertmanager
- static_configs:
- targets:
# - alertmanager:9093 # 规则设置(包含记录规则和警报规则)
rule_files:
# - "first_rules.yml"
# - "second_rules.yml" # Prometheus 监控数据抓取配置
scrape_configs:
- job_name: 'prometheus' # 定义job名称(分组)
static_configs: #静态配置
- targets: ['localhost:9090'] # exporters的主机和端口
labels: #标签配置
env: 'jd' #标签为键值对形式
2.3、启动
mkdir logs
nohup /application/prometheus/prometheus --config.file=/application/prometheus/prometheus.yml >/application/prometheus/logs/prometheus.log 2>&1 &
#nohup:启动后可关闭连接终端;&:后台运行

启动相关参数

--config.file= #指定配置文件

--storage.tsdb.path=/prometheus #指定tsdb路径/ssd

--storage.tsdb.retention.time=24h #指定数据存储时间

--web.enable-lifecycle #提供类似nginx的reload功能,调用指令curl -X POST http://localhost:9090/-/reload

--storage.tsdb.no-lockfile #如果用k8s的deployment管理要开启

--web.listen-address=0.0.0.0:9090 #监听端口

--web.read-timeout=5m #web读取超时时间

--web.max-connnections=10 #web最大连接数

--query.max-concurrency=20 #并发执行的最大查询数

--query.timeout=2m #查询超时时间

2.4、测试

访问http://localhost:9090/metrics查看抓取的指标数据,prometheus默认通过自身9090端口进行自我监控

prometheus监控实战--基础的更多相关文章

  1. Prometheus监控实战day1-监控简介

    福利 Prometheus监控实战PDF电子书下载 链接:https://pan.baidu.com/s/1QH4Kvha5g70OhYQdp4YsfQ 提取码:oou5 若你喜欢该资料,请购买该资料 ...

  2. Prometheus监控实战应用

    目录 1.Prometheus的主要特征及概述 2.普罗米修斯原理架构图 3.下载安装启动Prometheus 4.web客户端操作 5.默认图像 6.目录解释 7.配置文件 8.监控指标 8.1.监 ...

  3. Prometheus监控实战day2——监控主机和容器

    Prometheus使用exporter工具来暴露主机和应用程序上的指标,目前有很多exporter可供利用.对于收集各种主机指标数据(包括CPU.内存和磁盘),我们使用Node Exporter即可 ...

  4. prometheus监控实战

    第一节.环境和软件版本 1.1.操作系统环境 主机ip 操作系统 部署软件 备注 192.168.10.10 Centos7.9 Grafana.Pushgateway.Blackbox Export ...

  5. 监控实战Prometheus+Grafana

    这期的分享是监控实战,其实不想写这篇的,因为网上相关的文章也挺多的,但是出于光说不练都是假把式,而且也想告诉你:当帅气的普罗米修斯(Prometheus)遇到高颜值的格拉法纳(Grafana)究竟会擦 ...

  6. K8S(13)监控实战-部署prometheus

    k8s监控实战-部署prometheus 目录 k8s监控实战-部署prometheus 1 prometheus前言相关 1.1 Prometheus的特点 1.2 基本原理 1.2.1 原理说明 ...

  7. prometheus和granfana企业级监控实战v5

    文件地址:https://files.cnblogs.com/files/sanduzxcvbnm/prometheus和granfana企业级监控实战v5.pdf

  8. Docker 监控实战

    如今,越来越多的公司开始使用 Docker 了,现在来给大家看几组数据: 2 / 3 的公司在尝试了 Docker 后最终使用了它 也就是说 Docker 的转化率达到了 67%,而转化市场也控制在 ...

  9. K8S(14)监控实战-grafana出图_alert告警

    k8s监控实战-grafana出图_alert告警 目录 k8s监控实战-grafana出图_alert告警 1 使用炫酷的grafana出图 1.1 部署grafana 1.1.1 准备镜像 1.1 ...

随机推荐

  1. linux设置systemctl 启动脚本

    centos 7 服务的systemctl 脚本一般存在:/usr/lib/systemd目录.目录下又分为system,和user之分, /usr/lib/systemd/system #系统服务, ...

  2. 性能测试之JVM的故障排查-死锁

    死锁原因 Java发生死锁的根本原因是:在申请锁时发生了交叉闭环申请.即线程在获得了锁A并且没有释放的情况下去申请锁B,这时,另一个线程已经获得了锁B,在释放锁B之前又要先获得锁A,因此闭环发生,陷入 ...

  3. 两个有序数列找第k小

    给定一个数组,数组中的数据无序,在一个数组中找出其第k个最小的数,例如对于数组x,x = {3,2,1,4,5,6},则其第2个最小的数为2  两个有序数组 找第k小 * 方案一 合并遍历 * 二:游 ...

  4. deconv的弊端

    https://chuansongme.com/n/2630693453218 学习到deconvlution会带来棋盘鬼影,比较重要的解决方法就是resize-deconvlution

  5. 平时查询linux服务器与应用版本

    ###JDK版本###java -version ##Tomcat环境版本###进入到tomcat目录的bin下./version.sh ###服务器###(1)osuname -a 查看releas ...

  6. requestS模块发送请求的时候怎么传递参数

    首先要确定接口的传递参数是什么类型的,如果接口是查询,使用get请求方法,传递参数的时候使用params, 如果接口需要的json型参数的话,使用json,如果是上传文件的话,通过files参数在传递 ...

  7. import tensorflow 出现非法指令(核心已转储)

    使用 conda install -c conda-forge tensorflow 或者 conda install -c conda-forge tensorflow-gpu 试下.

  8. 适合 C++ 新手学习的开源项目——在 GitHub 学编程

    作者:HelloGitHub-小鱼干 俗话说:万事开头难,学习编程也是一样.在 HelloGitHub 的群里,经常遇到有小伙伴询问编程语言如何入门方面的问题,如: 我要学习某一门编程语言,有什么开源 ...

  9. Docker(7)- docker images 命令详解

    如果你还想从头学起 Docker,可以看看这个系列的文章哦! https://www.cnblogs.com/poloyy/category/1870863.html 作用 列出所有的本地镜像 语法格 ...

  10. 使用 Xunit.DependencyInjection 改造测试项目

    使用 Xunit.DependencyInjection 改造测试项目 Intro 这篇文章拖了很长时间没写,之前也有介绍过 Xunit.DependencyInjection 这个项目,这个项目是由 ...