Prometheus&Grafana小实践

本文涉及的产品
可观测可视化 Grafana 版,10个用户账号 1个月
简介: Prometheus+Grafana小实践

看效果


123.png


话原理


如上是把我自己的Mac电脑通过promethues的node expoter先采集,然后promethues的server来获取,整体作为数据源。

然后安装grafana,选择数据源promethues,在dashboard中选择好模版,就好了


PS:这里说下上次遇到的问题,是找不到docker路径下的,然后promethues.yml文件配置的位置不对,正确的应该是如下,有个挂载的概念,我一直没找到这个路径(耗时绝对3h+),最后是通过mkdir的方式方式创建文件夹,然后自行创建prometheus.yml文件,最后运行就起来了


docker run --name myPrometheus \-d -p 9090:9090 \-v /Users/zgh/Docker/Prometheus/Config/prometheus.yml:/etc/prometheus/prometheus.yml \prom/prometheus


来实践


1、先配置好prometheus

2、下载运行Node Exporter

wget https://github.com/prometheus/node_exporter/releases/download/v1.0.1/node_exporter-1.0.1.darwin-amd64.tar.gz
# 解压tar xvfz node_exporter-1.0.1.darwin-amd64.tar.gz
# 启动 Node Exportercd node_exporter-1.0.1.darwin-amd64./node_exporter

3、配置Prometheus服务的配置文件收集Node Exporter的监控数据


# 收集主机的监控数据  

- job_name: 'MacBook Pro'

static_configs:

- targets: [172.30.137.238:9100']

Picture11.png


4、重启prometheus

docker restart myPrometheus

5、访问http://localhost:9090,输入up可以看到增加了数据(数据为1表示正常)

 

Picture12.png


PS:这里注意就是yml文件中配具体的IP,若为localhost,则显示是不正常的0


6、配置grafana

docker pull grafana/grafana# 启动容器docker run --name myGrafana \-d -p 3000:3000 \grafana/grafana

7、访问localhost:3000,用户名和密码都输入admin

Picture13.png

 

8、配置数据源头,选择promethues,注意配置url为ip(不要配置localhost)

Picture14.png



9、输入Dashboard的ID,可以去grafanalab查找,当前选择Node Exporter Full 1860

 

Picture15.png



10、查看dashboard


相关文章
|
4月前
|
Prometheus Cloud Native Java
微服务框架(二十三)Prometheus + Grafana 安装、配置及使用
此系列文章将会描述Java框架Spring Boot、服务治理框架Dubbo、应用容器引擎Docker,及使用Spring Boot集成Dubbo、Mybatis等开源框架,其中穿插着Spring Boot中日志切面等技术的实现,然后通过gitlab-CI以持续集成为Docker镜像。 本文为Prometheus + Grafana 安装、配置及使用 本系列文章中所使用的框架版本为Spring ...
|
18天前
|
Prometheus 监控 Cloud Native
Prometheus+Grafana+NodeExporter 打造一款出色的监控系统,帅呆了!
Prometheus+Grafana+NodeExporter 打造一款出色的监控系统,帅呆了!
58 2
|
3月前
|
存储 Prometheus Cloud Native
Grafana 系列 - 统一展示 -2-Prometheus 数据源
Grafana 系列 - 统一展示 -2-Prometheus 数据源
|
3月前
|
JSON Prometheus Cloud Native
Grafana 系列 - 统一展示 -3-Prometheus 仪表板
Grafana 系列 - 统一展示 -3-Prometheus 仪表板
|
3月前
|
Prometheus 运维 监控
Prometheus AlertManager 生产实践 - 直接根据 to_email label 发 alert 到对应邮箱
Prometheus AlertManager 生产实践 - 直接根据 to_email label 发 alert 到对应邮箱
|
3月前
|
Prometheus Kubernetes Cloud Native
「译文」使用 Prometheus 和 Grafana 实现 SLO
「译文」使用 Prometheus 和 Grafana 实现 SLO
|
4月前
|
Prometheus 监控 Cloud Native
微服务框架(二十二)Prometheus + Grafana 可视化监控
此系列文章将会描述Java框架Spring Boot、服务治理框架Dubbo、应用容器引擎Docker,及使用Spring Boot集成Dubbo、Mybatis等开源框架,其中穿插着Spring Boot中日志切面等技术的实现,然后通过gitlab-CI以持续集成为Docker镜像。 本文为Prometheus + Grafana 可视化监控的介绍,下篇为Prometheus + Grafana...
|
4月前
|
Prometheus 监控 Cloud Native
微服务框架(十九)Spring Boot 可视化监控 Prometheus + Grafana
  此系列文章将会描述Java框架Spring Boot、服务治理框架Dubbo、应用容器引擎Docker,及使用Spring Boot集成Dubbo、Mybatis等开源框架,其中穿插着Spring Boot中日志切面等技术的实现,然后通过gitlab-CI以持续集成为Docker镜像。   本文为Spring Boot 通过 micrometer 的监控门面,实现Prometheus + G...
|
4月前
|
编解码 Prometheus 运维
Prometheus 的监控方法论
【1月更文挑战第24天】
|
4月前
|
存储 Prometheus 监控
Prometheus vs. ELK Stack:容器监控与日志管理工具的较量
随着容器化技术的广泛应用,容器监控与日志管理成为了关键任务。本文将对两种常用工具进行比较与选择,分别是Prometheus和ELK Stack。Prometheus是一款开源的监控系统,专注于时序数据的收集和告警。而ELK Stack则是一套完整的日志管理解决方案,由Elasticsearch、Logstash和Kibana三个组件组成。通过比较它们的特点、优势和适用场景,读者可以更好地了解如何选择适合自己需求的工具。