从品牌网站建设到网络营销策划,从策略到执行的一站式服务
cat check_xen_temp.sh #!/bin/bash ipmitool sensor | gawk -F'|' ' BEGIN { EXIT=0; MSG[0]="OK: "; MSG[1]="WARNING: "; MSG[2]="CRITICAL: "; perf=""; } { gsub(/\t/," "); gsub(/ +/," "); gsub(/ +\|/,"|"); gsub(/\| +/,"|") } /^[^|]+\|0x0\|/ { next; }; /^[^|]+\|na\|/ { next; }; /degrees C/ { THING=$1; TEMP=$2; OK=$4; WARN=$8; CRIT=$9; if (OK ~ /ok/) { MSG[0] = sprintf("%s %s is %dC,",MSG[0] ,THING,TEMP); perf = sprintf("%s %s=%d;%d;%d;0;100;",perf,THING,TEMP,WARN,CRIT); next; } if (CRIT !~ /na/ && TEMP>=CRIT) { MSG[2] = sprintf("%s %s is %dC (max %d) ", MSG[2], THING, TEMP, CRIT); perf = sprintf("%s %s=%d;%d;%d;0;100;",perf,THING,TEMP,WARN,CRIT); EXIT=2; next; } if (WARN !~ /na/ && TEMP>=WARN) { MSG[1] = sprintf("%s %s is %dC (max %dC, critical at %dC) ", MSG[1], THING, TEMP, CRIT); perf = sprintf("%s %s=%d;%d;%d;0;100;",perf,THING,TEMP,WARN,CRIT); if (EXIT=0) EXIT=1; next; } MSG[2] = sprintf("%s %s is %d (%s) ", MSG[2], THING, TEMP, OK); perf = sprintf("%s %s=%d;%d;%d;0;100;",perf,THING,TEMP,WARN,CRIT); if (EXIT=0) EXIT=1; } END { gsub(/, *$/,"",MSG[EXIT]); gsub(/ Temp/,"",MSG[EXIT]); gsub(/ Temp/,"",perf); print MSG[EXIT],"|",perf; exit EXIT; } '
成都网站建设公司地址:成都市青羊区太升南路288号锦天国际A座10层 建设咨询028-86922220
成都快上网科技有限公司-四川网站建设设计公司 | 蜀ICP备19037934号 Copyright 2020,ALL Rights Reserved cdkjz.cn | 成都网站建设 | © Copyright 2020版权所有.
专家团队为您提供成都网站建设,成都网站设计,成都品牌网站设计,成都营销型网站制作等服务,成都建网站就找快上网! | 成都网站建设哪家好? | 网站建设地图