Linux OPS automation shell scripting gadget

Source: Internet
Author: User

Linux ops shell script gadget, if you want to share this article, please indicate the source of the article, the following script is for reference only, if the error placed on the server, the consequences please be conceited

1. Detecting CPU percent remaining

#!/bin/bash#inspect Cpu#sun Jul to  -: -: ACst .PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/wl/Binexport pathterm=Linuxexport Termcpuresult=$ (top-bn1|grep "Cpu"|awk '{print $}'|sed 's/\. *$//g')if[[$CpuResult < -]]; Then  Echo "CPU WARNING: $CpuResult">/service/script/. Cpu_in.txt Top-bn1>>/service/script./Cpu_in.txt Mail-S"Inspcet CPU"WL </service/script/. Cpu_in.txtfi

2. Detecting Memory

#!/bin/Bash#inspect memory:if the Memory is Lessthan -, ThenSend mail to Wl#tue2  the: -: +Cst .PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/wl/Binexport Pathmem=$( Free-M |grep "Mem"|awk '{print $4}')if[MEM < -]]; Then  Echo-E"Memory warning:memory Free $MEM">/service/script/. Memorywarning Mail-S"Memory Warning"WL </service/script/. Memorywarningfi

3. Detecting disk space remaining

#!/bin/bash#insepct harddisk, If The remaining space is Morethan the%, the message is sent to the Wl#tue2  the: $: AboutCst .PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/wl/Binexport PATH forRemainingspaceinch$(DF-H |awk '{print $}'|grep-V' Use'|sed-E's/[%]//g') Do  if[[$RemainingSpace > the]]; Then    Echo-E"$RemainingSpace"    Echo-E"$ (df-h | grep $RemainingSpace)">/service/script/. Harddiskwarning Mail-S"Disk Warning"WL </service/script/. Harddiskwarningfi Done

4. Detecting remaining Inode

#!/bin/Bash#inspcet Inode:if the FreeINODE is Lessthan $, the message is sent to the Wl#tue2 Ten: +: inCst .PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/wl/Binexport PATH forFreeinodeinch$(DF-I. |grep-V"Filesystem"|awk '{print $4}') Do  if[[$FreeInode < $]]; Then    Echo-E"$ (df-i | grep"$FreeInode")">/service/script/. Freeinode Mail-S"Freeinode Warning"WL </service/script/. Freeinodefi Done

Time:2016-08-02 10:56:00

Name: Wang

Mail:[email protected]

Linux OPS automation shell scripting gadget

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.