shell监测磁盘使用并发送邮件
[root@li229- scripts]# sendEmail --help
sendEmail-1.56 by Brandon Zehm <caspian@dotconf.net>
Synopsis: sendEmail -f ADDRESS [options] Required:
-f ADDRESS from (sender) email address(发送人邮箱)
* At least one recipient required via -t, -cc, or -bcc
* Message body required via -m, STDIN, or -o message-file=FILE Common:
-t ADDRESS [ADDR ...] to email address(es)(接收人邮箱)
-u SUBJECT message subject(主题)
-m MESSAGE message body(正文)
-s SERVER[:PORT] smtp mail relay, default is localhost:25(发件人邮箱的SMTP服务器) Optional:
-a FILE [FILE ...] file attachment(s)(附件)
-cc ADDRESS [ADDR ...] cc email address(es)
-bcc ADDRESS [ADDR ...] bcc email address(es)
-xu USERNAME username for SMTP authentication(发件人邮箱的用户名)
-xp PASSWORD password for SMTP authentication(发件人邮箱的密码) Paranormal:
-b BINDADDR[:PORT] local host bind address
-l LOGFILE log to the specified file
-v verbosity, use multiple times for greater effect
-q be quiet (i.e. no STDOUT output)
-o NAME=VALUE advanced options, for details try: --help misc
-o message-content-type=<auto|text|html>
-o message-file=FILE -o message-format=raw
-o message-header=HEADER -o message-charset=CHARSET
-o reply-to=ADDRESS -o timeout=SECONDS
-o username=USERNAME -o password=PASSWORD
-o tls=<auto|yes|no> -o fqdn=FQDN Help:
--help the helpful overview you're reading now
--help addressing explain addressing and related options
--help message explain message body input and related options
--help networking explain -s, -b, etc
--help output explain logging and other output options
--help misc explain -o options, TLS, SMTP auth, and more
#!/bin/bash
partition_list=(`df -h | awk 'NF>3&&NR>1{sub(/%/,"",$(NF-1));print $NF,$(NF-1)}'`)
notification_email()
{
emailfrom='sunzy@163.com'
sendto='7589457343@qq.com'
emailsmtp='smtp.163.com'
title='Disk Space Alarm'
emailuser='sunzy@163.com'
emailpasswd='*****'
/usr/sbin/sendmail -f $emailfrom -t $sendto -s $emailsmtp -u $title -xu $emailuser -xp $emailpasswd
}
critical=80
crit_info=""
for (( i=0;i<${#partition_list[@]};i+=2 ))
do
if [ "${partition_list[((i+1))]}" -lt "$critical" ];then
echo "OK! ${partition_list[i]} used ${partition_list[((i+1))]}%"
else if [ "${partition_list[((i+1))]}" -gt "$critical" ];then
crit_info=$crit_info"Warning!!! ${partition_list[i]} used ${partition_list[((i+1))]}%\n"
echo -e $crit_info | notification_email
fi
done
shell监测磁盘使用并发送邮件的更多相关文章
- Linux Shell之监测磁盘空间
Linux Shell之监测磁盘空间 系统管理员的另一个重要任务就是监测系统磁盘的使用情况.不管运行的是简单Linux台式机还是大型的Linux服务器,我们都要知道还有多少空间可以留给应用程序.事实上 ...
- 通过SSIS监控远程服务器磁盘空间并发送邮件报警!
由于之前ESB是供应商部署的,且部署在C盘(C盘空间很小,还添加了很多ESB的windows服务日志在C盘,很容易把C盘空间占满,导致ESB服务运行宕机,几乎每隔几周发生一次事故,需要人工干预处理,不 ...
- Linux Shell查看磁盘分区,内存使用,CPU使用率
Linux Shell查看磁盘分区,内存使用,CPU使用率 #!/bin/bash #disk_used_rate Location=/dev/xvdb Disk_Used_Rate=$(df -h ...
- shell 监控磁盘使用率【转】
方案一: disks=(`df |sed 1d | awk '{print $1,$5}'|tr -d %`) len=${#disks[@]} ;i<=$len;i=i+));do ];the ...
- Linux系统下如何监测磁盘的使用空间
不管是我们在安装软件还是监测软件的使用性能,我们都要随时掌握系统磁盘的使用情况. 使用df命令 df df命令用于显示磁盘分区上的可使用的磁盘空间.默认显示单位为KB.可以利用该命令来获取硬盘被占用了 ...
- 通过SSIS监控远程服务器磁盘空间并发送邮件报警
本文直接参考了博客园软件人生的文章操作的,写在这里只为做个记录. 到公司这边先把两个报表服务器接收了. 为防止宕机,部署个磁盘警告的SSIS包. Step 1 建立两个变量来接收和写入磁盘容量 Ste ...
- shell之磁盘容量检查,配合crontab可以定时清理磁盘
我的做法: !/bin/bashAvailable=`df -k | sed -n 2p | awk '{print $4}'`if [ $Available -eq 0 ];then ...
- Linux 监测磁盘常用的工具sar iostat vmstat
Linux 检测内存常用的工具sar iostat vmstat #每秒刷新一次显示2次 sar -d 1 2 iostat -kx 1 2 vmstat -d 1 2 磁盘统计信息解释 tps 每秒 ...
- C++ 监测磁盘空间
硬盘管理器 头文件 HardDiskManager.h : #if _MSC_VER > 1000 #pragma once #endif #include <windows.h> ...
随机推荐
- 基于事件驱动的前端通信框架(封装socket.io)
socket.io的使用可以很轻松的实现websockets,兼容所有浏览器,提供实时的用户体验,并且为程序员提供客户端与服务端一致的编程体验.但是在使用socket.io的过程中,由于业务需求需要同 ...
- QCon2016 上海会议汇总(2) - 团队管理
QCon 2016上海日程:http://2016.qconshanghai.com/schedule <当你的团队还支撑不起梦想时> - 链尚网技术合伙人 杨荣伟 Figo讲述了如何训练 ...
- js 实现滑块效果
var dd = $(".drag_bott").removeAttr('id').last().attr('id','drag_bott'); var drag = docume ...
- zabbix实现mysql数据库的监控(一)
zabbix是一个基于WEB界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案.它能监视各种网络参数,保证服务器系统的安全运营:并提供灵活的通知机制以让系统管理员快速定位/解决存在的各种问 ...
- debian下蓝牙适配器的配置和使用
本文打算将蓝牙适配器和手机蓝牙进行配对. 买了个支持蓝牙4.0协议的蓝牙适配器,将其插入到pc(debian 7.4)的usb口. 查看手机蓝牙信息: 选择手机中"设置"-> ...
- in型子查询陷阱,exists子查询
in 型子查询引出的陷阱 select goods_id from goods where cat_id in (1,2,3) 直接用id,不包含子查询,不会中陷阱 题: 在ecshop商城表中,查询 ...
- Ogre场景编辑器Ogitor源代码的构建
本文转自:http://blog.csdn.net/zhengkangchen/article/details/6000769 Ogitor-0.4.2源代码构建,不少时间,这里记录一下: 下载源代码 ...
- Java 环境变量设置 -- JAVA_HOME CLASSPATH
1.打开我的电脑--属性--高级--环境变量 2.新建系统变量JAVA_HOME 和CLASSPATH 变量名:JAVA_HOME 变量值:C:\Program Files\Java\jdk1.7.0 ...
- oarcle12c打开本地数据库
--显示当前数据库的链接db,是cdb还是pdb. show con_name;--在oracle12c中打开本地数据库,否则本地数据库无法链接alter pluggable database pdb ...
- Windows 下GitHub 安装和使用
一.官网注册和设置 1.登录官网,注册账号,其中用户名以后会用到. 2.创建仓库.使用公开仓库方式创建,公开仓库免费.(右上角->加号->new repository) 第一行:仓库名字. ...