prometheus监控实战--基础
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监控实战--基础的更多相关文章
- Prometheus监控实战day1-监控简介
福利 Prometheus监控实战PDF电子书下载 链接:https://pan.baidu.com/s/1QH4Kvha5g70OhYQdp4YsfQ 提取码:oou5 若你喜欢该资料,请购买该资料 ...
- Prometheus监控实战应用
目录 1.Prometheus的主要特征及概述 2.普罗米修斯原理架构图 3.下载安装启动Prometheus 4.web客户端操作 5.默认图像 6.目录解释 7.配置文件 8.监控指标 8.1.监 ...
- Prometheus监控实战day2——监控主机和容器
Prometheus使用exporter工具来暴露主机和应用程序上的指标,目前有很多exporter可供利用.对于收集各种主机指标数据(包括CPU.内存和磁盘),我们使用Node Exporter即可 ...
- prometheus监控实战
第一节.环境和软件版本 1.1.操作系统环境 主机ip 操作系统 部署软件 备注 192.168.10.10 Centos7.9 Grafana.Pushgateway.Blackbox Export ...
- 监控实战Prometheus+Grafana
这期的分享是监控实战,其实不想写这篇的,因为网上相关的文章也挺多的,但是出于光说不练都是假把式,而且也想告诉你:当帅气的普罗米修斯(Prometheus)遇到高颜值的格拉法纳(Grafana)究竟会擦 ...
- K8S(13)监控实战-部署prometheus
k8s监控实战-部署prometheus 目录 k8s监控实战-部署prometheus 1 prometheus前言相关 1.1 Prometheus的特点 1.2 基本原理 1.2.1 原理说明 ...
- prometheus和granfana企业级监控实战v5
文件地址:https://files.cnblogs.com/files/sanduzxcvbnm/prometheus和granfana企业级监控实战v5.pdf
- Docker 监控实战
如今,越来越多的公司开始使用 Docker 了,现在来给大家看几组数据: 2 / 3 的公司在尝试了 Docker 后最终使用了它 也就是说 Docker 的转化率达到了 67%,而转化市场也控制在 ...
- K8S(14)监控实战-grafana出图_alert告警
k8s监控实战-grafana出图_alert告警 目录 k8s监控实战-grafana出图_alert告警 1 使用炫酷的grafana出图 1.1 部署grafana 1.1.1 准备镜像 1.1 ...
随机推荐
- 解析SparkStreaming和Kafka集成的两种方式
spark streaming是基于微批处理的流式计算引擎,通常是利用spark core或者spark core与spark sql一起来处理数据.在企业实时处理架构中,通常将spark strea ...
- cp: cannot stat: filepath Permission denied
在执行 cp -r frompath topath时,报错cp: cannot stat: frompath Permission denied. 百度,google都没有找到解决方案,无意中发现,原 ...
- EXPECT交互式批量上传公钥
EXPECT交互式批量上传公钥 # vim key.sh #/bin/bash Public_Key() { [ ! -f /usr/bin/expect ] && yum insta ...
- ZooKeeper CentOS7上安装
下载http://www.apache.org/dyn/closer.cgi/zookeeper(我下的是zookeeper-3.4.14) 1.创建 /usr/local/services/zook ...
- Java中的微信支付(2):API V3 微信平台证书的获取与刷新
1. 前言 在Java中的微信支付(1):API V3版本签名详解一文中胖哥讲解了微信支付V3版本API的签名,当我方(你自己的服务器)请求微信支付服务器时需要根据我方的API证书对参数进行加签,微信 ...
- 新版本 swagger 组件中 Servers 的 坑
新版本 Swashbuckle swagger 组件中 Servers 的 坑 Intro 上周做了公司的项目升级,从 2.2 更新到 3.1, swagger 直接更新到了最新,swagger 用的 ...
- STM32入门系列-使用库函数点亮LED,LED初始化函数
要点亮LED,需要完成LED的驱动, 在工程模板上新建一个led.c和led.h文件,将其存放在led文件夹内.这两个文件需要我们自己编写. 通常xxx.c文件用于存放编写的驱动程序,xxx.h文件用 ...
- DOM属性/节点属性
DOM属性:DOM(Document Object Model,文档对象模型)一种独立于语言,用于操作xml,html的应用编程接口1:获取节点: document.getElementById(id ...
- 云计算之路-出海记:蹭一张 aws 船票
出海记开篇之后,在 aws 上搭建博客园海外站的出海计划今天开始迈出第一步 -- 注册一个 aws 海外区域账号. aws 现在针对新注册用户提供12个月免费套餐(正在园子里推广并提供了专属注册通道) ...
- linux系统软件安装及软件包管理
软件包管理 1 RPM软件包管理 1.1 RPM软件包简介: RPM(Red Hat Package Manager,Red Hat软件包管理器)是一种开放的软件包管理系统,按照GPL条款发行,可 ...