Prometheus 监控linux服务器
Prometheus 监控linux服务器
node_exporter:用于*NIX系统监控,使用Go语言编写的收集器。
- 使用版本
- node_exporter 0.17.0
- 相关文档
- 使用文档:https://prometheus.io/docs/guides/node-exporter/
- GitHub:https://github.com/prometheus/node_exporter
- exporter列表:https://prometheus.io/docs/instrumenting/exporters/
- 百度云下载:node_exporter 0.17.0
- 地址:https://pan.baidu.com/s/1kXKs6oiGFwubsJ-cGvWykg
- 密码:vrpk
安装监控客户端
1、下载到被监控的linux系统
下载地址:https://github.com/prometheus/node_exporter/releases/download/v0.18.1/node_exporter-0.18.1.linux-amd64.tar.gz
2、解压压缩包
[root@server02 ~]# tar xvfz node_exporter-0.17.0.linux-amd64.tar.gz
3、移动并进入目录
[root@server02 ~]# mv node_exporter-0.17.0.linux-amd64 /usr/local/node_exporter
4、启动node_exporter服务,默认9100端口
[root@server02 ~]# cd /usr/local/node_exporter
[root@server02 node_exporter]# ./node_exporter
常用参数: # 收集文件系统,忽略哪些不搜集 --collector.filesystem.ignored-mount-points="^/(dev|proc|sys|var/lib/docker/.+)($|/)" # 管理的系统服务 --collector.systemd.unit-whitelist=".+" # 指定监听端口 默认9100 --web.listen-address=":9100" 常用启动参数
5、添加系统服务:vi /usr/lib/systemd/system/node_exporter.service
[Unit] Description=https://prometheus.io [Service] Restart=on-failure ExecStart=/usr/local/node_exporter/node_exporter --conllector.systemd --conllector.systemd.unit-whitelist=(docker|kubelet|kube-proxy|flanneld).service [Install] WantedBy=multi-user.target
6、启动添加后的系统服务
systemctl daemon-reload
systemctl restart node_exporter
7、查看导出器导出的数据信息:http://192.168.1.221:9100/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"} 0 go_gc_duration_seconds{quantile="0.25"} 0 go_gc_duration_seconds{quantile="0.5"} 0 go_gc_duration_seconds{quantile="0.75"} 0 go_gc_duration_seconds{quantile="1"} 0 go_gc_duration_seconds_sum 0 go_gc_duration_seconds_count 0 # HELP go_goroutines Number of goroutines that currently exist. # TYPE go_goroutines gauge go_goroutines 7 # HELP go_info Information about the Go environment. # TYPE go_info gauge go_info{version="go1.11.2"} 1 # HELP go_memstats_alloc_bytes Number of bytes allocated and still in use. # TYPE go_memstats_alloc_bytes gauge go_memstats_alloc_bytes 1.075736e+06 # HELP go_memstats_alloc_bytes_total Total number of bytes allocated, even if freed. # TYPE go_memstats_alloc_bytes_total counter go_memstats_alloc_bytes_total 1.075736e+06 # HELP go_memstats_buck_hash_sys_bytes Number of bytes used by the profiling bucket hash table.
使用prometheus监控客户端实例
1、添加新的job服务发现获取新的node:vim 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: ['server04:9090'] - job_name: 'server02' file_sd_configs: - files: ['/usr/local/prometheus/sd_config/node01.yml'] refresh_interval: 5s - job_name: 'server03' file_sd_configs: - files: ['/usr/local/prometheus/sd_config/node02.yml'] refresh_interval: 5s
2、新建配置文件并添加node:vim /usr/local/prometheus/sd_config/node.yml
[root@server04 sd_config]# ll 总用量 8 -rw-r--r-- 1 root root 34 6月 8 22:09 node01.yml -rw-r--r-- 1 root root 34 6月 8 22:12 node02.yml [root@server04 sd_config]# cat node01.yml node02.yml - targets: - 192.168.1.221:9100 - targets: - 192.168.1.222:9100
5、通过promSQL进行简单查询
分类:
prometheus
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
2020-06-08 ARP报文详解