查看腳本幫助:
為文成等地區(qū)用戶提供了全套網(wǎng)頁設(shè)計制作服務(wù),及文成網(wǎng)站建設(shè)行業(yè)解決方案。主營業(yè)務(wù)為成都網(wǎng)站建設(shè)、成都做網(wǎng)站、文成網(wǎng)站設(shè)計,以傳統(tǒng)方式定制建設(shè)網(wǎng)站,并提供域名空間備案等一條龍服務(wù),秉承以專業(yè)、用心的態(tài)度為用戶提供真誠的服務(wù)。我們深信只要達(dá)到每一位用戶的要求,就會得到認(rèn)可,從而選擇與我們長期合作。這樣,我們也可以走得更遠(yuǎn)!
- [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%;
后面兩項為設(shè)置的WARNING和CRITICAL的閥值,第一項為cpu實際的使用情況。
弄清楚腳本,監(jiān)控配置就容易多了。。
附腳本: