基于Docker搭建node-exporter+Prometheus+Grafana服务器监控平台
prometheus
Prometheus是一个开源的监控和警报工具,用于监控Kubernetes应用程序和云基础设施的性能和可用性。 - 功能:监控;警报;性能管理;可用性管理;Kubernetes应用程序管理。 - 特点:高可用性;高性能;灵活的数据采集;与Kubernetes集成。
项目地址:https://gitcode.com/gh_mirrors/pr/prometheus

·
目录
一、前言
在前面 Linux服务器监控:Grafana+InfluxDB+Telegraf监控平台搭建这篇中讲到一种服务器监控的方式。下面给大家说一下另一种服务器监控的方式,使用
node-exporter+Prometheus+Grafana
搭建的服务器监控平台。
这里安装node-exporter和Prometheus都是通过Docker安装的,关于Docker的安装,可以参考我的这篇博客的前面一部分:Docker安装Jenkins,它不香吗?
二、node-exporter安装
-
下载镜像
docker pull prom/node-exporter
-
生成容器
docker run -d -p 9100:9100 prom/node-exporter
-
验证是否安装成功——访问URL
http://服务器IP:9100/metrics
三、Prometheus安装及配置
3.1 设置配置文件
-
创建配置文件
prometheus.yml
mkdir /home/prometheus cd /home/prometheus vim prometheus.yml
-
配置文件内容如下:其中
IP地址
填写要监控的服务器的IP地址
,也就是前面安装node-exporter的服务器
的IP地址global: scrape_interval:60s evaluation_interval: 60s scrape_configs: - job_name: prometheus static_configs: - targets: ['localhost:9090'] labels: instance: prometheus - job_name: linux static_configs: - targets: ['IP地址:9100'] labels: instance: localhost
3.2 Docker安装Prometheus
- 下载镜像
docker pull prom/prometheus
- 生成容器
docker run -d -p 9090:9090 -v /home/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus
- 验证是否安装成功
(1)访问URL:http://IP地址:9090/graph
(2)访问targets:http://IP地址:9090/targets
四、Grafana安装及配置
4.1 Grafana安装
关于Grafana安装请参考我前面的博客 Jmeter+Grafana+Influxdb可视化性能监控平台搭建:让压测实时的“酷炫”起来!的
三、Grafana安装及配置
。
4.2 Grafana配置Prometheus
- 添加数据源,并选择Prometheus
- 配置Prometheus相关数据
4.3 下载模板并创建仪表盘
-
下载ID为
11074
的模板文件,下载链接为:https://grafana.com/grafana/dashboards/11074
-
导入模板:点击+号->Import->upload .json file,选择下载好的模板文件。
-
最后效果




Prometheus是一个开源的监控和警报工具,用于监控Kubernetes应用程序和云基础设施的性能和可用性。 - 功能:监控;警报;性能管理;可用性管理;Kubernetes应用程序管理。 - 特点:高可用性;高性能;灵活的数据采集;与Kubernetes集成。
最近提交(Master分支:6 个月前 )
e04913ae
feat(tsdb/(head|agent)): reuse pools across segments to reduce garbage during WL replay 10 天前
77a56981
When calculating dependencies between rules, we sometimes run into `{__name__...}` matchers
These can be used the same way as the actual rule names
This will enable even more rules to run concurrently
The new logic is also not slower:
```
julienduchesne@triceratops prometheus % benchstat test-old.txt test.txt
goos: darwin
goarch: arm64
pkg: github.com/prometheus/prometheus/rules
cpu: Apple M3 Pro
│ test-old.txt │ test.txt │
│ sec/op │ sec/op vs base │
DependencyMap-11 1.206µ ± 7% 1.024µ ± 7% -15.10% (p=0.000 n=10)
│ test-old.txt │ test.txt │
│ B/op │ B/op vs base │
DependencyMap-11 1.720Ki ± 0% 1.438Ki ± 0% -16.35% (p=0.000 n=10)
│ test-old.txt │ test.txt │
│ allocs/op │ allocs/op vs base │
DependencyMap-11 39.00 ± 0% 34.00 ± 0% -12.82% (p=0.000 n=10)
```
Signed-off-by: Julien Duchesne <julien.duchesne@grafana.com> 10 天前
更多推荐
所有评论(0)