自定义短信提醒:
#!/bin/bash day=`date +%Y%m%d_%H%M` date_time=`date +%Y%m%d_%H:%M:%S` mobile=$1 content="$2 $date_time" content=`echo $content | sed ‘s/%/%2525/‘` log_dir=/usr/local/share/zabbix/alertscripts/log function redirect_log () { log_file=$log_dir/sms_${day}_${mobile}.log log_err=$log_dir/sms_${day}_${mobile}.err.log mkdir -p $log_dir exec 1>$log_file exec 2>$log_err } # ---------- end of function redirect_log ---------- redirect_log # [[ $mobile -eq 18502138230 ]] && echo "now exit" && exit 3 #eric /usr/local/share/zabbix/alertscripts/urllib $mobile $content [ $? -eq 0 ] && echo "smsto:$mobile content:$content Successfull." || echo "smsto:$mobile content:$content Failed."
/usr/local/share/zabbix/alertscripts/urllib 脚本
#!/usr/bin/env python import urllib import sys import random phone=sys.argv[1] mess=sys.argv[2] seqidnum=random.randint(1,1000) urllib.urlopen(‘http://sdk4report.eucp.b2m.cn:8080/sdkproxy/sendsms.action?cdkey=6SDK-EMY-6688-KKQML&password=366078&phone=%s&message=%s&seqid=%s‘ % (phone,mess,seqidnum))
本文出自 “SQLServer MySQL” 博客,转载请与作者联系!
原文地址:http://dwchaoyue.blog.51cto.com/2826417/1969468