用python写一个zabbix短信脚本
时间: 2023-03-14 21:23:51 浏览: 110
python实现zabbix发送短信脚本
我可以为你提供一个使用Python编写的Zabbix短信脚本的示例:# 导入所需的库
import smtplib
from email.mime.text import MIMEText# 设置发送者信息
sender = "your@email.com"
password = "your_password"# 设置接收者信息
recipient = "recipient@email.com"# 创建邮件内容
message = MIMEText("This is a message from Zabbix")
message['Subject'] = "Zabbix Notification"
message['From'] = sender
message['To'] = recipient# 发送短信
server = smtplib.SMTP('smtp.server.com', 587)
server.starttls()
server.login(sender, password)
server.sendmail(sender, recipient, message.as_string())
server.quit()
阅读全文