To achieve the effect, and the selection period ip, shows the use of resources at the selected time period is the ip
MongoDB get inside to add a table name of the method followed by the monitored machines ip do table
get_all_collections DEF (Self, Database):
"" "get all the table names, database: database name" ""
_database = self.connect.get_database (Database)
return _database.collection_names ()
Which increased after the common e-mail capabilities for monitoring e-mail alarm trigger defaults
def smtp_service(sender, password, receiver, message):
""" 定义发送邮件,sender:发件人,receiver:收件人,message:要发送的信息 """
server = 'smtp.qq.com'
try:
smtp = smtplib.SMTP()
smtp.connect(server)
smtp.login(sender, password)
smtp.sendmail(sender, receiver, message.as_string())
print("发送邮件给{0}成功!!!".format(receiver))
except smtplib.SMTPException as error:
print(error)
print("发送邮件给{0}失败!!!".format(receiver))
finally:
smtp.quit()
def send_email(receiver, template):
""" receiver: 接收者、template: 触发报警时的发送内容模板 """
sender = '[email protected]'
password = "xxxxxxx" # smtp密码
title = '测试平台报警邮件!'
message = MIMEText(template, 'html', 'utf-8')
message['From'] = sender
message['To'] = receiver
message['Subject'] = Header(title, 'utf-8')
smtp_service(sender, password, receiver, message)
准备好一个选时间的控件,这里使用bootstrap的