首页 > 代码库 > zabbix邮件报警脚本(Python)
zabbix邮件报警脚本(Python)
#!/usr/bin/python#coding:utf-8import smtplibfrom email.mime.text import MIMETextimport sysmail_host = ‘smtp.exmail.qq.com‘mail_user = ‘邮箱全称‘mail_pass = ‘密码‘mail_postfix = ‘域名‘def send_mail(to_list,subject,content): me = mail_user+"<"+mail_user+"@"+mail_postfix+">" msg = MIMEText(content) msg[‘Subject‘] = subject msg[‘From‘] = me msg[‘to‘] = to_list try: s = smtplib.SMTP() s.connect(mail_host) s.login(mail_user,mail_pass) s.sendmail(me,to_list,msg.as_string()) s.close() return True except Exception,e: print str(e) return False#if __name__ == "__main__":send_mail(sys.argv[1], sys.argv[2], sys.argv[3])
zabbix邮件报警脚本(Python)
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。