您当前的位置:首页 > 电脑百科 > 网络技术 > 网络软件

监控软件:Prometheus

时间:2022-04-14 16:54:38  来源:  作者:拔土豆的程序员

Prometheus

Prometheus是一个开源监控解决方案,用于收集和聚合指标作为时间序列数据。更简单地说,Prometheus 商店中的每个项目都是一个指标事件,并带有它发生的时间戳。

mac 搭建Prometheus

地址:https://prometheus.io/

Mac 安装

brew install prometheus

默认安装路径:

/usr/local/Cellar/prometheus

默认配置文件:

/usr/local/etc/prometheus.yml

启动

prometheus --config.file=/usr/local/etc/prometheus.yml

访问:http://localhost:9090

Spring boot 结合

springboot的web项目,pom依赖:

    <dependencies>
        <!--  web 依赖  -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>

        <dependency>
            <groupId>io.micrometer</groupId>
            <artifactId>micrometer-registry-prometheus</artifactId>
        </dependency>
    </dependencies>

Yml配置文件:

server:
  port: 8080
# 暴露监控端点
management:
  endpoints:
    web:
      exposure:
        include: '*'

监控端点:
http://127.0.0.1:8080/actuator/prometheus

# HELP executor_queued_tasks The Approximate number of tasks that are queued for execution
# TYPE executor_queued_tasks gauge
executor_queued_tasks{name="applicationTaskExecutor",} 0.0
# HELP executor_pool_max_threads The maximum allowed number of threads in the pool
# TYPE executor_pool_max_threads gauge
executor_pool_max_threads{name="applicationTaskExecutor",} 2.147483647E9
# HELP jvm_gc_pause_seconds Time spent in GC pause
# TYPE jvm_gc_pause_seconds summary
jvm_gc_pause_seconds_count{action="end of major GC",cause="Metadata GC Threshold",} 1.0
jvm_gc_pause_seconds_sum{action="end of major GC",cause="Metadata GC Threshold",} 0.072
jvm_gc_pause_seconds_count{action="end of minor GC",cause="Metadata GC Threshold",} 1.0
jvm_gc_pause_seconds_sum{action="end of minor GC",cause="Metadata GC Threshold",} 0.014
# HELP jvm_gc_pause_seconds_max Time spent in GC pause
# TYPE jvm_gc_pause_seconds_max gauge
jvm_gc_pause_seconds_max{action="end of major GC",cause="Metadata GC Threshold",} 0.0
jvm_gc_pause_seconds_max{action="end of minor GC",cause="Metadata GC Threshold",} 0.0
# HELP jvm_classes_loaded_classes The number of classes that are currently loaded in the JAVA virtual machine
# TYPE jvm_classes_loaded_classes gauge
jvm_classes_loaded_classes 7566.0
# HELP jvm_gc_memory_promoted_bytes_total Count of positive increases in the size of the old generation memory pool before GC to after GC
# TYPE jvm_gc_memory_promoted_bytes_total counter
jvm_gc_memory_promoted_bytes_total 3235200.0
# HELP Tomcat_sessions_active_current_sessions  
# TYPE tomcat_sessions_active_current_sessions gauge
tomcat_sessions_active_current_sessions 0.0
# HELP executor_pool_size_threads The current number of threads in the pool

 

监控软件:Prometheus

 

配置 prometheus.yml

global:
  scrape_interval: 15s
scrape_configs:
  - job_name: "prometheus"
    static_configs:
    - targets: ["localhost:9090"]
  # 创建job 
  - job_name: "tomato-study-prometheus"
    scrape_interval: 5s
    metrics_path: '/actuator/prometheus'
    static_configs:
    - targets: ["localhost:8080"]

重启 prometheus:
http://localhost:9090/targets

监控软件:Prometheus

 

安装 grafana

展示各种漂亮的图表。

Mac 安装

brew install grafana

默认安装路径:

/usr/local/Cellar/grafana/

启动:

grafana-server --config=/usr/local/etc/grafana/grafana.ini --homepath /usr/local/share/grafana --packaging=brew cfg:default.paths.logs=/usr/local/var/log/grafana cfg:default.paths.data=/usr/local/var/lib/grafana cfg:default.paths.plugins=/usr/local/var/lib/grafana/plugins

注:如需修改默认端口,可修改
/usr/local/etc/grafana/grafana.ini

访问:http://localhost:3000/ admin/admin

使用前必须更改密码 admin/123qwe

配置 grafana

grafana只是一个图表展示工具,必须添加数据源,才能读取到数据。

 

监控软件:Prometheus

 


监控软件:Prometheus

 

配置 Grafana DashBoard文件

推荐的 Grafana DashBoard:

JVM (Micrometer)-(https://grafana.com/grafana/dashboards/4701)

Spring Boot 2.1 Statistics -(https://grafana.com/grafana/dashboards/10280)

Node Exporter - (https://grafana.com/grafana/dashboards/8919)

Druid - https://grafana.com/grafana/dashboards/11157

主机基础监控-(
https://grafana.com/grafana/dashboards/9276)

 

监控软件:Prometheus

 


监控软件:Prometheus

 


监控软件:Prometheus

 

最终展示效果:

监控软件:Prometheus

 



Tags:监控软件   点击:()  评论:()
声明:本站部分内容及图片来自互联网,转载是出于传递更多信息之目的,内容观点仅代表作者本人,如有任何标注错误或版权侵犯请与我们联系(Email:2595517585@qq.com),我们将及时更正、删除,谢谢。
▌相关推荐
PrometheusPrometheus是一个开源监控解决方案,用于收集和聚合指标作为时间序列数据。更简单地说,Prometheus 商店中的每个项目都是一个指标事件,并带有它发生的时间戳。Mac 搭...【详细内容】
2022-04-14  Tags: 监控软件  点击:(0)  评论:(0)  加入收藏
htop,这是一个跨平台的交互式硬件资源监视器。它是一个文本模式的应用程序,可以响应键盘鼠标进行交互式操作。 相比top,htop的功能强大太多,包含以下特性等等,可以查看变更日志...【详细内容】
2020-09-02  Tags: 监控软件  点击:(82)  评论:(0)  加入收藏
电脑监控专家超级眼监功能强大,操作方便,只需一分钟即可快速 在局域网部署完毕。拥有这款企业监控软件,您再也不用为员工工作效率低下而忧虑了,对员工的工作状况评估更加客观,及...【详细内容】
2020-08-31  Tags: 监控软件  点击:(128)  评论:(0)  加入收藏
▌简易百科推荐
PrometheusPrometheus是一个开源监控解决方案,用于收集和聚合指标作为时间序列数据。更简单地说,Prometheus 商店中的每个项目都是一个指标事件,并带有它发生的时间戳。Mac 搭...【详细内容】
2022-04-14  拔土豆的程序员    Tags:监控软件   点击:(0)  评论:(0)  加入收藏
Fping是一个命令行工具,类似于ping,用于发送ICMP ( Internet控制消息协议 ),Fping与ping不同之处在于可以指定要ping的主机数量范围或主机列表文件,而且性能要高很多。Fping主要应...【详细内容】
2022-04-14  IT智能化专栏    Tags:Fping   点击:(1)  评论:(0)  加入收藏
《开源精选》是我们分享Github、Gitee等开源社区中优质项目的栏目,包括技术、学习、实用与各种有趣的内容。本期推荐的是一个通过Web访问设备终端的工具&mdash;&mdash;rtty。...【详细内容】
2022-04-08  GitHub精选    Tags:Linux终端   点击:(10)  评论:(0)  加入收藏
harles 不能直接抓取 HTTPS 请求,以请求百度(下图)为例,可以看到请求下方报文都显示为 unknown ,说明现在我们无法获取 HTTPS 的报文。 一、抓取 HTTPS 的请求需要进行三步配置1...【详细内容】
2022-04-07  大田测试录    Tags:抓包工具   点击:(8)  评论:(0)  加入收藏
内网穿透技术:说到内网穿透,相信很多人肯定一知半解,到底什么是内网穿透呢!什么情况下需要内网穿透呢!接下来给大家简单的述说一下原理,内网穿透,也即 NAT 穿透,进行 NAT 穿透是为了...【详细内容】
2022-04-02  推荐时代科技    Tags:内网穿透软件   点击:(26)  评论:(0)  加入收藏
最近在研究zabbix的腾讯云监控,这是客户的需求之一,也是我们公司产品拓展,以及zabbix功能强大的一次体现,意义还是比较大的。所以本人要全力去搞好这一块云平台方面的东西。本次...【详细内容】
2022-03-17  乐维IT君    Tags:Zabbix   点击:(25)  评论:(0)  加入收藏
一、Htop界面展示 “Htop是一个用于Linux/Unix系统的交互式实时进程监控应用程序,也是top命令的替代品,它是所有Linux操作系统上预装的默认进程监控工具。Htop还有许多其他用...【详细内容】
2022-03-10  IT野涵    Tags:监控工具   点击:(27)  评论:(0)  加入收藏
wireshark数据包分析工具。非常流行的网络封包分析软件,功能屈指可数。wireshark是开源软件,可以放心使用。使用范围也是非常广的;只要是网络方面的都会用到这款工具。来看下界...【详细内容】
2022-03-04  阿兹绯言沫藺    Tags:wireshark   点击:(56)  评论:(0)  加入收藏
netcat 简称 nc,安全界叫它瑞士军刀。ncat 也会顺便介绍,弥补了 nc 的不足,被叫做 21 世纪的瑞士军刀。nc 的基本功能如下: 端口扫描 telnet / 获取系统 banner 信息 传输文本信...【详细内容】
2022-02-23  会测试的鲸鱼    Tags:netcat   点击:(54)  评论:(0)  加入收藏
现在很多网站都会带有不少广告或是弹窗信息,那么这些要如何隐藏或将其屏蔽呢?下面就来教大家Safari浏览器广告隐藏与阻止弹窗方法。显示阅读器阅读器会将网页格式化,只显示相关...【详细内容】
2022-02-10    搞趣网  Tags:Safari   点击:(59)  评论:(0)  加入收藏
站内最新
站内热门
站内头条