3. Node_export安装部署
首先我们要知道什么是Node_export?因为Prometheus本身不具备监控功能,我们要通过Prometheus收集数据,需要安装对应的export。如Node_export用于监控服务器状态,如cpu、内存、网络、磁盘等信息。
注意事项: node_exporter服务需要在两台机器都安装,这里我们以客户端(192.168.229.138)为例
客户端
1.创建运行用户
[root@localhost opt]# groupadd -r prometheus
[root@localhost opt]# useradd -r -g prometheus -d / -s /sbin/nologin -c "prometheus user" prometheus
2.下载安装
[root@localhost opt]# wget https://github.com/prometheus/node_exporter/releases/download/v0.18.1/node_exporter-0.18.1.linux-amd64.tar.gz
[root@localhost opt]# tar -xf node_exporter-0.18.1.linux-amd64.tar.gz
[root@localhost opt]# cp node_exporter-0.18.1.linux-amd64/node_exporter /usr/local/bin/
3.配置启动脚本
[root@localhost opt]# vim /usr/lib/systemd/system/node_exporter.service
[Unit]
Description=node_export
Documentation=https://github.com/prometheus/node_exporter
After=network.target
[Service]
Type=simple
User=prometheus
ExecStart=/usr/local/bin/node_exporter
Restart=on-failure
[Install]
WantedBy=multi-user.target
4.启动
[root@localhost opt]# systemctl daemon-reload
[root@localhost opt]# systemctl enable node_exporter
Created symlink from /etc/systemd/system/multi-user.target.wants/node_exporter.service to /usr/lib/systemd/system/node_exporter.service.
[root@localhost opt]# systemctl start node_exporter
5.监听9100端口
[root@localhost opt]# netstat -anlptu|grep 9100
tcp 0 0 192.168.229.139:56874 192.168.229.138:9100 ESTABLISHED 8528/prometheus
tcp 0 0 192.168.229.139:40074 192.168.229.139:9100 ESTABLISHED 8528/prometheus
tcp6 0 0 :::9100 :::* LISTEN 6064/node_exporter
tcp6 0 0 192.168.229.139:9100 192.168.229.139:40074 ESTABLISHED 6064/node_exporter
服务端
1.安装node_exporter,参考客户端安装
2. 修改prometheus.yml
[root@localhost opt]# vim /etc/prometheus/prometheus.yml
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']
- job_name: 'node' ### 新增加job
static_configs:
- targets: ['192.168.229.139:9100','192.168.229.138:9100'] ### 主机列表
3.访问Prometheus Status > targets
4.收集系统CPU监控信息
4.1 CPU使用率
公式:100 - (avg by (instance) (irate(node_cpu_seconds_total{mode="idle"}[5m])) * 100)
4.2 CPU负载
公式:
1分钟负载:node_load1
5分钟负载:node_load5
15分钟负载:node_load15
5.收集系统内存监控信息
5.1 内存使用率
公式:(1 - (node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes ))* 100
5.2 可用内存(单位:M)
公式:node_memory_MemAvailable_bytes / 1024 / 1024
6.收集系统磁盘监控信息
6.1 磁盘总大小(单位: G)
公式:node_filesystem_size_bytes {fstype=~"ext4|xfs"} / 1024 / 1024 / 1024
6.2 磁盘剩余大小(单位: G)
公式:node_filesystem_avail_bytes {fstype=~"ext4|xfs"} / 1024 / 1024 / 1024
6.3 磁盘使用率
公式:(1-(node_filesystem_free_bytes{fstype=~"ext4|xfs"} / node_filesystem_size_bytes{fstype=~"ext4|xfs"})) * 100
7.收集系统网络监控信息(ip add 查看网卡信息)
7.1 网卡入网流量 (指定某一个网卡)
公式:irate(node_network_receive_bytes_total{device='ens33'}[5m])
7.2 网卡出网流量(指定某一个网卡)
公式:irate(node_network_transmit_bytes_total{device='ens33'}[5m])
说明:以上收集系统各信息,都是通过node_exporter服务进行数据的收集,然后通过prometheus内置的PromQL语句进行组合查询,对于每一个公式,都可以在prometheus WEB界面测试查询。关于具体的PromQL语句以及公式中函数的使用参考:PromQL语句
欢迎关注微信公众号:软件测试汪。软件测试交流群:809111560
转载请注意出处,谢谢合作
3. Node_export安装部署的更多相关文章
- Prometheus入门到放弃(2)之Node_export安装部署
1.下载安装 node_exporter服务需要在三台机器都安装,这里我们以一台机器为例: 地址:https://prometheus.io/download/ ### 另外两个节点部署时,需要先创建 ...
- node_export 安装
目录 安装部署 环境准备 下载安装 启动测试 安装部署 环境准备 主机名 角色 IP 系统版本 内核版本 es01.k8s.com node01 10.0.20.11 CentOS 7.5 5.1.4 ...
- Oracle安装部署,版本升级,应用补丁快速参考
一.Oracle安装部署 1.1 单机环境 1.2 Oracle RAC环境 1.3 Oracle DataGuard环境 1.4 主机双机 1.5 客户端部署 二.Oracle版本升级 2.1 单机 ...
- KVM安装部署
KVM安装部署 公司开始部署KVM,KVM的全称是kernel base virtual machine,对KVM虚拟化技术研究了一段时间, KVM是基于硬件的完全虚拟化,跟vmware.xen.hy ...
- Linux平台oracle 11g单实例 + ASM存储 安装部署 快速参考
操作环境:Citrix虚拟化环境中申请一个Linux6.4主机(模板)目标:创建单机11g + ASM存储 数据库 1. 主机准备 2. 创建ORACLE 用户和组成员 3. 创建以下目录并赋予对应权 ...
- 分布式文件系统 - FastDFS 在 CentOS 下配置安装部署
少啰嗦,直接装 看过上一篇分布式文件系统 - FastDFS 简单了解一下的朋友应该知道,本次安装是使用目前余庆老师开源的最新 V5.05 版本,是余庆老师放在 Github 上的,和目前你能在网络上 ...
- C# winform安装部署(转载)
c# winform 程序打包部署 核心总结: 1.建议在完成的要打包的项目外,另建解决方案建立安装部署项目(而不是在同一个解决方案内新建),在解决方案上右击-〉添加-〉现有项目-〉选择你要打包的项目 ...
- Ubuntu14.04 Django Mysql安装部署全过程
Ubuntu14.04 Django Mysql安装部署全过程 一.简要步骤.(阿里云Ubuntu14.04) Python安装 Django Mysql的安装与配置 记录一下我的部署过程,也方便 ...
- 比Ansible更吊的自动化运维工具,自动化统一安装部署_自动化部署udeploy 1.0
新增功能: 2015-03-11 除pass(备份与更新)与start(启动服务)外,实现一切自动化. 注:pass与start设为业务类,由于各类业务不同,所以无法实现自动化.同类业务除外,如更新的 ...
随机推荐
- 测开之路四十九:用Django实现扑克牌游戏
用Django实现和之前flask一样的扑克牌游戏 项目结构 html <!DOCTYPE html><html lang="en"><head> ...
- 项目搭建(三):自定义DLL
说明:程序中有些自定义的控件类型在TestStack.White框架中没有涉及,需要引入自定义的DLL,通过鼠标点击事件处理 使用:将自定义的ClassLibrary2.dll拷贝到项目/bin/de ...
- 【转】如何成功安装旧版本火狐,成功安装firebug和firepath插件
原文地址:https://www.cnblogs.com/meimei00/p/10566793.html
- Flink容错机制(checkpoint)
checkpoint是Flink容错的核心机制.它可以定期地将各个Operator处理的数据进行快照存储( Snapshot ).如果Flink程序出现宕机,可以重新从这些快照中恢复数据. 1. ch ...
- 服务端:WCF服务层安全检查核心类
using System.Data; using CSFrameworkV4_5.Common; using CSFrameworkV4_5.Core.SystemSecurity; using CS ...
- automate sap遇上的一些问题
1. get column name of SAPGuiTable columnCount = SAPGuiSession("Session").SAPGuiWindow(&quo ...
- Cocos2d 之FlyBird开发---GameUnit类
| 版权声明:本文为博主原创文章,未经博主允许不得转载. 这节来实现GameUnit类中的一些函数方法,其实这个类一般是一个边写边完善的过程,因为一般很难一次性想全所有的能够供多个类共用的方法.下 ...
- casperjs-options
The Casper class The easiest way to get a casper instance is to use the module's create() method: 最简 ...
- win10下安装Ubuntu后,启动时没有win10选项解决方法
通过在ubuntu里修改启动引导,解决. 1.进入Ubuntu系统,Ctrl+alt+t进入终端,输入以下命令即可 sudo gedit /etc/default/grub 2.在打开的gedit编辑 ...
- 【Java程序】约瑟夫环
今天看视频教程无意间看到了一个数3减1的问题,百度之发现叫约瑟夫环问题,于是写了程序,问题大致描述如下: 一群带有编号的孩子手拉手围成一个圈报数,开始的孩子数1,他右边数2,再右边数3,数到n的孩子o ...