* @author Andy Wilkinson * @since 1.2.0 */ @ConfigurationProperties(prefix = "management.health.diskspace (in bytes) */ public DiskSpaceHealthIndicator(File path, long threshold) { super("DiskSpace " ] } /actuator/metrics/diskspace.usage { "name": "diskspace.usage", "measurements": [ { "statistic ": "VALUE", "value": 96.99886102691765 } ], "availableTags": [] } 小结 springboot2默认把diskspace作为一个 这里通过自定义micrometer的metrics,新增diskspace相关指标,这样就可以统一通过metrcis进行监控报警。
= "df" diskspace_arg = "-h" print ("Gathering diskspace information %s command:\n" % diskspace) subprocess.call ([diskspace, diskspace_arg]) #! ="df -h" printf "Gathering diskspace information with the $DISKSPACE command: \n\n" $DISKSPACE 你看以上的脚本的时候 ="df -h" printf "Gathering diskspace information with the $DISKSPACE command: \n\n" $DISKSPACE = "df" diskspace_arg = "-h" print ("Gathering diskspace information %s command:\n" % diskspace
with %s command:\n" % uname subprocess.call([uname,uname_arg]) #command 2 def disk_func(): diskspace = "df" diskspace_arg="-h" print "Gathering diskspace information %s command:\n" % diskspace subprocess.call([diskspace,diskspace_arg]) def main(): uname_func() disk_func() main()
11 echo -en "\t\t Enter option:" 12 read -n 1 option 13 } 14 15 function diskspace ;; 38 1) 39 diskspace ;; 40 2) 41 whoseon ;; 42 3) 43 memusage ;; /bin/bash 2 function diskspace 3 { 4 clear 5 df -k 6 } 7 8 function a menu 3 temp=$(mktemp -t test.XXXXXX) 4 temp2=$(mktemp -t test2.XXXXXX) 5 6 function diskspace a menu 3 temp=$(mktemp -t test.XXXXXX) 4 temp2=$(mktemp -t test2.XXXXXX) 5 6 function diskspace
/usr/bin/env bash # using select in the menu function diskspace { clear df -k } function whoseon usage" "Exit program" do case $option in "Exit program") break ;; "Display disk space") diskspace Exit program\n\n" echo -en "\t\tEnter option:" read -n 1 option } function diskspace { clear using dialog to create a menu temp=`mktemp -t test.XXXXXX` temp2=`mktemp -t test2.XXXXXX` function diskspace -eq 1 ] then break fi selection=`cat $temp2` case $selection in 1) diskspace
Gathering system information with %s command:\n" % uname subprocess.call([uname,uname_arg]) #command 2 diskspace = "df" diskspace_arg = "-h" print "Gathering diskspace information %s command:\n" %diskspace subprocess.call ([diskspace,diskspace_arg]) 输出结果: [root@py_unix home]# python osinfo.py Gathering system information Information Gathering Script #Command 1 UNAME="uname -a" printf "内核信息$UNAME \n\n" $UNAME #Command 2 DISKSPACE ="df -h" printf "内存信息$DISKSPACE \n\n" $DISKSPACE ############# 注意Bash的空格 subprocess模块 加载subprocess
I'm good." } }, "diskSpace": { "status": "UP", "details": { "total" 监控磁盘剩余空间 创建监控项并修改以下配置: 名称:Spring boot Application: Disk free space 类型:相关项目 键值:spring.boot.actuator.health.diskspace.free actuator health 信息类型:数字(无正负) 单位:B 应用集:Spring boot Application 在进程标签页添加步骤: 名称:JSONPath 参数:$.components.diskSpace.details.free
Gathering system information with %s command: ” %uname subprocess.call([uname, uname_arg])#command 2 diskspace = “df”diskspace_arg= “-h” print “Gathing diskspace information %s command: ” %diskspace subprocess.call ([diskspace,diskspace_arg]) 版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。
13MB,未计算副本)、路径(/test1) [root@node1 ~]# hdfs dfs -put apache-zookeeper-3.8.1-bin.tar.gz /test1 put: The DiskSpace quota of /test1 is exceeded: quota = 1048576 B = 1 MB but diskspace consumed = 402671535 B = 384.02
访问 http://localhost:8010/actuator/health ,可获得类似如下结果: { "status": "UP", "details": { "diskSpace 再次访问 http://localhost:8010/actuator/health ,可获得类似如下结果: { "status": "UP", "details": { "diskSpace
function GetDiskSpc { if [ $# -ne 1 ] then return 1 fi Folder="$1$" DiskSpace =`df -k |grep $Folder |awk '{print $5}' |awk -F% '{print $1}' echo $DiskSpace } 示例演示: 1)源程序(检测目录为 /boot) Folder="/boot" DiskSpace=`GetDiskSpc $Folder` echo "The system $Folder disk space is $DiskSpace%" if [ $DiskSpace -gt 90 ] then { echo "The usage of system disk($Folder)
org.apache.hadoop.hdfs.protocol.DSQuotaExceededException: org.apache.hadoop.hdfs.protocol.DSQuotaExceededException: The DiskSpace quota of /group/d_sdo_data/user/liuxiaowen is exceeded: quota=3000 diskspace consumed=384.0m 后来发现原因
组件级健康检查:GET /actuator/health/{component} 如/actuator/health/diskSpace,可以单独查看某个组件的健康状态,便于问题定位。 允许开发者定义不同的检查组合: management: endpoint: health: group: custom: include: diskSpace 确认配置的监控路径存在且可读 空间计算:通过File.getUsableSpace()获取可用字节数 阈值比较:将可用空间与配置阈值比对 其配置参数具有灵活的定制性: management.health.diskspace.enabled =true management.health.diskspace.path=/data # 监控路径(默认项目根目录) management.health.diskspace.threshold=10MB 磁盘空间检查器:DiskSpaceHealthIndicator通过FileStore.getUnallocatedSpace()检测剩余空间,阈值默认10MB(可通过management.health.diskspace.threshold
Ubuntu20.04时提示的信息如下: Low Disk Space on “Filesystem root” The volume “Filesystem root” has only 542.5MB diskspace
"status": "UP", "jms": { "status": "UP", "provider": "ActiveMQ" }, "diskSpace
例如:{ "status": "UP", "details": { "diskSpace": { "status": "UP", "details": { "
"status": "UP", "jms": { "status": "UP", "provider": "ActiveMQ" }, "diskSpace
":{ "database":"MySQL", "hello":1 } }, "diskSpace
shutdown: enabled: true 2、相关接口 2.1 Get类型接口:主机:端口/monitor/health,查看应用的健康信息,三个核心指标:status状态,diskSpace 磁盘空间,ping检查; { /* 状态值 */ "status": "UP", "components": { /* 磁盘空间 */ "diskSpace": { "status
默认情况下是最后100个HTTP请求) true loggers 提供显示和修改应用程序中loggers配置的功能 true 5.访问结果示例 /health { status: "UP", diskSpace