温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

nagios——check_cpu.sh测试使用

发布时间:2020-10-06 01:34:11 阅读:1055 作者:151wqooo 栏目:移动开发
开发者测试专用服务器限时活动,0元免费领,库存有限,领完即止! 点击查看>>

 查看脚本帮助: 

[root@wqk1 mnt]# ./check_cpu.sh  -h  check_cpu.sh Revision 1.0 - CPU Utilization check script for Nagios  Usage: check_cpu.sh [flags]  Flags:   -w  <number> : Global Warning level in % for user/system/io-wait cpu   -uw <number> : Warning level in % for user cpu   -iw <number> : Warning level in % for IO_wait cpu   -sw <number> : Warning level in % for system cpu   -c  <number> : Global Critical level in % for user/system/io-wait cpu   -uc <number> : Critical level in % for user cpu   -ic <number> : Critical level in % for IO_wait cpu   -sc <number> : Critical level in % for system cpu   -i  <number> : Interval in seconds for iostat (default : 1)   -n  <number> : Number report for iostat (default : 3)   -h  Show this page  Usage: check_cpu.sh Usage: check_cpu.sh --help   This plugin will check cpu utilization (user,system,iowait,idle in %) 

正常测试:

[root@wqk1 mnt]# ./check_cpu.sh  CPU OK : user=0% system=0% iowait=0% idle=100% | cpu_user=0%;70;90; cpu_sys=0%;70;90; cpu_iowait=0%;70;90; cpu_idle=100%

CPU WARNING测试:

[root@wqk1 mnt]# ./check_cpu.sh  -0 CPU WARNING : user=0% system=0% iowait=0% idle=100% | cpu_user=0%;0;90; cpu_sys=0%;0;90; cpu_iowait=0%;0;90; cpu_idle=100%; [root@wqk1 mnt]# ./check_cpu.sh  -uw 0 CPU WARNING : user=0% system=0% iowait=0% idle=100% | cpu_user=0%;0;90; cpu_sys=0%;70;90; cpu_iowait=0%;70;90; cpu_idle=100%; [root@wqk1 mnt]# ./check_cpu.sh  -iw 0 CPU WARNING : user=0% system=0% iowait=0% idle=100% | cpu_user=0%;70;90; cpu_sys=0%;70;90; cpu_iowait=0%;0;90; cpu_idle=100%; [root@wqk1 mnt]# ./check_cpu.sh  -sw 0 CPU WARNING : user=0% system=0% iowait=0% idle=100% | cpu_user=0%;70;90; cpu_sys=0%;0;90; cpu_iowait=0%;70;90; cpu_idle=100%

CPU CRITICAL测试: 

[root@wqk1 mnt]# ./check_cpu.sh  -0 CPU CRITICAL : user=1% system=0% iowait=0% idle=99% | cpu_user=1%;70;0; cpu_sys=0%;70;0; cpu_iowait=0%;70;0; cpu_idle=99%; [root@wqk1 mnt]# ./check_cpu.sh  -uc 0 CPU CRITICAL : user=0% system=0% iowait=0% idle=100% | cpu_user=0%;70;0; cpu_sys=0%;70;90; cpu_iowait=0%;70;90; cpu_idle=100%; [root@wqk1 mnt]# ./check_cpu.sh  -ic 0 CPU CRITICAL : user=0% system=0% iowait=0% idle=100% | cpu_user=0%;70;90; cpu_sys=0%;70;90; cpu_iowait=0%;70;0; cpu_idle=100%; [root@wqk1 mnt]# ./check_cpu.sh  -sc 0 CPU CRITICAL : user=0% system=0% iowait=0% idle=100% | cpu_user=0%;70;90; cpu_sys=0%;70;0; cpu_iowait=0%;70;90; cpu_idle=100%

 [root@wqk1 mnt]# ./check_cpu.sh  -w 0 -c 0

CPU CRITICAL : user=1% system=4% iowait=0% idle=95% | cpu_user=1%;0;0; cpu_sys=4%;0;0; cpu_iowait=0%;0;0; cpu_idle=95%;

后面两项为设置的WARNING和CRITICAL的阀值,第一项为cpu实际的使用情况。

弄清楚脚本,监控配置就容易多了。。

附脚本:

附件:http://down.51cto.com/data/2362603

亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI

开发者交流群×