40springboot——运行状态监控使用actuator

Arbitrary233      2022-05-06     397

关键词:

Spring Boot Actuator 提供了运行状态监控的功能 Actuator 监控数据可以通过阻REST
远程 shell 和JMX方式获得。我 首先来介绍通过 REST 方式查看 Actuator 的节点的方法,这
种是最常见且简单的方法。

 

通过执行器端点,您可以监控应用程序并与之交互。Spring Boot包含许多内置端点,允许您

添加自己的端点。例如, health端点提供基本的应用程序健康信息。

 

可以启用或禁用每个端点。它控制是否创建端点并且其bean存在于应用程序上下文中。要进行

远程访问,还必须通过JMX或HTTP公开端点 。大多数应用程序选择HTTP,其中端点的ID

以及前缀/actuator 映射到URL。例如,默认情况下,health端点映射到/actuator/health

 

 

官方文档地址:https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-endpoints.html

1、新建工程添加依赖

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

2.springboot2.x的配置

server.port=8009
management.server.port=8083
#开放所有页面节点  默认只开启了health、info两个节点
management.endpoints.web.exposure.include=*

#actuator端口

#修改访问路径  2.0之前默认是/   2.0默认是 /actuator  可以通过这个属性值修改
#management.endpoints.web.base-path: /actuator

#显示健康具体信息  默认不会显示详细信息
management.endpoint.health.show-details:ALWAYS

启动项目!!

3、访问http://localhost:8083/actuator

除了shutdown请求为post,其他的皆为GET请求

 可以使用以下与技术无关的端点:

应用程序是Web应用程序(Spring MVC,Spring WebFlux或Jersey)

则可以使用以下附加端点:

 Actuator 端口信息

 

启用端点

默认情况下,shutdown启用除除以外的所有端点。要配置端点的启用,请使用其

management.endpoint.<id>.enabled属性。以下示例启用shutdown端点:

management.endpoint.shutdown.enabled = true

 如果您希望端点启用是选择加入而不是选择退出,请将该

management.endpoints.enabled-by-default属性设置 为false并使用各个端点 enabled属性重新加入。

以下示例启用info端点并禁用所有其他端点:

management.endpoints.enabled-by-default = false
 management.endpoint.info.enabled = true

3、个别接口的使用:

health

http://localhost:8083/actuator/health

{
    "status": "UP",
    "details": {
        "diskSpace": {
            "status": "UP",
            "details": {
                "total": 248793526272,
                "free": 194452439040,
                "threshold": 10485760
            }
        }
    }
}

/health API 接口提供的信息是由 个或多个健康指示器提供的健康信息的组合结果

Spring Boot 自带的健康指示器

 具体看官网...........

 

转载来自https://www.cnblogs.com/Mrchengs/p/10596508.html

springboot2.x(十六):应用监控之springbootactuator使用及配置

Actuator简介Actuator是SpringBoot提供的对应用系统的自省和监控功能。通过Actuator,可以使用数据化的指标去度量应用的运行情况,比如查看服务器的磁盘、内存、CPU等信息,系统的线程、gc、运行状态等等。Actuator通常通过使用HTTP和... 查看详情

开发框架springboot

1.多个环境的配置文件在application.yml 中配置需要调用的配置文件spring:profiles:active:dev运行方式的,先运行application.yml 再根据active指定的配置文件,进行覆盖。2.运行状态监控Actuatorpom中引入依赖<!--运行状态监控--><de... 查看详情

springboot系列:springboot使用actuator

Actuator为springboot提供了运行状态监控的功能通过集成它我们可以试试获取到应用程序的运行信息首先,在pom.xml中引入起步依赖<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-actuator</arti 查看详情

使用prometheus监控ekuiper规则运行状态

...theus作为监控告警工具。​​eKuiper​​的规则是一个持续运行的流式计算任务。规则用于处理无界的数据流,正常情况下,规则启动后会一直运行,不断产生运行状态数据。直到规则被手动停止或出现不可恢复的错误后停止。eKu... 查看详情

使用springbootadmin监控应用状态(代码片段)

1SpringBootActuatorSpringBootActuator是SpringBoot提供的对应用的自省和监控功能,如健康检查,审计,指标收集,HTTP跟踪等,可以帮助开发和运维人员监控和管理SpringBoot应用。该模块采集应用的内部信息,并暴露... 查看详情

向aasm状态添加文本

Index:lib/acts_as_state_machine.rb===================================================================---lib/acts_as_state_machine.rb (revision66)+++lib/acts_as_state_machine.rb (workingcopy)@@-146,6+146,10@@self.send(self.class.state_column).to_symend +defcurrent_state_t... 查看详情

springboot(十九):使用springbootactuator监控应用

springBoot(十九):使用SpringBootActuator监控应用微服务的特点决定了功能模块的部署是分布式的,大部分功能模块都是运行在不同的机器上,彼此通过服务调用进行交互,前后台的业务流会经过很多个微服务的处理和传递,出现了异... 查看详情

centos7使用monit监控服务运行状态(代码片段)

安装:yum-yinstallepel-releaseyum-yinstallmonit配置:vim/etc/monitrcsetdaemon30setlogsyslogsethttpdport2812anduseaddress172.20.10.11allow172.20.10.2allowadmin:monit#withssl#enableSSL/TLSandsetpathtoserverc 查看详情

springboot应用监控的实战教程

概述SpringBoot监控核心是spring-boot-starter-actuator依赖,增加依赖后,SpringBoot会默认配置一些通用的监控,比如jvm监控、类加载、健康监控等。我们之前讲过Docker容器的可视化监控,即监控容器的运行情况,包括CPU使用率、内存占用... 查看详情

springboot/cloud应用监控

...要是监控服务及服务器的各项指标。该项目是使用了开源springboot监控项目spring-boot-admin,开源项目地址:spring-boo 查看详情

springboot系列——admin服务监控(代码片段)

  前言  springboot项目部署起来后,如何实时监控项目的运行状况呢?本文记录使用springboot-admin对服务进行监控。   springboot-admin介绍:https://codecentric.github.io/spring-boot-admin/current/#_what_is_spring_boot_admin   工程结构... 查看详情

springboot度量指标监控与健康检查和可视化监控应用springbootadmin

...            使用可视化监控应用SpringBootAdmin  使用步骤:    SpringBootAdmin的使用是需要建立服务端和客户端的    服务端:独立的项目,会将收集到的数据在自己的图形界面中展示   查看详情

在后台连续运行一个广播接收器来监控网络状态。

】在后台连续运行一个广播接收器来监控网络状态。【英文标题】:RunningaBroadcastReceivercontinuouslyinthebackgroundtomonitornetworkstatus..【发布时间】:2013-03-0913:52:30【问题描述】:我正在编写一个android应用程序以在每分钟后在后台持续... 查看详情

springboot服务监控,健康检查,线程信息,jvm堆信息,指标收集,运行情况监控等!

...微服务应用全部监控起来的任务。我们的微服务应用都是SpringBoot应用,因此就自然而然的想到了借助SpringBoot的Actuator模块。本篇是我在完成这个工单之后,对SpringBootActuator模块学习应用的总结。在本篇文章中,你可以学习到:1... 查看详情

微服务架构整理-(十springcloud实战之hystrix[3])(代码片段)

...pringCloud实战之Hystrix[3]-看版监控前言搭建Dashboard服务创建springboot工程添加依赖配置启动类添加配置文件引用Dashboard服务添加Hystrix依赖添加springboot服务监控依赖配置springboot监控接口的访问权限结果总结前言当需要查看服务的状... 查看详情

Gradle SpringBoot 项目:从服务器收到状态代码 501:需要 HTTPS

】GradleSpringBoot项目:从服务器收到状态代码501:需要HTTPS【英文标题】:GradleSpringBootProject:Receivedstatuscode501fromserver:HTTPSRequired【发布时间】:2020-11-0106:35:40【问题描述】:我正在尝试使用gradle和groovy构建简单的helloworldspring-boot项... 查看详情

springboot高级--springboot监控(代码片段)

01:SpringBoot高级–SpringBoot监控02:SpringBoot监控-SpringBootAdmin1.SpringBoot监控1.1SpringBoot监控概述SpringBoot自带监控功能Actuator,可以帮助实现对程序内部运行情况监控,比如监控状况、Bean加载情况、配置属性、日志信息... 查看详情

linux(centos7)下springboot项目jar包使用sh脚本运行

一般情况下springboot项目部署到linux下面需要经过一下几个步骤:1.查看项目是否在运行状态(常用命令[其中一个]):1ps-ef|grepxxx.jar2.如果项目在运行状态,需要先将现在运行的项目pid杀掉(常用命令[其中之一]):1kill-9xxx3.然后... 查看详情