Prometheus 安装部署

  • 安装版本:prometheus-2.6.1
  • 百度云下载:https://pan.baidu.com/s/1w16lQZKw8PCHqlRuSK2i7A
  • 提取码:lw1q

二进制安装部署

1、下载二进制包:prometheus-2.6.1.linux-amd64.tar.gz

2、解压包:tar xvzf prometheus-2.6.1.linux-amd64.tar.gz

3、移动到安装目录:mv prometheus-2.6.1.linux-amd64 /usr/local/prometheus

4、进入目录:cd /usr/local/prometheus

5、修改配置文件底部监控本机:vim prometheus.yml

scrape_configs:
- job_name: 'prometheus'
static_configs:
# 监控本地及端口
- targets: ['xiangsikai:9090']

注:Prometheus从目标机上通过http方式拉取采样点数据, 它也可以拉取自身服务数据并监控自身的健康状况。

注:当然Prometheus服务拉取自身服务采样数据,并没有多大的用处,但是它是一个好的DEMO。

global:
# 默认情况下,每15s拉取一次目标采样点数据。
scrape_interval: 15s
# 我们可以附加一些指定标签到采样点度量标签列表中, 用于和第三方系统进行通信, 包括:federation, remote storage, Alertmanager
external_labels:
# 下面就是拉取自身服务采样点数据配置
monitor: 'codelab-monitor'
scrape_configs:
# job名称会增加到拉取到的所有采样点上,同时还有一个instance目标服务的host:port标签也会增加到采样点上
- job_name: 'prometheus'
# 覆盖global的采样点,拉取时间间隔5s
scrape_interval: 5s
static_configs:
- targets: ['localhost:9090']

配置文件注解

6、启动服务

./prometheus --config.file=prometheus.yml
# 指定配置文件
--config.file="prometheus.yml"
# 指定监听地址端口
--web.listen-address="0.0.0.0:9090"
# 最大连接数
--web.max-connections=512
# tsdb数据存储的目录,默认当前data/
--storage.tsdb.path="data/"
# premetheus 存储数据的时间,默认保存15天
--storage.tsdb.retention=15d

启动选项了解:./prometheus --help

7、测试访问:http://localhost:9090

8、查看暴露指标:http://localhost.com:9090/metrics

9、将Prometheus配置为系统服务

1、进入systemd目录下:cd /usr/lib/systemd/system
2、创建文件:vim prometheus.service

  [Unit]
Description=https://prometheus.io [Service]
Restart=on-failure
ExecStart=/usr/local/prometheus/prometheus --config.file=/usr/local/prometheus/prometheus.yml [Install]
WantedBy=multi-user.target

4、生效系统system文件

systemctl daemon-reload

5、启动服务

systemctl stop prometheus.service
systemctl start prometheus.service

Docker 容器安装部署

  • 官方地址:https://prometheus.io/docs/prometheus/latest/installation/

一、prometheus.yml通过运行以下命令将您从主机绑定:

docker run -p 9090:9090 -v /tmp/prometheus.yml:/etc/prometheus/prometheus.yml \
prom/prometheus

二、或者为配置使用额外的卷:

docker run -p 9090:9090 -v /prometheus-data \
prom/prometheus --config.file=/prometheus-data/prometheus.yml

注:普罗米修斯的配置文件的需要指定对。

Prometheus 安装部署的更多相关文章

  1. Prometheus入门到放弃(1)之Prometheus安装部署

    规划: IP 角色 版本 10.10.0.13 prometheus-server 2.10 10.10.0.11 node_exporter 0.18.1 10.10.0.12 node_expor ...

  2. Prometheus安装部署说明

    本文主要介绍了如何二进制安装Prometheus.使用 Node Exporter 采集主机信息并使用Grafana来进行图形化的展示. 1. 安装Prometheus Server Promethe ...

  3. 2.Prometheus安装部署

    环境准备 2台Linux操作系统(基于centos7) docker环境 配置 IP 角色 版本 192.168.229.139 prometheus-server 2.10 192.168.229. ...

  4. 微服务监控神器Prometheus的安装部署

    本文涉及:如何在k8s下搭建Prometheus+grafana的监控环境 基本概念 Prometheus提供了容器和云原生领域数据搜集.存储.处理.可视化和告警一套完整的解决方案,最初时是由Soun ...

  5. Prometheus 和 Grafana 安装部署

    Prometheus 是一套开源的系统监控报警框架.Prometheus 作为生态圈 Cloud Native Computing Foundation(简称:CNCF)中的重要一员,其活跃度仅次于 ...

  6. prometheus学习系列三:node_exporter安装部署

    node_exporter简介 node_exporter安装部署 [root@node00 ~]# cd /usr/src/ [root@node00 src]# wget https://gith ...

  7. Prometheus + Grafana 部署说明之「安装」

    说明 在前面的Prometheus学习系列文章里,大致介绍说明了Prometheus和Grafana的一些使用,现在开始介绍如何从头开始部署Prometheus+Grafana,来监控各个相关的指标数 ...

  8. Kubernetes+Prometheus+Grafana部署笔记

    一.基础概念 1.1 基础概念 Kubernetes(通常写成“k8s”)Kubernetes是Google开源的容器集群管理系统.其设计目标是在主机集群之间提供一个能够自动化部署.可拓展.应用容器可 ...

  9. Prometheus 安装

    目录 简介 安装部署 环境准备 安装 配置环境变量 配置 启动 简介 prometheus存储的是时序数据,即按相同时序(相同名称和标签),以时间维度存储连续的数据的集合. 时序(time serie ...

随机推荐

  1. VMWare15.0手动为Mac OS10.14虚拟机安装VMWare Tools

    安装完客户机虚拟机后,无法在虚拟机和本机之间拖拽传输文件,开启虚拟机后,底部提示安装VMWare Tools,但是这里无法安装. 虽然可以联网后使用局域网工具(如FeiQ)来传输,但是老感觉不是太方便 ...

  2. 剑指:最小的k个数

    题目描述 输入 n 个整数,找出其中最小的 K 个数.例如输入 4,5,1,6,2,7,3,8 这 8 个数字,则最小的 4 个数字是 1,2,3,4. 解法 解法一 利用快排中的 partition ...

  3. 旅游景点信息API接口大全

    1.分享数据:“http://www.shareapi.cn/docs/api/id/127”,免费,次数1000次 返回JSON示例 { "SceneryID":10224,/* ...

  4. springboot 登录实现源代码解析

    springboot 可以使用springsecurity 作为安全框架,我们可以使用springsecurity 实现安全登录. springsecurity 是使用一系列的过滤器来实现安全的. 实 ...

  5. javascript之DOM(一节点类型Node)

    DOM(Document Object Model)是针对HTML和XML文档的一个API.DOM描述的是一个层次化的节点树,允许开发人员添加.移除和修改页面的某一部分.起源于DHML,现为W3C的推 ...

  6. ArmIE的安装

    参考:https://developer.arm.com/tools-and-software/server-and-hpc/arm-architecture-tools/arm-instructio ...

  7. xcode运行demo报错:Failed to create provisioning profile.cannot be registered to your development team

    问题:网上下载运行demo,出现Failed to create provisioning profile.cannot be registered to your development team此 ...

  8. 201671010447 杨露露 实验十四 团队项目评审&课程学习总结

    项目 内容 这个作业属于哪个课程 2016计算机科学与工程学院软件工程(西北师范大学) 这个作业的要求在哪里 实验十四 团队项目评审&课程学习总结 作业学习目标 总结这学期软件工程学习获得 一 ...

  9. Pycharm过期了怎么办?

    Pycharn过期了,打开Pycharm,选择help,倒数第三个register,用激活码进行激活,具体情况见激活码,侵删

  10. 洛谷P3369 【模板】普通平衡树(FHQ Treap)

    题面 传送门 题解 写了一下\(FHQ\ Treap\) //minamoto #include<bits/stdc++.h> #define R register #define inl ...