日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

zzlinux运维自动化shell脚本小工具

發布時間:2024/10/12 linux 38 豆豆
生活随笔 收集整理的這篇文章主要介紹了 zzlinux运维自动化shell脚本小工具 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

from http://www.cnblogs.com/wang-li/p/5728461.html

linux運維shell 腳本小工具,如要分享此文章,請注明文章出處,以下腳本僅供參考,若放置在服務器上出錯,后果請自負

1.檢測cpu剩余百分比

#!/bin/bash#Inspect CPU#Sun Jul 31 17:25:41 CST 2016 PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/wl/bin export PATH TERM=linux export TERM CpuResult=$(top -bn 1 | grep "Cpu" | awk '{print $5}' | sed 's/\..*$//g') if [[ $CpuResult < 20 ]];then echo "CPU WARNING : $CpuResult" > /service/script/.cpu_in.txt top -bn 1 >> /service/script./cpu_in.txt mail -s "Inspcet CPU" wl < /service/script/.cpu_in.txt fi

2.檢測內存

#!/bin/bash#Inspect Memory : If the memory is less than 500 , then send mail to wl#Tue Aug 2 09:13:43 CST 2016 PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/wl/bin export PATH MEM=$(free -m | grep "Mem" | awk '{print $4}') if [[ MEM < 500 ]];then echo -e "Memory Warning : Memory free $MEM" > /service/script/.MemoryWarning mail -s "Memory Warning" wl < /service/script/.MemoryWarning fi

3.檢測磁盤剩余空間

#!/bin/bash#Insepct Harddisk , If the remaining space is more than 80%, the message is sent to the wl#Tue Aug 2 09:45:56 CST 2016 PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/wl/bin export PATH for RemainingSpace in $(df -h | awk '{print $5}' | grep -v 'Use' | sed -e 's/[%]//g') do if [[ $RemainingSpace > 80 ]];then echo -e "$RemainingSpace" echo -e "$(df -h | grep $RemainingSpace)" > /service/script/.HarddiskWarning mail -s "disk Warning" wl < /service/script/.HarddiskWarning fi done

4.檢測剩余Inode

#!/bin/bash#Inspcet Inode : If the free INODE is less than 200, the message is sent to the wl#Tue Aug 2 10:21:29 CST 2016 PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/wl/bin export PATH for FreeInode in $(df -i | grep -v "Filesystem" | awk '{print $4}') do if [[ $FreeInode < 200 ]];then echo -e "$(df -i | grep "$FreeInode")" > /service/script/.FreeInode mail -s "FreeInode Warning" wl < /service/script/.FreeInode fi done

轉載于:https://www.cnblogs.com/zhangqiang1981/p/5745272.html

總結

以上是生活随笔為你收集整理的zzlinux运维自动化shell脚本小工具的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。