自定义短信提醒:
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了自定义短信提醒:相关的知识,希望对你有一定的参考价值。
自定义短信提醒:
#!/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” 博客,转载请与作者联系!
以上是关于自定义短信提醒:的主要内容,如果未能解决你的问题,请参考以下文章