prometheus 安装 node_exporter

2024-05-26 03:32

本文主要是介绍prometheus 安装 node_exporter,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

prometheus 安装

  • 1,Ubuntu 16.04安装prometheus
  • 2,测试启动
    • 2.1,运行前检查配置文件
    • 2.2,修改`prometheus.yml`获取监控数据
    • 2.3,prometheus开机启动
  • 3,node_exporter安装
    • 3.1,node_exporter开机启动
    • 3.1,监控多个主机
  • 4,prometheus查看targets
  • 5,数据可视化显示
    • 5.1,Grafana导入面板

1,Ubuntu 16.04安装prometheus

  • prometheus-2.18.1.darwin-amd64.tar.gz
# tar -zxvf prometheus-2.18.1.linux-amd64.tar.gz
  • 设置环境变量
  • vim /root/.bashrc
#prometheus
export PATH=$PATH:/root/prometheus-2.18.1.linux-amd64

2,测试启动

prometheus --config.file=/root/prometheus-2.18.1.linux-amd64/prometheus.yml
  • 0.0.0.0:9090

在这里插入图片描述

2.1,运行前检查配置文件

# ./promtool check config prometheus.yml
Checking prometheus.ymlSUCCESS: 0 rule files found

2.2,修改prometheus.yml获取监控数据

  • vim prometheus.yml增加job_name
scrape_configs:# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.- job_name: 'prometheus'# metrics_path defaults to '/metrics'# scheme defaults to 'http'.static_configs:- targets: ['localhost:9090']# node_exporter- job_name: 'node'static_configs:- targets: ['127.0.0.1:9100']

2.3,prometheus开机启动

# vim /lib/systemd/system/prometheus.service
# cat /lib/systemd/system/prometheus.service
[Unit]
Description=prometheus service[Service]
User=root
ExecStart=/root/prometheus-2.18.1.linux-amd64/prometheus --config.file=/root/prometheus-2.18.1.linux-amd64/prometheus.ymlTimeoutStopSec=10
Restart=on-failure
RestartSec=5[Install]
WantedBy=multi-user.target
# systemctl daemon-reload
# systemctl enable prometheus.service
Created symlink /etc/systemd/system/multi-user.target.wants/prometheus.service → /lib/systemd/system/prometheus.service.
# systemctl start prometheus.service
# systemctl status prometheus.service

3,node_exporter安装

  • node_exporter-1.0.0.linux-amd64.tar.gz
# tar -zxvf node_exporter-1.0.0.linux-amd64.tar.gz
# cd node_exporter-1.0.0.linux-amd64/
# ./node_exporter
  • 访问ip:9100
    在这里插入图片描述
  • 增加配置prometheus
  • vim prometheus.yml
  - job_name: 'node'static_configs:#- targets: ['localhost:9090']- targets: ['127.0.0.1:9100']

3.1,node_exporter开机启动

# cat /lib/systemd/system/node_exporter.service
[Unit]
Description=node_exporter service[Service]
User=root
ExecStart=/root/node_exporter-1.0.0.linux-amd64/node_exporterTimeoutStopSec=10
Restart=on-failure
RestartSec=5[Install]
WantedBy=multi-user.target
# systemctl daemon-reload
# systemctl enable node_exporter.service
# systemctl start node_exporter.service
# systemctl status node_exporter.service

3.1,监控多个主机

  • 192.168.0.3 只运行node_exporter
  • 192.168.0.2 运行有prometheus
  • 配置prometheus.yml
  • targets配置多个IP地址
# cat prometheus.ymlstatic_configs:- targets: ['localhost:9090']# node_exporter- job_name: 'node'static_configs:- targets: ['127.0.0.1:9100','192.168.0.3:9100']

4,prometheus查看targets

在这里插入图片描述

5,数据可视化显示

5.1,Grafana导入面板

在这里插入图片描述

  • id为8919
  • 数据源选择prometheus
    在这里插入图片描述

在这里插入图片描述


参考:

  1. prometheus download
  2. prometheus started
  3. Prometheus ubuntu安装使用
  4. prometheus+grafana 安装配置
  5. node_exporter
  6. Prometheus 实战
  7. Prometheus监控系统 安装与配置详细教程
  8. prometheus-book 使用Node Exporter采集主机数据
  9. Prometheus 配置
  10. Prometheus部署各服务的Node监控
  11. 使用 Grafana + Prometheus + Node-Exporter 监控机器
  12. 1 Node Exporter for Prometheus Dashboard CN v20200530

这篇关于prometheus 安装 node_exporter的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1003410

相关文章

如何在Mac上安装并配置JDK环境变量详细步骤

《如何在Mac上安装并配置JDK环境变量详细步骤》:本文主要介绍如何在Mac上安装并配置JDK环境变量详细步骤,包括下载JDK、安装JDK、配置环境变量、验证JDK配置以及可选地设置PowerSh... 目录步骤 1:下载JDK步骤 2:安装JDK步骤 3:配置环境变量1. 编辑~/.zshrc(对于zsh

Node.js 数据库 CRUD 项目示例详解(完美解决方案)

《Node.js数据库CRUD项目示例详解(完美解决方案)》:本文主要介绍Node.js数据库CRUD项目示例详解(完美解决方案),本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考... 目录项目结构1. 初始化项目2. 配置数据库连接 (config/db.js)3. 创建模型 (models/

如何在pycharm安装torch包

《如何在pycharm安装torch包》:本文主要介绍如何在pycharm安装torch包方式,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录在pycharm安装torch包适http://www.chinasem.cn配于我电脑的指令为适用的torch包为总结在p

在PyCharm中安装PyTorch、torchvision和OpenCV详解

《在PyCharm中安装PyTorch、torchvision和OpenCV详解》:本文主要介绍在PyCharm中安装PyTorch、torchvision和OpenCV方式,具有很好的参考价值,... 目录PyCharm安装PyTorch、torchvision和OpenCV安装python安装PyTor

Python Transformer 库安装配置及使用方法

《PythonTransformer库安装配置及使用方法》HuggingFaceTransformers是自然语言处理(NLP)领域最流行的开源库之一,支持基于Transformer架构的预训练模... 目录python 中的 Transformer 库及使用方法一、库的概述二、安装与配置三、基础使用:Pi

使用Node.js制作图片上传服务的详细教程

《使用Node.js制作图片上传服务的详细教程》在现代Web应用开发中,图片上传是一项常见且重要的功能,借助Node.js强大的生态系统,我们可以轻松搭建高效的图片上传服务,本文将深入探讨如何使用No... 目录准备工作搭建 Express 服务器配置 multer 进行图片上传处理图片上传请求完整代码示例

如何解决mmcv无法安装或安装之后报错问题

《如何解决mmcv无法安装或安装之后报错问题》:本文主要介绍如何解决mmcv无法安装或安装之后报错问题,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录mmcv无法安装或安装之后报错问题1.当我们运行YOwww.chinasem.cnLO时遇到2.找到下图所示这里3.

Python 安装和配置flask, flask_cors的图文教程

《Python安装和配置flask,flask_cors的图文教程》:本文主要介绍Python安装和配置flask,flask_cors的图文教程,本文通过图文并茂的形式给大家介绍的非常详细,... 目录一.python安装:二,配置环境变量,三:检查Python安装和环境变量,四:安装flask和flas

Win11安装PostgreSQL数据库的两种方式详细步骤

《Win11安装PostgreSQL数据库的两种方式详细步骤》PostgreSQL是备受业界青睐的关系型数据库,尤其是在地理空间和移动领域,:本文主要介绍Win11安装PostgreSQL数据库的... 目录一、exe文件安装 (推荐)下载安装包1. 选择操作系统2. 跳转到EDB(PostgreSQL 的

Linux系统中卸载与安装JDK的详细教程

《Linux系统中卸载与安装JDK的详细教程》本文详细介绍了如何在Linux系统中通过Xshell和Xftp工具连接与传输文件,然后进行JDK的安装与卸载,安装步骤包括连接Linux、传输JDK安装包... 目录1、卸载1.1 linux删除自带的JDK1.2 Linux上卸载自己安装的JDK2、安装2.1