Prometheus(二)部署Prometheus和node_exporter

2023-05-16

软件包列表

Prometheus安装

解压部署

rm -rf ./prometheus-2.28.1.linux-amd64

tar -xvf prometheus-2.28.1.linux-amd64.tar.gz

rm /usr/local/prometheus* -rf

mv prometheus-2.28.1.linux-amd64 /usr/local/

ln -sv /usr/local/prometheus-2.28.1.linux-amd64/ /usr/local/Prometheus

安装服务

cat <<EOF >/usr/lib/systemd/system/prometheus.service

[Unit]

Description=Prometheus server daemon

After=network.target

[Service]

Type=simple

User=root

Group=root

ExecStart=/usr/local/prometheus/prometheus \

    --config.file=/usr/local/prometheus/prometheus.yml \

    --storage.tsdb.path="/usr/local/prometheus/data" \

    --storage.tsdb.retention=30d \

    --web.console.templates="/usr/local/prometheus/consoles" \

    --web.console.libraries="/usr/local/prometheus/console_libraries" \

    --web.external-url=http://192.168.23.101:9090  \

    --web.listen-address=0.0.0.0:9090

Restart=on-failure

EOF

配置说明

各项配置说明

--config.file=/usr/local/prometheus/prometheus.yml:指定Prometheus的配置文件

--storage.tsdb.path="/usr/local/prometheus/data": 监控数据存储路径

--storage.tsdb.retention=30d : 最长只保留30天

--web.console.templates="/usr/local/prometheus/consoles": 控制台模板路径位置

--web.console.libraries="/usr/local/prometheus/console_libraries" : 控制台库路径

--web.external-url =http://192.168.0.50:9090: Prometheus外部连接地址

--web.listen-address=0.0.0.0:9090 : 监听的地址和端口

检查配置文件是否有语法错误:

/usr/local/prometheus/promtool check config /usr/local/prometheus/prometheus.yml

启动服务

systemctl daemon-reload

systemctl enable prometheus.service

systemctl start prometheus.service

systemctl restart prometheus.service

systemctl status prometheus.service

node_exporter安装

解压部署

tar -xvf node_exporter-1.1.2.linux-amd64.tar.gz

rm -rf /usr/local/node_exporter*

mv node_exporter-1.1.2.linux-amd64/ /usr/local/

ln -sv /usr/local/node_exporter-1.1.2.linux-amd64 /usr/local/node_exporter

安装服务

cat <<EOF >/usr/lib/systemd/system/node_exporter.service

[Unit]

Description=node_exporter for linux server

Documentation=https://prometheus.io/

After=network-online.target

[Service]

Type=simple

User=root

Group=root

ExecStart=/usr/local/node_exporter/node_exporter

Restart=on-failure

[Install]

WantedBy=multi-user.target

EOF

启动服务

systemctl daemon-reload

systemctl enable node_exporter

systemctl start node_exporter

systemctl restart node_exporter

配置Prometheus.yaml

scrape_configs:

  - job_name: 'prometheus'

    static_configs:

    - targets: ['192.168.23.101:9090']

  - job_name: 'node_exporter'

    static_configs:

    - targets: ['192.168.23.102:9100','192.168.23.103:9100']

      labels:

        cluster: node

        role: node-host

        team: test

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

Prometheus(二)部署Prometheus和node_exporter 的相关文章

随机推荐

  • Windows 11 本地 php 开发环境搭建:PHP + Apache + MySQL +VSCode 安装和环境配置

    目录 前言1 PHP 的下载 安装和配置1 1 下载 php1 2 安装 php1 3 配置 php 系统变量1 4 配置 php ini 2 Apache 的下载 安装和配置2 1 下载 Apache2 2 安装 Apache2 3 修改
  • 【frp配置教程】frp内网穿透服务端frps.ini各配置参数详解

    必须 标识头 common 是不可或缺的部分 必须 服务器IP bind addr 61 0 0 0 0 0 0 0 0为服务器全局所有IP可用 xff0c 假如你的服务器有多个IP则可以这样做 xff0c 或者填写为指定其中的一个服务器I
  • 【Ubuntu】修改Ubuntu的apt-get源为国内镜像源的方法

    转载请注明出处 xff1a http www zgljl2012 com ubuntu xiu gai ubuntude apt getyuan wei a li yun yuan de fang fa 1 原文件备份 sudo cp et
  • 【工程源码】stmdb和ldmia汇编指令

    本文由FPGA爱好者小梅哥编写 xff0c 未经作者许可 xff0c 本文仅允许网络论坛复制转载 xff0c 且转载时请标明原作者 首先一句话说一下stmdb和ldmia指令的作用 xff1a stmdb和ldmia指令一般配对使用 xff
  • 使用51单片机驱动YM12232B型液晶显示屏

    这是一个使用51单片机驱动YM12232B 液晶显示器的例子 xff0c 本人水平有限 xff0c 仅供参考 本实例中将使用51单片机控制YM12232B LCD分别在主窗口和副窗口中显示 科 和 学 字 YM12232B 一共有18个引脚
  • A*,那个传说中的算法

    周日的下午 xff0c 微信 simplemain xff0c 老王又来找大伙儿聊技术了 今天想跟大家聊的 xff0c 是我们经常用到 xff0c 但是却让大家觉得十分神秘的那个算法 xff1a A 想必大家都玩儿过对战类的游戏 xff0c
  • putty无法连接linux虚拟机

    linux安装参考 https linux cn article 5893 1 html 我选择的是Ubuntu 先看window下能不能ping通linux linux ip 地址查看 参考链接 jingyan baidu com art
  • C语言之网络编程(服务器和客户端)

    Linux网络编程 1 套接字 xff1a 源IP地址和目的IP地址以及源端口号和目的端口号的组合称为套接字 其用于标识客户端请求的服务器和服务 常用的TCP IP协议的3种套接字类型如下所示 xff08 1 xff09 流套接字 xff0
  • 无监督学习论文阅读

    无监督学习论文阅读 刚开始接触这方面的内容 xff0c 仅供参考 Diversity Transfer Network for Few Shot Learning xff08 AAAI2020 xff09 1 这篇文章提出了一种新的深度聚类
  • 控制教程 —— 介绍篇:3.PID控制器设计

    承接上一篇 控制教程 介绍篇 xff1a 2 系统分析 介绍完系统建模和基本的系统分析后 xff0c 我们已经了解了被控对象的特性 xff0c 这时 xff0c 就需要用一个合理的控制器 xff0c 让这个被控对象在该控制器下按照指定的给定
  • FreeRTOS —— 4.队列管理

    4 1 本章介绍与适用范围 队列 提供了任务到任务 xff0c 任务到中断以及中断到任务的通信机制 范围 本章旨在使读者更好地理解 xff1a 如何创建队列 队列如何管理其包含的数据 如何将数据发送到队列 如何从队列接收数据 阻塞队列意味着
  • LSTM一般最多堆叠多少层

    一 LSTM一般最多堆叠多少层 在大规模翻译任务的经验中 简单的堆叠LSTM层最多可以工作4层 很少工作6层 超过8层就很差了 Redisual connection有助于梯度的反向传播 xff0c 能够帮助lstm堆叠更多层 xff0c
  • 华为机试在线训练-牛客网(23)判断两个IP是否属于同一子网

    题目描述 子网掩码是用来判断任意两台计算机的IP地址是否属于同一子网络的根据 子网掩码与IP地址结构相同 xff0c 是32位二进制数 xff0c 其中网络号部分全为 1 和主机号部分全为 0 利用子网掩码可以判断两台主机是否中同一子网中
  • APISIX Dashboard中文文档(二)

    2022年7月6日14 31 51 APISIX Dashboard中文文档 一 APISIX Dashboard中文文档 二 APISIX Dashboard中文文档 三 基本部署 在 Linux 上安装 Apache APISIX Da
  • FreeRTOS 任务调度原理(基于cortexM内核)

    目录 默认FreeRTOS调度策略 xff08 单核 xff09 FreeRTOS调度策略的实现 任务创建 任务调度的4种情景 xff1a 1 第一次启动任务调度器 2 任务主动触发调度 3 SystemTick时钟触发调度 4 因为中断而
  • Centos7命令行安装图形用户界面

    安装完成Centos7后 xff0c 重启后发现是命令行界面 xff0c 于是就想改成图形用户界面 安装了图形用户界面的话 xff1a 1 查看系统里是否已经安装了图形用户界面 使用ctrl 43 alt 43 fx xff0c x为123
  • STM32G070 DMA+SPI+LCD显示

    SPI HandleTypeDef hspi1 DMA HandleTypeDef hdma spi1 tx 描述 xff1a LCD的SPI引脚初始化 参数 xff1a 无 返回 xff1a 无 void LCD SPI Init voi
  • Linux 开启VNCSERVER

    尽管我们可以使用 SSH连接远程通过字符界面来操作Linux xff0c 但是对于更多熟悉图形人来说是很不方便的 xff0c 因此开启Linux的远程桌面还是很有必要的 目前有两种比较流行的方式 xff1a XDM X display ma
  • Ubuntu 代号引发的“崩溃”

    写这篇文章主要是因为在前几天 xff0c 因为向来不关心ubuntu代号的我而引发的一次 崩溃 xff08 人崩溃 xff09 xff0c 正如我们所知Ubuntu 每半年都会更新一个版本 xff0c 每两年都会发布一个TLS xff08
  • Prometheus(二)部署Prometheus和node_exporter

    软件包列表 Prometheus安装 解压部署 rm rf prometheus 2 28 1 linux amd64 tar xvf prometheus 2 28 1 linux amd64 tar gz rm usr local pr