コード例 #1
0
ファイル: osaEmailNotice.py プロジェクト: hacder/src
def mailto_users_server(users,level,ipid):
	'''
	@根据报警类型和用户列表发送邮件
	'''
	rs = server_get_ipinfo(ipid)
	if rs == False:
		return False
	devname = rs[1]
	ipstr = rs[2]
	reason = ''
	content,subject = server_alarm_content(devname,ipstr,reason,level)
	userlist = get_mailto_users(users)
	for user in userlist:
		mailto = get_email_byname(user)
		sendMail(subject,content,mailto)
コード例 #2
0
ファイル: osaEmailNotice.py プロジェクト: hacder/src
def mailto_users_item(users,type,level,itemid):
	'''
	@根据报警类型和用户列表发送邮件
	@项目报警类型跟内容暂时还没确定,暂时不能使用
	'''
	#content = choose_template(type)
	
	rs = monitor_get_iteminfo(itemid)
	if rs == False:
		return False
	itemname = rs[1]
	itemobject = rs[2]
	content,subject = monitor_alarm_content(type,itemname,itemobject,level)	
	userlist = get_mailto_users(users)
	for user in userlist:
		mailto = get_email_byname(user)
		sendMail(subject,content,mailto)
コード例 #3
0
ファイル: collect.py プロジェクト: hacder/src
def mail_status_alarm(ipinfo,userlist,content,maxnum,level,subject):
	'''
	@邮件发送报警状态相关
	@返回isNoticeNow,isNoticeNext,noticeNextUsers,noticeNextTime
	'''
	isNoticeNow = isNoticeNext =0
	noticeNextUsers =''
	noticeNextTime ='0000-00-00 00:00:00'
	for user in userlist:
		isEmail = is_notice_server(ipinfo,user,maxnum,level)
		if isEmail == 'not-send':#不发送
			pass
		elif isEmail == 'now-send':#立即发送
			isNoticeNow += 1 #表示已通知
			mailto = get_email_byname(user)
			#content = choose_template(template)
			sendMail(subject,content,mailto)
		else:#转下次发送
			isNoticeNext += 1
			noticeNextUsers += user+',' 
			noticeNextTime = isEmail
	return isNoticeNow,isNoticeNext,noticeNextUsers,noticeNextTime