prometheus编译安装

2023-05-16

prometheus是搜集应用程序所使用的CPU 内存 以及磁盘使用大小的神器,
它可以根据用户所配置的性能阀值给出相应的处理,比如 邮件告警等,在这里就不啰嗦了,由于本人也是刚刚学习 所以能说的也就这么多.

一.代码编译:
1.克隆代码

git clone https://github.com/prometheus/prometheus.git 

2.代码编译,很简单,因为官方提供了Makefile ,直接在prometheus文件下执行

make build

执行之后的结果:

[root@reg prometheus]# ls -l
total 76700
-rw-r--r--  1 root root    52270 Dec 16 11:33 CHANGELOG.md
-rw-r--r--  1 root root     2415 Dec 16 11:33 circle.yml
drwxr-xr-x  4 root root     4096 Dec 16 11:33 cmd
-rw-r--r--  1 root root      155 Dec 16 11:33 code-of-conduct.md
drwxr-xr-x  3 root root     4096 Dec 16 11:33 config
drwxr-xr-x  2 root root     4096 Dec 16 11:33 console_libraries
drwxr-xr-x  2 root root     4096 Dec 16 11:33 consoles
-rw-r--r--  1 root root     3022 Dec 16 11:33 CONTRIBUTING.md
drwxr-xr-x  3 root root     4096 Jan  1 11:06 data
drwxr-xr-x 13 root root     4096 Dec 16 11:33 discovery
-rw-r--r--  1 root root     1056 Dec 16 11:33 Dockerfile
drwxr-xr-x  5 root root     4096 Dec 16 11:33 docs
drwxr-xr-x  5 root root     4096 Dec 16 11:33 documentation
-rw-r--r--  1 root root    11357 Dec 16 11:33 LICENSE
-rw-r--r--  1 root root      440 Dec 16 11:33 MAINTAINERS.md
-rw-r--r--  1 root root     3373 Dec 16 11:33 Makefile
-rw-r--r--  1 root root     2769 Dec 16 11:33 NOTICE
drwxr-xr-x  2 root root     4096 Dec 16 11:33 notifier
drwxr-xr-x  9 root root     4096 Dec 16 11:33 pkg
-rwxr-xr-x  1 root root 65406721 Dec 16 11:56 prometheus
-rw-r--r--  1 root root      216 Jan  1 11:05 prometheus.yml
drwxr-xr-x  2 root root     4096 Dec 16 11:33 prompb
drwxr-xr-x  4 root root     4096 Dec 16 11:33 promql
-rwxr-xr-x  1 root root 12932451 Dec 16 11:57 promtool
-rw-r--r--  1 root root     4482 Dec 16 11:33 README.md
drwxr-xr-x  2 root root     4096 Dec 16 11:33 relabel
drwxr-xr-x  3 root root     4096 Dec 16 11:33 retrieval
drwxr-xr-x  2 root root     4096 Dec 16 11:33 rules
drwxr-xr-x  2 root root     4096 Dec 16 11:33 scripts
drwxr-xr-x  4 root root     4096 Dec 16 11:33 storage
drwxr-xr-x  2 root root     4096 Dec 16 11:33 template
drwxr-xr-x  9 root root     4096 Dec 16 11:33 util
drwxr-xr-x  7 root root     4096 Dec 16 11:33 vendor
-rw-r--r--  1 root root        6 Dec 16 11:33 VERSION
drwxr-xr-x  4 root root     4096 Dec 16 11:33 web

就可以了,当然,golang的环境问题,是必须的,另外,编译之后您也可以进行镜像打包

make docker

就可以了
结果:

[root@reg prometheus]# docker images | grep prometheus
prometheus                                          master               d4bd4a6d5364        2 weeks ago         80.9 MB
quay.io/prometheus/busybox                          latest               747e1d7f6665        3 months ago        2.57 MB

quay.io/prometheus/busybox 这个镜像是基础镜像

二 安装
创建prometheus.yml文件
内容

[root@reg prometheus]# cat prometheus.yml 
global:
  scrape_interval:     15s
  evaluation_interval: 15s

rule_files:
  # - "first.rules"
  # - "second.rules"

scrape_configs:
  - job_name: 'prometheus'
    static_configs:
      - targets: ['10.39.0.102:9090']

这个是官方的简单的例子
执行:

[root@reg prometheus]# ./prometheus --config.file=prometheus.yml 
level=info ts=2018-01-01T03:06:43.633722756Z caller=main.go:220 msg="Starting Prometheus" version="(version=2.0.0, branch=master, revision=9083d41d3a788f750d520a3975dced39644471a9)"
level=info ts=2018-01-01T03:06:43.633823681Z caller=main.go:221 build_context="(go=go1.9.2, user=root@reg.ennew.com, date=20171216-03:56:18)"
level=info ts=2018-01-01T03:06:43.633847699Z caller=main.go:222 host_details="(Linux 3.10.0-693.5.2.el7.x86_64 #1 SMP Fri Oct 20 20:32:50 UTC 2017 x86_64 reg.ennew.com (none))"
level=info ts=2018-01-01T03:06:43.633865608Z caller=main.go:223 fd_limits="(soft=1024, hard=4096)"
level=info ts=2018-01-01T03:06:43.63726474Z caller=web.go:383 component=web msg="Start listening for connections" address=0.0.0.0:9090
level=info ts=2018-01-01T03:06:43.637175893Z caller=targetmanager.go:71 component="target manager" msg="Starting target manager..."
level=info ts=2018-01-01T03:06:43.637261778Z caller=main.go:400 msg="Starting TSDB ..."
level=info ts=2018-01-01T03:06:43.648872734Z caller=main.go:410 msg="TSDB started"
level=info ts=2018-01-01T03:06:43.648933774Z caller=main.go:492 msg="Loading configuration file" filename=prometheus.yml
level=info ts=2018-01-01T03:06:43.649697319Z caller=main.go:387 msg="Server is ready to receive requests."

在浏览器打开:http://10.39.0.102:9090/metrics
会看到

# HELP go_gc_duration_seconds A summary of the GC invocation durations.
# TYPE go_gc_duration_seconds summary
go_gc_duration_seconds{quantile="0"} 5.419e-05
go_gc_duration_seconds{quantile="0.25"} 7.8513e-05
go_gc_duration_seconds{quantile="0.5"} 0.000132775
go_gc_duration_seconds{quantile="0.75"} 0.000183778
go_gc_duration_seconds{quantile="1"} 0.004308542
go_gc_duration_seconds_sum 0.005393469
go_gc_duration_seconds_count 10
# HELP go_goroutines Number of goroutines that currently exist.
# TYPE go_goroutines gauge
go_goroutines 81
....

在浏览器打开:http://10.39.0.102:9090/
就会看到页面了

prometheus

现在您就可以使用操作界面了

关于如何使用 请参考官方文档

简单举个例子

在页面输入:

http_requests_total

结果

prometheus

还有编译prometheus 的node-exporter 也是这么比较容易的,在这里就费笔墨了

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

prometheus编译安装 的相关文章

  • 解决Docker运行命令时提示“Got permission denied while trying to connect to the Docker daemon socket“

    参考自 xff1a 公众号 xff1a 写bug的程旭源 问题截图 原因 xff1a docker守护进程启动的时候 xff0c 会默认赋予名字为docker的用户组读写Unix socket的权限 方法1 xff1a 使用sudo获取管理
  • CAN 读取ACK知对方是否接收成功

    首先 xff0c 了解一下CAN的ACK段 上图是一个数据帧 xff0c 其ACK段用来确认是否正常接收 由 ACK 槽 ACK Slot 和 ACK 界定符 2 个位构成 当发送单元发送到CRC段后 xff0c 会在ACK段发送2个隐性位
  • C++使用json在Linux中实现TCP通信

    最近在学习使用json格式在Linux中进行tcp通信 以下为学习笔记 我使用的第三方库为nlohomann json 仓库地址为 nlohmann json JSON for Modern C 43 43 github com nloho
  • C语言经典笔试题(一)

    1 请填写bool float 指针变量 与 零值 比较的if 语句 提示 xff1a 这里 零值 可以是0 0 0 FALSE 或者 空指针 例如int 变量n 与 零值 比较的if 语句为 xff1a if n 61 61 0 if n
  • PCB学习笔记

    1 笔记 1 PCB屏幕变暗 xff0c 鼠标左键点空白处加ALT 2 TM默认改变所有错误 xff0c 变红色正常 3 PCB线默认电源和地30mil或者尽量粗 xff0c 其他根据引脚粗细 4 修改PCB过孔尺寸 xff0c PV快捷键
  • Java中this的用法总结

    Java的this用法 1 普通的直接引用 这种就不用讲了 xff0c this相当于是指向当前对象本身 2 xff0c 当局部 xff08 或者形参 xff09 变量和成员变量重名的时候 xff0c 在方法中使用this表示成员变量以示区
  • keil软件中按F12 无法跳转到函数、变量定义处

    keil中按F12无法跳转到定义 原因分析 xff1a 我们都习惯性在最开始建立项目目录会以中文命名 xff0c 导致有时候某些软件就出现奇怪问题 xff0c keil版本都比较高了 xff0c 所以有时会出现之前旧版本没有的问题 xff0
  • VSCode修改主题颜色

    参考 xff1a https jingyan baidu com article ea24bc3983f2b59b63b33144 html 步骤1 xff1a 使用vscode打开一个工程 xff0c 点击左下角的设置按钮 步骤2 xff
  • Linux 中的驱动开发的初学者体会

    Linux 中的驱动开发的初学者体会 很多年前 xff0c 心里就存下这样一个愿望 就是把Linux 的驱动开发搞清楚 但是一开始上上这样的开发难度天大了 xff0c 对着一堆的寄存器发愁 于是就从简单的STM8 xff0c PIC16FX
  • 串口助手SerialAide

    串口助手SerialAide 1 基础界面 2 描述 1 自动搜索串口 xff1b 2 接收数据可以进行十六进制和ASCII切换 3 接收和发送数据可以设置不用颜色显示 xff0c 方便查看 xff1b 4 可以使用多命令表进行循环发送 x
  • jetson nano的处理器架构

    jetson nano 的架构是 arm64 注意与 amd64 区分 比如安装 vscode 时 下载一个 deb 里面的 xff21 rm64 即可
  • Docker 部署clickhouse-server及添加用户配置密码

    前言 由于现在居家办公测试环境连接公司的clickhouse需要vpn连接太麻烦且速度很慢 xff0c 于是乎在测试机自己搭建clickhouse xff0c 废话不多说直接开始教程 容器clickhouse server配置 拉取clic
  • 把寄存器做成一个结构体,赋值初始地址后寄存器赋值的操作

  • CMake中文手册_target_link_libraries(3.26)

    cmake commands 7 cmake 命令 7 概述 此命令具有以下各小节详细介绍的多个签名 所有这些签名都具有以下通用形式 xff1a target link libraries 命名的 必须是由 add executable 或
  • 【STM32】UART串口通信无法通信问题(SSCOM)

    需要在target里面勾选上MicroLIB才能显示 然后要完全编译 xff0c 编译全部的代码 找到正确的串口号 然后就可以正常在SSCOM xff08 或其它软件 xff09 中显示了 如果需要学习STM32 UART通信方法请移步这个
  • CMake中文手册_target_sources(3.26)

    target sources xff08 xff09 新版本 3 1 将源文件添加到目标 target sources xff08 span class token operator lt span target span class to
  • QML信号与信号槽实践指南:轻松掌握现代软件开发的关键技术

    这里写目录标题 xff08 一 xff09 QML简介1 1 QML概述1 2 QML的基本语法1 3 QML与C 43 43 的交互 xff08 二 xff09 QML信号基本概念2 1 QML中的信号2 2 QML信号的作用与优势 xf
  • QML/Qt Quick anchors.fill 的使用

    目录标题 引言QML 和 Qt Quick锚布局的概念anchors fill 属性 QML 锚布局基础锚点属性 xff08 左 右 顶 底 xff09 使用独立的锚点属性设置元素间的布局关系中心锚点 xff1a 水平和垂直 深入了解 an
  • 探索C/C++ 进制转换之美:从原理到应用

    一 简介 Introduction 进制前缀表示整数常量示例转换库接口参数及返回值示例二进制0b 或 0B0b1010std bitset lt gt std bitset lt 8 gt binary 42 std bitset lt 8
  • 计算机架构:漫游CPU的奥秘世界

    目录标题 一 计算机架构基础 xff08 Computer Architecture Fundamentals xff09 1 1 历史发展 xff08 History xff09 1 2 计算机系统的组成 xff08 Components

随机推荐