查看脚本帮助:
为文成等地区用户提供了全套网页设计制作服务,及文成网站建设行业解决方案。主营业务为成都网站建设、成都做网站、文成网站设计,以传统方式定制建设网站,并提供域名空间备案等一条龙服务,秉承以专业、用心的态度为用户提供真诚的服务。我们深信只要达到每一位用户的要求,就会得到认可,从而选择与我们长期合作。这样,我们也可以走得更远!
- [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
: Global Warning level in % for user/system/io-wait cpu - -uw
: Warning level in % for user cpu - -iw
: Warning level in % for IO_wait cpu - -sw
: Warning level in % for system cpu - -c
: Global Critical level in % for user/system/io-wait cpu - -uc
: Critical level in % for user cpu - -ic
: Critical level in % for IO_wait cpu - -sc
: Critical level in % for system cpu - -i
: Interval in seconds for iostat (default : 1) - -n
: 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 -w 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 -c 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实际的使用情况。
弄清楚脚本,监控配置就容易多了。。
附脚本: